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

Deutschewelle, Phoenix and 3 Sat do not work #3

Open
schaecsn opened this issue Feb 12, 2021 · 3 comments
Open

Deutschewelle, Phoenix and 3 Sat do not work #3

schaecsn opened this issue Feb 12, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@schaecsn
Copy link
Owner

Deutschewelle does not work. Phoenix and 3 Sat do no work most of the time.

WARNING: Failed to download m3u8 information: HTTP Error 403: Forbidden
ERROR: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

Root-cause unknown.

@schaecsn
Copy link
Owner Author

schaecsn commented Jul 17, 2022

I understand the root cause by now. Most videos are a single stream of video and audio but some videos have a separate audio stream. The latter is common when the ARD Mediathek web front-end provides the choice among standard audio and clear speech audio.

In the past, mediathek failed to play such videos. Commit adec25b from a few minutes ago plays now at least video.

Note: The youtube-dl fork https://github.com/yt-dlp/yt-dlp can merge in real-time such separate video and audio into one stream and pipe it to stdio / ffplay. By replacing

-  "best[width<=${MEDIATHEK_QUALITY}]/bestvideo[width<=${MEDIATHEK_QUALITY}]"
+  "best[width<=${MEDIATHEK_QUALITY}]/bestvideo[width<=${MEDIATHEK_QUALITY}]+bestaudio"

and

- youtube-dl
+ yt-dlp

such videos can be played in mediathek as well. At least in theory. Yt-dlp fails to sync audio and video of livestreams (such as the one from the ARD Mediathek) resulting in audio lagging a few seconds behind. For now, above patch is not applied.

@schaecsn schaecsn added the bug Something isn't working label Jul 17, 2022
@schaecsn
Copy link
Owner Author

such videos can be played in mediathek as well. At least in theory. Yt-dlp fails to sync audio and video of livestreams (such as the one from the ARD Mediathek) resulting in audio lagging a few seconds behind. For now, above patch is not applied.

I opened a bug against yt-dlp for the sync issue yt-dlp/yt-dlp#4433

@schaecsn
Copy link
Owner Author

yt-dl is basically invoking

ffmpeg -y  -i https://mcdn.wdr.de/wdr/wdrfs/weltweit/master-540p-1600.m3u8  -i https://mcdn.wdr.de/wdr/wdrfs/weltweit/master-audio2-128.m3u8 -c copy -map 0:0 -map 1:0 -f mpegts - |  ffplay -loglevel 8  -infbuf -

Here is the verbose output with noise filtered out

$ (ffmpeg -y -i https://mcdn.wdr.de/wdr/wdrfs/weltweit/master-540p-1600.m3u8  -i https://mcdn.wdr.de/wdr/wdrfs/weltweit/master-audio2-128.m3u8 -c copy -map 0:0 -map 1:0 -f mpegts - |  ffplay -loglevel 8  -infbuf -) 2>&1 | egrep  -v "Skip|Opening"
ffmpeg version 4.3.4-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, hls, from 'https://mcdn.wdr.de/wdr/wdrfs/weltweit/master-540p-1600.m3u8':
  Duration: N/A, start: 5490.880267, bitrate: N/A
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 960x540 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
    Metadata:
      variant_bitrate : 0
Input #1, hls, from 'https://mcdn.wdr.de/wdr/wdrfs/weltweit/master-audio2-128.m3u8':
  Duration: N/A, start: 5502.889600, bitrate: 115 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #1:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 115 kb/s
    Metadata:
      variant_bitrate : 0
      id3v2_priv.com.elementaltechnologies.timestamp.utc: 2022-08-14T17:44:28Z
      id3v2_priv.com.apple.streaming.transportStreamTimestamp: \x00\x00\x00\x00\x1d\x85\x11\xa0
Output #0, mpegts, to 'pipe:':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 960x540 [SAR 1:1 DAR 16:9], q=2-31, 50 fps, 50 tbr, 90k tbn, 90k tbc
     Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 115 kb/s
    Metadata:
      variant_bitrate : 0
      id3v2_priv.com.elementaltechnologies.timestamp.utc: 2022-08-14T17:44:28Z
      id3v2_priv.com.apple.streaming.transportStreamTimestamp: \x00\x00\x00\x00\x1d\x85\x11\xa0
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[hls @ 0x564283356400] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[hls @ 0x56428362fe80] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)

Apparently, the start timestamps differ, here by 12 seconds

Input #0, hls, from 'https://mcdn.wdr.de/wdr/wdrfs/weltweit/master-540p-1600.m3u8':
  Duration: N/A, start: 5490.880267, bitrate: N/A
Input #1, hls, from 'https://mcdn.wdr.de/wdr/wdrfs/weltweit/master-audio2-128.m3u8':
  Duration: N/A, start: 5502.889600, bitrate: 115 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)

ffmpeg blindly merges two streams. I can't find the proper options to sync them. ffmpeg sync_file_id does not do the trick, e.g. replacing -map 0:0 with -map 0:0,1 resulted in a slightly modified stream mapping, but the video was still not in sync.

Stream mapping:
  Stream #0:0 -> #0:0 [sync #1:0] (copy)
  Stream #1:0 -> #0:1 (copy)

Inserting -ss 12 helps, but the timestamp difference is a running target and every invocation of yt-dl / ffmpeg comes with a new value.

schaecsn added a commit that referenced this issue Mar 30, 2023
ARD mediathek used to stream video together with audio. Since a few months,
it's now streaming audio and video separately. youtube-dl can not provide two
streams. The youtube-dl fork yt-dlp can, but fails to sync the two streams.
Ffplay is then blindly merging the two streams resulting in audio lagging a few
seconds behind. See bug report

#3

New approach: video stream downloading and rendering is now performed by mpv.

On the plus side, mpv supports gpu acceleration while ffplay did not.

Signed-off-by: Stefan Schaeckeler <schaecsn@gmx.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant