Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDL error when trying to play MP4 DASH videos from YouTube with yt-dlp #11392

Closed
thermosflasche opened this issue Mar 1, 2023 · 18 comments · Fixed by #11398
Closed

EDL error when trying to play MP4 DASH videos from YouTube with yt-dlp #11392

thermosflasche opened this issue Mar 1, 2023 · 18 comments · Fixed by #11398

Comments

@thermosflasche
Copy link

  • mpv version
    0.35.1
  • Platform and Version
    Devuan GNU/Linux 5 (daedalus/ceres) x86_64
  • yt-dlp version
    Compiled from upstream (latest commit 5b28cef72db3b531680d89c121631c73ae05354f)
  • Source of the mpv binary
    Debian testing repository

Reproduction steps

  • Play a video from YouTube with a --ytdl-format parameter such that it opens as an edl:// URI; for instance, ba, and bv.

Expected behavior

  • mpv detects the source from yt-dlp and plays it

Actual behavior

  • mpv opens the stream but doesn't play it due to some EDL error

Log file

mpv -v -v --no-config --ytdl-format=ba https://www.youtube.com/watch?v=dQw4w9WgXcQ

https://0x0.st/Hzm8.txt

Note: I removed the "ip" parameter from the YouTube video URL for privacy. The complete URL, nonetheless, points to a valid media source.

I mentioned it happens with YouTube only because it only happened with that source, I wasn't able to find any other MP4 DASH sources as well, so I can't guarantee that it's a YouTube-only issue.

@Sophira
Copy link

Sophira commented Mar 1, 2023

This happens for me, too (using mpv 0.35.0 though), although in my case, when playing a video with both video and audio, the video plays but not the audio. My own log, using the same command as the creator of the issue, is at mpv-log.txt. (Since I'm only asking for audio in this case, it exits immediately rather than trying to play any video. I've removed my IP as well, though in a different manner, by replacing it with [REMOVED].)

This specifically occurs for me when using a version of yt-dlp at or after commit yt-dlp/yt-dlp@5038f6d7. Using a version of yt-dlp before that commit is fine.

It's worth noting that a similar error was reported in November 2022 in #10873, although that was the reverse situation - the audio played, but not the video - and it was a slightly different error (although still involving EDL).

@p-mackay
Copy link

p-mackay commented Mar 2, 2023

Having the same issue

  • mpv version
    0.35.1
  • Manjaro Linux rolling
  • yt-dlp master branch
    yt-dlp --version
    2023.02.17
  • Behavior: same as OP

log file

mpv -v -v --no-config --ytdl-format=ba https://www.youtube.com/watch?v=dIZdq-mo0bI

error1.txt

@mauricioquintela
Copy link

Same issue here, noticed it first with youtube videos having no audio but video working.

log file

mpv -v -v --no-config --ytdl-format="ba" 'https://www.youtube.com/watch?v=hqFoKHE95Eg'
error.txt

@christoph-heinrich
Copy link
Contributor

christoph-heinrich commented Mar 2, 2023

I've looked into this only a little bit so far, but as far as I can tell I happens because of this change in yt-dlp, and the following diff "fixes" it.

diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index f40579ad36..3ce9ff9c77 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -448,7 +448,7 @@ local function formats_to_edl(json, formats, use_all_formats)
             end
         end
 
-        local url = edl_track or track.url
+        local url = track.url
         local hdr = {"!new_stream", "!no_clip", "!no_chapters"}
         local skip = #tracks == 0
         local params = ""

FYI the latest released version of yt-dlp (2023.02.17) does not have that problem.

@garoto
Copy link
Contributor

garoto commented Mar 2, 2023

FYI the latest released version of yt-dlp (2023.02.17) does not have that problem.

Yes, yt-dlp commits were to mitigate some wide-spread, severe throttling from YT side that started happening about a week ago I guess.

Your patch seems to work fine(?) as far as I can test, but ytdl_hook.lua will still throw [ 2.271692] ytdl_hook: EDL doesn't support fragments without duration with MP4 DASH with anything that ISN'T format 22/18/17 (aka not dash).

Crazy that all it took was such a simple change. I was expecting, at least, the edl demuxer C needed to be adapted as well, lmao.

@Tallefer
Copy link

