Skip to content

ffmpeg streams not terminating after playback stopped #481

@bendschs

Description

@bendschs

ffmpeg streams are not being stopped. after playback is being stopped in the remote jellyfin client. jellyfin-mpv-shim throws an error that says "Terminating transcode failed." the stream i am trying to play does not need transcoding though, it's just direct play. so i think there is a problem with terminating ffmpeg streams, after playback stops they just live on forever unless i terminate them manually or reboot.

2025-12-12 10:58:06,399 [    INFO] update_check: Checking for updates...
2025-12-12 10:58:16,227 [    INFO] player: PlayerManager::stop stopping playback of <jellyfin_mpv_shim.media.Video object at 0x7fff75b37450>
400 Client Error: Bad Request for url: http://redacted.com:8096/Videos/ActiveEncodings?DeviceId=8a4f396c-c955-44bf-8ef9-2cafe5e56bfd
2025-12-12 10:58:16,240 [   ERROR] Jellyfin.jellyfin_apiclient_python.http: 400 Client Error: Bad Request for url: http://media.agreiter.ch:8096/Videos/ActiveEncodings?DeviceId=8a4f396c-c955-44bf-8ef9-2cafe5e56bfd
2025-12-12 10:58:16,241 [ WARNING] media: Terminating transcode failed.
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.11/site-packages/jellyfin_apiclient_python/http.py", line 127, in request
    r.raise_for_status()
  File "/home/pi/.local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://media.agreiter.ch:8096/Videos/ActiveEncodings?DeviceId=8a4f396c-c955-44bf-8ef9-2cafe5e56bfd

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/jellyfin_mpv_shim/media.py", line 162, in terminate_transcode
    self.client.jellyfin.close_transcode(
  File "/home/pi/.local/lib/python3.11/site-packages/jellyfin_apiclient_python/api.py", line 754, in close_transcode
    return self._delete("Videos/ActiveEncodings", params={
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/.local/lib/python3.11/site-packages/jellyfin_apiclient_python/api.py", line 74, in _delete
    return self._http("DELETE", handler, {'params': params})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/.local/lib/python3.11/site-packages/jellyfin_apiclient_python/api.py", line 52, in _http
    return self.client.request(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pi/.local/lib/python3.11/site-packages/jellyfin_apiclient_python/http.py", line 182, in request
    raise HTTPException(r.status_code, error)
jellyfin_apiclient_python.exceptions.HTTPException: (400, HTTPError('400 Client Error: Bad Request for url: http://media.agreiter.ch:8096/Videos/ActiveEncodings?DeviceId=8a4f396c-c955-44bf-8ef9-2cafe5e56bfd'))
2025-12-12 10:58:16,246 [    INFO] mpv: cplayer: 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions