Sunday, April 30, 2023

mpv: backport mp4 dash fix; unbreaks some youtube videos

recently i'm having some issues with various youtube videos. The
video is showed without audio and mpv complains that

% mpv 'https://www.youtube.com/watch?v=TNRCvG9YtYI'
[ytdl_hook] EDL doesn't support fragmentswithout duration with MP4 DASH
EDL specifies no segments.'
EDL parsing failed.
Error in EDL.

this seems to have been fixed upstream in mpv:

https://github.com/mpv-player/mpv/commit/94c189dae76ba280d9883b16346c3dfb9720687e

and since it's a one-line patch I thought we could backport it.

With this it still prints some red lines, but then audio works again.

thoughts/ok?

Index: Makefile
===================================================================
RCS file: /home/cvs/ports/multimedia/mpv/Makefile,v
retrieving revision 1.94
diff -u -p -r1.94 Makefile
--- Makefile 24 Apr 2023 11:41:23 -0000 1.94
+++ Makefile 30 Apr 2023 22:53:14 -0000
@@ -3,7 +3,7 @@ COMMENT = movie player based on MPlayer
GH_ACCOUNT = mpv-player
GH_PROJECT = mpv
GH_TAGNAME = v0.35.1
-REVISION = 2
+REVISION = 3

SHARED_LIBS += mpv 1.0 # 2.0

Index: patches/patch-player_lua_ytdl_hook_lua
===================================================================
RCS file: patches/patch-player_lua_ytdl_hook_lua
diff -N patches/patch-player_lua_ytdl_hook_lua
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-player_lua_ytdl_hook_lua 30 Apr 2023 22:45:43 -0000
@@ -0,0 +1,14 @@
+backport of https://github.com/mpv-player/mpv/commit/94c189dae7
+
+Index: player/lua/ytdl_hook.lua
+--- player/lua/ytdl_hook.lua.orig
++++ player/lua/ytdl_hook.lua
+@@ -295,7 +295,7 @@ local function edl_track_joined(fragments, protocol, i
+ local args = ""
+
+ -- assume MP4 DASH initialization segment
+- if not fragments[1].duration then
++ if not fragments[1].duration and #fragments > 1 then
+ msg.debug("Using init segment")
+ args = args .. ",init=" .. edl_escape(join_url(base, fragments[1]))
+ offset = 2

No comments:

Post a Comment