Tallefer commented Mar 3, 2023

Same-ish issue here.
Tried mpv 0.34.1 and 0.35.1 builds from https://non-gnu.uvt.nl/ on MX Linux 21
with both stable yt-dlp 2023.02.17 and nightly ytdl-patched 2023.03.01 - 2023.03.03
and yes, seems like using the stable build mostly solves the problem, but switching to nightly was necessary to fix something important, so it can backfire.
adding these lines from the console to help with discoverability, since currently almost no issues at mpv or at yt-dlp mention that directly (outside of attached logs)

EDL specifies no segments.'
EDL parsing failed.
Error in EDL.

because some videos load only the video track without audio and output that error only once (instead of two times as usual) this issue may or may not also be related: yt-dlp/yt-dlp#5592

@Pentaphon
Copy link

Yes, yt-dlp commits were to mitigate some wide-spread, severe throttling from YT side that started happening about a week ago I guess.

This is exactly what happened and the patch to fix that also broke mpv playback on videos streamed from Youtube with the patched yt-dlp.

@Trit34
Copy link

Trit34 commented Mar 4, 2023

I dont know if I’m doing things wrong, but I tried to copy the patched ytdl_hook.lua file to the ~/.config/mpv/scripts folder, but it does not work. Am I missing something?

@christoph-heinrich
Copy link
Contributor

christoph-heinrich commented Mar 4, 2023

I've answered Trit34's question in the PR, but for anyone else trying the same thing, you also have to use --ytdl=no to disable the builtin ytdl_hook.lua.

@candrapersada
Copy link

candrapersada commented Mar 4, 2023

but why mpv --ytdl=no --script-opts-append=ytdl_hook-ytdl_path="D:\ytdl-patched-red.exe" <Youtube URL> not working in Windows?

[ytdl_hook]
[ytdl_hook] youtube-dl failed: not found or not enough permissions

@CounterPillow
Copy link
Contributor

@candrapersada because your garbage ass OS is blocking the execution of ytdl-patched-red.exe thinking it's malware. Double-click it and you'll likely see Wangblows Defiler pop up.

@candrapersada
Copy link

candrapersada commented Mar 5, 2023

gambar

[ytdl_hook]
[ytdl_hook] stack traceback:
[ytdl_hook]     [C]: at 0x7ff677248440
[ytdl_hook] Lua error: D:/mpv/portable_config/scripts/ytdl_hook.lua:11: invalid escape sequence near '"D:'

@commrade-goad
Copy link

use double slash for the path ytdl_path = "D:\\ytdl-patched-red.exe"

@candrapersada
Copy link

use double slash for the path ytdl_path = "D:\\ytdl-patched-red.exe"

[ytdl_hook]
[ytdl_hook] youtube-dl failed: not found or not enough permissions

lunik1 added a commit to lunik1/nixpkgs that referenced this issue Mar 16, 2023
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

The ytdl_hook.lua supplied with the latest mpv release is incompatible
with the latest yt-dlp release, causing streaming some youtube formats
to fail. This applies an already-upstreamed fix.

Upstream issue: mpv-player/mpv#11392
Upstream patch: mpv-player/mpv#11398
@dinotheextinct
Copy link

dinotheextinct commented Mar 19, 2023

Why did this get closed? Where is the fix? I am using:
ytdlp: Available version: stable@2023.03.04, Current version: stable@2023.03.04
mpv 0.35.1+git.20230128.140ec21c Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
built on Feb 8 2023

And still have this issue: Sometimes video not opening at all, somtimes video stream opens without audio.

@christoph-heinrich
Copy link
Contributor

built on Feb 8 2023

The fix got merged on 04.03.2023 and your build is from 08.02.2023.

@dinotheextinct
Copy link

Alright thanks for the info.

@sequencerr
Copy link

sequencerr commented May 6, 2023

built on Feb 8 2023

The fix got merged on 04.03.2023 and your build is from 08.02.2023.

Only fixed with ytdl_hook.lua in %AppData%\mpv\scripts and --ytdl=no flag

[demux] Detected file format: Edit decision list
[demux] Stream is not seekable.
[demux] EDL specifies no segments.'
[demux] EDL parsing failed.
[demux] Error in EDL.

Logs:

