jellyfin / jellyfin-mpv-shim

MPV Cast Client for Jellyfin
Other
1.5k stars 88 forks source link

Unable to play media files with mpv v0.38.0 #381

Closed jessienab closed 2 months ago

jessienab commented 2 months ago

Describe the bug When attempting to play any media file with jellyfin-mpv-shim, after upgrading mpv to v0.38.0, this error message appears:

Invalid value for mpv parameter', -4

Downgrading mpv to v0.37.0 gets rid of the problem when using jellyfin-mpv-shim.

To Reproduce Steps to reproduce the behavior:

  1. Refresh Arch Linux Repos (pacman -Syy)
  2. Install the mpv 1:0.38.0-2 package
  3. Run jellyfin-mpv-shim, connect to server, play media.

Expected behavior The video (assuming a normal common video format) should begin playing without any issues

Screenshots N/A

Desktop (please complete the following information):

Error Messages log.txt

Tests done on a clean connection to the server, with no existing configuration files present in the .config folder.

2024-04-21 15:10:44,373 [   DEBUG] urllib3.connectionpool: https://example.com:443 "GET /jellyfin/system/info HTTP/1.1" 200 None
2024-04-21 15:10:44,376 [   DEBUG] JELLYFIN.jellyfin_apiclient_python.credentials: credentialsupdated
2024-04-21 15:10:44,377 [   DEBUG] JELLYFIN.jellyfin_apiclient_python.connection_manager: resolving connect with result: {'Servers': "[{'address': 'https://example.com/jellyfin', 'Name': 'seqrver', 'Id': '96f35713cc3740d2b22b57e328642297', 'DateLastAccessed': '2024-04-21T15:10:44Z', 'UserId': '1bc09c33dd3f46d4b669951c8170cfb0', 'AccessToken': 'REDACTED', 'Users': [{'Id': '1bc09c33dd3f46d4b669951c8170cfb0', 'IsSignedInOffline': True}], 'uuid': '5ce9937b-ada4-49ad-ae51-883fc4329ecf', 'username': 'sunnn', 'connected': True}]", 'State': 3}
2024-04-21 15:10:44,377 [    INFO] JELLYFIN.jellyfin_apiclient_python.client: User is authenticated.
2024-04-21 15:10:44,377 [   DEBUG] urllib3.util.retry: Converted retries value: 3 -> 'Retry(total=3, connect=None, read=None, redirect=None, status=None)'
2024-04-21 15:10:44,377 [   DEBUG] urllib3.util.retry: Converted retries value: 3 -> 'Retry(total=3, connect=None, read=None, redirect=None, status=None)'
2024-04-21 15:10:44,378 [    INFO] JELLYFIN.jellyfin_apiclient_python.ws_client: Websocket url: wss://example.com/jellyfin/socket?api_key=REDACTEDREDACTED&device_id=38ca1fc8-32d5-4a7c-9947-82d8e7ae3357
2024-04-21 15:10:44,380 [   DEBUG] urllib3.connectionpool: Starting new HTTPS connection (1): example.com:443
2024-04-21 15:10:44,433 [    INFO] websocket: Websocket connected
2024-04-21 15:10:44,433 [    INFO] JELLYFIN.jellyfin_apiclient_python.ws_client: --->[ websocket ]
2024-04-21 15:10:44,434 [   DEBUG] event_handler: Unhandled Event WebSocketConnect: None
2024-04-21 15:10:44,438 [   DEBUG] urllib3.connectionpool: https://example.com:443 "POST /jellyfin/Sessions/Capabilities/Full HTTP/1.1" 204 0
2024-04-21 15:10:44,442 [   DEBUG] JELLYFIN.jellyfin_apiclient_python.ws_client: ForceKeepAlive received from server.
2024-04-21 15:10:44,450 [   DEBUG] JELLYFIN.jellyfin_apiclient_python.ws_client: KeepAlive received from server.
2024-04-21 15:10:44,454 [   DEBUG] urllib3.connectionpool: https://example.com:443 "GET /jellyfin/Sessions?ControllableByUserId=1bc09c33dd3f46d4b669951c8170cfb0 HTTP/1.1" 200 None
2024-04-21 15:11:04,434 [   DEBUG] websocket: Sending ping
2024-04-21 15:11:14,436 [   DEBUG] websocket: Sending ping
2024-04-21 15:11:14,444 [   DEBUG] JELLYFIN.jellyfin_apiclient_python.ws_client: KeepAlive received from server.
2024-04-21 15:11:21,401 [   DEBUG] event_handler: Unhandled Event UserDataChanged: {'UserId': '1bc09c33dd3f46d4b669951c8170cfb0', 'UserDataList': [{'PlaybackPositionTicks': 0, 'PlayCount': 1, 'IsFavorite': False, 'LastPlayedDate': '2024-04-21T19:11:20.6705775Z', 'Played': False, 'Key': '0733e1c5-c9ac-4603-5e7b-a4b363da6630', 'ItemId': '0733e1c5c9ac46035e7ba4b363da6630'}, {'UnplayedItemCount': 1, 'PlaybackPositionTicks': 0, 'PlayCount': 0, 'IsFavorite': False, 'Played': False, 'Key': 'a0979a65-0127-92ed-1f73-652749fefd41', 'ItemId': 'a0979a65012792ed1f73652749fefd41'}], 'ServerId': '96f35713cc3740d2b22b57e328642297'}
2024-04-21 15:11:24,437 [   DEBUG] websocket: Sending ping
2024-04-21 15:11:30,597 [   DEBUG] event_handler: Unhandled Event UserDataChanged: {'UserId': '1bc09c33dd3f46d4b669951c8170cfb0', 'UserDataList': [{'PlaybackPositionTicks': 0, 'PlayCount': 2, 'IsFavorite': False, 'LastPlayedDate': '2024-04-21T19:11:30.0572887Z', 'Played': False, 'Key': '9bfba675-26bf-f931-87a6-937747fec3b1', 'ItemId': '9bfba67526bff93187a6937747fec3b1'}, {'UnplayedItemCount': 1, 'PlaybackPositionTicks': 0, 'PlayCount': 0, 'IsFavorite': False, 'Played': False, 'Key': 'eb7d2694-a705-c98d-0bcc-d1dd46d819b8', 'ItemId': 'eb7d2694a705c98d0bccd1dd46d819b8'}], 'ServerId': '96f35713cc3740d2b22b57e328642297'}
2024-04-21 15:11:34,438 [   DEBUG] websocket: Sending ping
2024-04-21 15:11:41,165 [   DEBUG] event_handler: Handled Event Play: {'ItemIds': ['0733e1c5c9ac46035e7ba4b363da6630'], 'PlayCommand': 'PlayNow', 'ControllingUserId': '1bc09c33dd3f46d4b669951c8170cfb0', 'ServerId': '96f35713cc3740d2b22b57e328642297'}
2024-04-21 15:11:41,241 [   DEBUG] urllib3.connectionpool: https://example.com:443 "GET /jellyfin/Users/1bc09c33dd3f46d4b669951c8170cfb0/Items/0733e1c5c9ac46035e7ba4b363da6630 HTTP/1.1" 200 None
2024-04-21 15:11:41,261 [   DEBUG] event_handler: EventHandler::playMedia <jellyfin_mpv_shim.media.Media object at 0x76a588f93d90>
2024-04-21 15:11:41,261 [   DEBUG] media: Bandwidth: local=True, bitrate=None, force=False
2024-04-21 15:11:41,275 [   DEBUG] urllib3.connectionpool: https://example.com:443 "POST /jellyfin/Items/0733e1c5c9ac46035e7ba4b363da6630/PlaybackInfo HTTP/1.1" 200 None
2024-04-21 15:11:41,277 [   DEBUG] media: Using direct url.
2024-04-21 15:11:41,277 [   DEBUG] media: Media Decision: {'Protocol': 'File', 'Id': '0733e1c5c9ac46035e7ba4b363da6630', 'Path': 'Testing a Dell Precision 3630 (2019) + my spicy thoughts on Windows 11 - [1280x720] [6R0L51FYqgc].mkv', 'Type': 'Default', 'Container': 'mkv', 'Size': 385587360, 'Name': '20240421 - Testing a Dell Precision 3630 (2019) + my spicy thoughts on Windows 11 - [1280x720] [6R0L51FYqgc]', 'IsRemote': False, 'ETag': '424d522a854093ec8a04ccbc8373f783', 'RunTimeTicks': 16757080064, 'ReadAtNativeFramerate': False, 'IgnoreDts': False, 'IgnoreIndex': False, 'GenPtsInput': False, 'SupportsTranscoding': True, 'SupportsDirectStream': True, 'SupportsDirectPlay': True, 'IsInfiniteStream': False, 'RequiresOpening': False, 'RequiresClosing': False, 'RequiresLooping': False, 'SupportsProbing': True, 'VideoType': 'VideoFile', 'MediaStreams': [{'Codec': 'h264', 'ColorSpace': 'bt709', 'ColorTransfer': 'bt709', 'ColorPrimaries': 'bt709', 'TimeBase': '1/1000', 'VideoRange': 'SDR', 'VideoRangeType': 'SDR', 'DisplayTitle': '720p H264 SDR', 'NalLengthSize': '4', 'IsInterlaced': False, 'IsAVC': True, 'BitRate': 1840833, 'BitDepth': 8, 'RefFrames': 1, 'IsDefault': True, 'IsForced': False, 'Height': 720, 'Width': 1280, 'AverageFrameRate': 29.97003, 'RealFrameRate': 29.97003, 'Profile': 'High', 'Type': 'Video', 'AspectRatio': '16:9', 'Index': 0, 'IsExternal': False, 'IsTextSubtitleStream': False, 'SupportsExternalStream': False, 'PixelFormat': 'yuv420p', 'Level': 31}, {'Codec': 'opus', 'Language': 'eng', 'TimeBase': '1/1000', 'DisplayTitle': 'English - OPUS - Stereo - Default', 'IsInterlaced': False, 'ChannelLayout': 'stereo', 'Channels': 2, 'SampleRate': 48000, 'IsDefault': True, 'IsForced': False, 'Type': 'Audio', 'Index': 1, 'IsExternal': False, 'IsTextSubtitleStream': False, 'SupportsExternalStream': False, 'Level': 0}], 'MediaAttachments': [{'CodecTag': '[0][0][0][0]', 'Index': 2, 'FileName': 'info.json', 'MimeType': 'application/json', 'DeliveryUrl': '/Videos/0733e1c5-c9ac-4603-5e7b-a4b363da6630/0733e1c5c9ac46035e7ba4b363da6630/Attachments/2'}], 'Formats': [], 'Bitrate': 1840833, 'RequiredHttpHeaders': {}, 'DefaultAudioStreamIndex': 1, 'DefaultSubtitleStreamIndex': -1}
2024-04-21 15:11:41,279 [   DEBUG] mpv: cplayer: Run command: script-message, flags=64, args=[args="shim-trickplay-clear"]

2024-04-21 15:11:41,280 [   DEBUG] player: Playing: https://example.com/jellyfin/Videos/0733e1c5c9ac46035e7ba4b363da6630/stream?static=true&MediaSourceId=0733e1c5c9ac46035e7ba4b363da6630&api_key=REDACTEDREDACTED
2024-04-21 15:11:41,282 [   ERROR] websocket: error from callback <function WSClient.run.<locals>.<lambda> at 0x76a588f5d9e0>: ('Invalid value for mpv parameter', -4, (<MpvHandle object at 0x76a5a3078950>, <mpv.LP_MpvNode object at 0x76a588f0fbf0>, <mpv.LP_MpvNode object at 0x76a588f0e690>))
2024-04-21 15:11:41,282 [   ERROR] JELLYFIN.jellyfin_apiclient_python.ws_client: ('Invalid value for mpv parameter', -4, (<MpvHandle object at 0x76a5a3078950>, <mpv.LP_MpvNode object at 0x76a588f0fbf0>, <mpv.LP_MpvNode object at 0x76a588f0e690>))
2024-04-21 15:11:41,283 [    INFO] mpv: thumbfast: Clearing trickplay.

2024-04-21 15:11:41,284 [   DEBUG] event_handler: Unhandled Event WebSocketError: ('Invalid value for mpv parameter', -4, (<MpvHandle object at 0x76a5a3078950>, <mpv.LP_MpvNode object at 0x76a588f0fbf0>, <mpv.LP_MpvNode object at 0x76a588f0e690>))
2024-04-21 15:11:41,285 [   DEBUG] mpv: cplayer: Run command: script-message, flags=64, args=[args="thumbfast-info", args="{\"width\":0,\"height\":0,\"available\":false,\"overlay_id\":46,\"disabled\":true}"]

2024-04-21 15:11:41,286 [   ERROR] mpv: main: Command loadfile: argument index can't be parsed: option requires parameter.

2024-04-21 15:11:44,440 [   DEBUG] websocket: Sending ping
2024-04-21 15:11:44,445 [   DEBUG] JELLYFIN.jellyfin_apiclient_python.ws_client: KeepAlive received from server.
2024-04-21 15:11:44,736 [    INFO] root: Stopping services...
2024-04-21 15:11:44,751 [    INFO] JELLYFIN.jellyfin_apiclient_python.ws_client: ---<[ websocket ]
2024-04-21 15:11:44,752 [    INFO] Jellyfin.jellyfin_apiclient_python.http: --<[ session/130453339251536 ]

(Server log has been modified with changed server URL and server name)

rramiachraf commented 2 months ago

The issue is related to mpv 0.38 adding an argument to the loadfile command, which breaks functionality for the library client python-mpv, the issue is already fixed by this commit https://github.com/jaseg/python-mpv/commit/d96eaf7e64f1063ae16f88abfaa14c2997b3291d, so simply upgrading this package to the latest version would fix this. As of now the package is not yet released on pip, which means, to upgrade it you need to build it from source, fortunately pip has a handy feature where we can provide a git repo instead of the package name directly.

pip install git+https://github.com/jaseg/python-mpv
jessienab commented 2 months ago

@rramiachraf Thank you for the info!! I will apply the fix myself per above, alternatively staying with mpv 0.37 until Arch for python-mpv 1.0.5-2 are moved from testing :)