[cplayer] Command line options: '--no-video' 'https://www.youtube.com/watch?v=IdXXK4hTtzk' '-v'
[cplayer] mpv 0.35.1 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
[cplayer]  built on Sun Jan 29 05:42:05 2023
[cplayer] FFmpeg library versions:
[cplayer]    libavutil       57.44.100
[cplayer]    libavcodec      59.58.100
[cplayer]    libavformat     59.36.100
[cplayer]    libswscale      6.8.112
[cplayer]    libavfilter     8.55.100
[cplayer]    libswresample   4.9.100
[cplayer] FFmpeg version: N-109691-gb95b2c849
[cplayer]
[cplayer] Configuration: meson configure build -Dprefix=/__w/mpv-winbuild-cmake/mpv-winbuild-cmake/build64/install/mingw -Dbuildtype=release -Doptimization=3
[cplayer] List of enabled features: av-channel-layout build-date cplayer cuda-hwaccel cuda-interop d3d-hwaccel d3d11 d3d9-hwaccel direct3d dos-paths dvdnav egl-angle egl-angle-win32 egl-helpers ffmpeg ffnvcodec gl gl-dxinterop gl-dxinterop-d3d9 gl-win32 glob glob-win32 gpl iconv javascript jpeg jpegxl lcms2 libarchive libass libavdevice libbluray libm libmpv-shared libplacebo libplacebo-next luajit manpage-build noexecstack openal pdf-build plain-gl rubberband rubberband-3 sdl2 sdl2-audio sdl2-gamepad sdl2-video shaderc spirv-cross stdatomic threads uchardet vapoursynth vector vulkan wasapi win32 win32-desktop win32-executable win32-internal-pthreads zimg zlib
[cplayer] Built with NDEBUG.
[cplayer] Setting option 'video' = 'no' (flags = 8)
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer] Waiting for scripts...
[osd/libass] libass API version: 0x1700000
[osd/libass] libass source: commit: 0.17.0-25-g9995c9741d3faf66a82f8ca90668ef681cf7b022
[osd/libass] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 6.0.0 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider directwrite (with GDI)
[osd/libass] Done.
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Done loading scripts.
[cplayer] Running hook: ytdl_hook/on_load
[ytdl_hook] ytdl:// hook
[cplayer] Set property: shared-script-properties -> 1
[ytdl_hook] not a ytdl:// url
[cplayer] Set property: shared-script-properties -> 1
[ffmpeg] Opening https://www.youtube.com/watch?v=IdXXK4hTtzk
[osd/libass] libass API version: 0x1700000
[osd/libass] libass source: commit: 0.17.0-25-g9995c9741d3faf66a82f8ca90668ef681cf7b022
[osd/libass] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 6.0.0 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider directwrite (with GDI)
[osd/libass] Done.
[ffmpeg] Mime-type: 'text/html; charset=utf-8'
[demux] Trying demuxers for level=normal.
[lavf] No format found, try lowering probescore or forcing the format.
[demux] Trying demuxers for level=unsafe.
[lavf] No format found, try lowering probescore or forcing the format.
[cplayer] Opening failed or was aborted: https://www.youtube.com/watch?v=IdXXK4hTtzk
[cplayer] Running hook: ytdl_hook/on_load_fail
[ytdl_hook] full hook
[ytdl_hook] Video disabled. Only using audio
[ytdl_hook] No youtube-dl found with path yt-dlp.exe in config directories
[ytdl_hook] Found youtube-dl with path yt-dlp.exe in PATH
[ytdl_hook] youtube-dl succeeded!
[cplayer] Set property: file-local-options/user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.115 Safari/537.36" -> 1
[ytdl_hook] format selection: youtube-dl (separate)
[cplayer] Set property: stream-open-filename="edl://!mp4_dash,init=%905%https://rr1---sn-gqn-8aje.googlevideo.com/videoplayback?expire=1683400168&ei=iFFWZPbPEJKkWMqLo-AF&ip=79.116.112.250&id=o-AFcbyrQunC6oTXr9N8XEwA5od41WEoujXKNb1nL-7FOu&itag=251&source=youtube&requiressl=yes&mh=Yk&mm=31%2C29&mn=sn-gqn-8aje%2Csn-h5qzened&ms=au%2Crdu&mv=m&mvi=1&pl=23&initcwndbps=1180000&spc=qEK7BxAw-9Xi-_6S_ae9cmxhaUXedWo&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=2765148&dur=176.021&lmt=1679911041778105&mt=1683378071&fvip=1&keepalive=yes&fexp=24007246&c=ANDROID&txp=6318224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgIXBXA3JO1jnAzcelJXLfugjpJR0iWLRluOURNkJQevsCIQCjZUVIwFrwvQb6sSTG0U5i08uzZhILD2-qt2C0iCzLAg%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgUxsLCM2Q7h5ThG_r2eoyRRedUndlotr6cwhGaqcq09QCIQDMNiAJ-gwJCJWCvOScb8LT9HBzhaJciGcj2j3_y6uvcQ%3D%3D&range=0-2765148;" -> 1
[cplayer] Set property: file-local-options/force-media-title="билборды - кома" -> 1
[cplayer] Set property: file-local-options/stream-lavf-o={} -> 1
[edl] Opening edl://!mp4_dash,init=%905%https://rr1---sn-gqn-8aje.googlevideo.com/videoplayback?expire=1683400168&ei=iFFWZPbPEJKkWMqLo-AF&ip=79.116.112.250&id=o-AFcbyrQunC6oTXr9N8XEwA5od41WEoujXKNb1nL-7FOu&itag=251&source=youtube&requiressl=yes&mh=Yk&mm=31%2C29&mn=sn-gqn-8aje%2Csn-h5qzened&ms=au%2Crdu&mv=m&mvi=1&pl=23&initcwndbps=1180000&spc=qEK7BxAw-9Xi-_6S_ae9cmxhaUXedWo&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=2765148&dur=176.021&lmt=1679911041778105&mt=1683378071&fvip=1&keepalive=yes&fexp=24007246&c=ANDROID&txp=6318224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgIXBXA3JO1jnAzcelJXLfugjpJR0iWLRluOURNkJQevsCIQCjZUVIwFrwvQb6sSTG0U5i08uzZhILD2-qt2C0iCzLAg%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgUxsLCM2Q7h5ThG_r2eoyRRedUndlotr6cwhGaqcq09QCIQDMNiAJ-gwJCJWCvOScb8LT9HBzhaJciGcj2j3_y6uvcQ%3D%3D&range=0-2765148;
[demux] Trying demuxers for level=request.
[demux] Detected file format: Edit decision list
[demux] Stream is not seekable.
[demux] EDL specifies no segments.'
[demux] EDL parsing failed.
[demux] Error in EDL.
[cplayer] Opening done: edl://!mp4_dash,init=%905%https://rr1---sn-gqn-8aje.googlevideo.com/videoplayback?expire=1683400168&ei=iFFWZPbPEJKkWMqLo-AF&ip=79.116.112.250&id=o-AFcbyrQunC6oTXr9N8XEwA5od41WEoujXKNb1nL-7FOu&itag=251&source=youtube&requiressl=yes&mh=Yk&mm=31%2C29&mn=sn-gqn-8aje%2Csn-h5qzened&ms=au%2Crdu&mv=m&mvi=1&pl=23&initcwndbps=1180000&spc=qEK7BxAw-9Xi-_6S_ae9cmxhaUXedWo&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=2765148&dur=176.021&lmt=1679911041778105&mt=1683378071&fvip=1&keepalive=yes&fexp=24007246&c=ANDROID&txp=6318224&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgIXBXA3JO1jnAzcelJXLfugjpJR0iWLRluOURNkJQevsCIQCjZUVIwFrwvQb6sSTG0U5i08uzZhILD2-qt2C0iCzLAg%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgUxsLCM2Q7h5ThG_r2eoyRRedUndlotr6cwhGaqcq09QCIQDMNiAJ-gwJCJWCvOScb8LT9HBzhaJciGcj2j3_y6uvcQ%3D%3D&range=0-2765148;
[cplayer] Running hook: ytdl_hook/on_preloaded
[cplayer] No video or audio streams selected.
[cplayer] finished playback, no audio or video data played (reason 4)
[cplayer]
[cplayer] Exiting... (Errors when loading file)
[cplayer] Set property: shared-script-properties -> 1```
</details>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.