Opened 2 years ago

Last modified 2 years ago

#10054 new defect

ffmpeg/ffplay miscalculates $Time$, resulting in time from the future and 404 errors

Reported by: TheRadziu Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: dash
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by TheRadziu)

ffplay seems to grab wrong time, resulting in 404ing the segment fragments

ffplay -cenc_decryption_key "<cut, not relevant to the issue>" -i "https://live001.cda.pl/enc111/kapitanbomba/kapitanbomba.mpd" -loglevel debug
ffplay version 2022-11-03-git-5ccd4d3060-essentials_build-www.gyan.dev Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      57. 40.100 / 57. 40.100
  libavcodec     59. 51.101 / 59. 51.101
  libavformat    59. 34.101 / 59. 34.101
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 49.101 /  8. 49.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
Initialized direct3d renderer.
[NULL @ 000001885b2ef1c0] Opening 'https://live001.cda.pl/enc111/kapitanbomba/kapitanbomba.mpd' for reading
[https @ 000001885b2eca00] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[tcp @ 000001885b2efac0] Original list of addresses:
[tcp @ 000001885b2efac0] Address 46.102.100.197 port 443
[tcp @ 000001885b2efac0] Interleaved list of addresses:
[tcp @ 000001885b2efac0] Address 46.102.100.197 port 443
[tcp @ 000001885b2efac0] Starting connection attempt to 46.102.100.197 port 443
[tcp @ 000001885b2efac0] Successfully connected to 46.102.100.197 port 443
[https @ 000001885b2eca00] request: GET /enc111/kapitanbomba/kapitanbomba.mpd HTTP/1.1
User-Agent: Lavf/59.34.101
Accept: */*
Range: bytes=0-
Connection: close
Host: live001.cda.pl
Icy-MetaData: 1


[dash @ 000001885b2ef1c0] Format dash probed with size=2048 and score=100
[https @ 000001885b2eb640] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[tcp @ 0000018861faee80] Original list of addresses:
[tcp @ 0000018861faee80] Address 46.102.100.197 port 443
[tcp @ 0000018861faee80] Interleaved list of addresses:
[tcp @ 0000018861faee80] Address 46.102.100.197 port 443
[tcp @ 0000018861faee80] Starting connection attempt to 46.102.100.197 port 443
[tcp @ 0000018861faee80] Successfully connected to 46.102.100.197 port 443
[https @ 000001885b2eb640] request: GET /enc111/kapitanbomba/kapitanbomba.mpd HTTP/1.1
User-Agent: Lavf/59.34.101
Accept: */*
Connection: close
Host: live001.cda.pl
Icy-MetaData: 1


[AVIOContext @ 0000018862019d40] Statistics: 11719 bytes read, 0 seeks
[dash @ 000001885b2ef1c0] DASH request for url 'https://live001.cda.pl/enc111/kapitanbomba/vi_1080_1668835006.mp4', offset 0
[https @ 0000018861e82440] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[tcp @ 0000018861f17580] Original list of addresses:
[tcp @ 0000018861f17580] Address 46.102.100.197 port 443
[tcp @ 0000018861f17580] Interleaved list of addresses:
[tcp @ 0000018861f17580] Address 46.102.100.197 port 443
[tcp @ 0000018861f17580] Starting connection attempt to 46.102.100.197 port 443
[tcp @ 0000018861f17580] Successfully connected to 46.102.100.197 port 443
[https @ 0000018861e82440] request: GET /enc111/kapitanbomba/vi_1080_1668835006.mp4 HTTP/1.1
User-Agent: Lavf/59.34.101
Accept: */*
Connection: close
Host: live001.cda.pl
Icy-MetaData: 1


[dash @ 000001885b2ef1c0] Downloading an initialization section of size 1656
[AVIOContext @ 000001886216c840] Statistics: 1656 bytes read, 0 seeks
[dash @ 000001885b2ef1c0] DASH request for url 'https://live001.cda.pl/enc111/kapitanbomba/vs_1080_1668835006_2995380000.mp4', offset 0
[https @ 0000018861e82440] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[tcp @ 0000018861f17580] Original list of addresses:
[tcp @ 0000018861f17580] Address 46.102.100.197 port 443
[tcp @ 0000018861f17580] Interleaved list of addresses:
[tcp @ 0000018861f17580] Address 46.102.100.197 port 443
[tcp @ 0000018861f17580] Starting connection attempt to 46.102.100.197 port 443
[tcp @ 0000018861f17580] Successfully connected to 46.102.100.197 port 443
[https @ 0000018861e82440] request: GET /enc111/kapitanbomba/vs_1080_1668835006_2995380000.mp4 HTTP/1.1
User-Agent: Lavf/59.34.101
Accept: */*
Connection: close
Host: live001.cda.pl
Icy-MetaData: 1


[https @ 0000018861e82440] HTTP error 404 Not Foundq=    0B f=0/0
[dash @ 000001885b2ef1c0] Failed to open fragment of playlist
[https @ 000001885b2eb080] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[tcp @ 0000018861e82440] Original list of addresses:
[tcp @ 0000018861e82440] Address 46.102.100.197 port 443
[tcp @ 0000018861e82440] Interleaved list of addresses:
[tcp @ 0000018861e82440] Address 46.102.100.197 port 443
[tcp @ 0000018861e82440] Starting connection attempt to 46.102.100.197 port 443
[tcp @ 0000018861e82440] Successfully connected to 46.102.100.197 port 443
[https @ 000001885b2eb080] request: GET /enc111/kapitanbomba/kapitanbomba.mpd HTTP/1.1
User-Agent: Lavf/59.34.101
Accept: */*
Connection: close
Host: live001.cda.pl
Icy-MetaData: 1

Real time example, ffplay tries to play, which fails

https://live001.cda.pl/enc111/kapitanbomba/vs_1080_1668835006_2995380000.mp4

at the same time browser gets, which works just fine

https://live001.cda.pl/enc111/kapitanbomba/vs_1080_1668835006_2992140000.mp4


Other application handles that case just fine, so I think its something that ffplay has to improve.

Change History (10)

comment:1 by TheRadziu, 2 years ago

Description: modified (diff)

comment:2 by TheRadziu, 2 years ago

Through a proxy i've determined the difference between what works (other unnamed app and browsers) and doesn't (ffplay,ffmpeg,ffprobe) is constant value of "-720000". Meaning the ffplay tries to grab a segment that does not exist yet.
I've been modifying the suggestedPresentationDelay and the segment difference was still -720000. This leads me to conclusion the bug within ffmpeg/ffplay/ffprobe (all are affected) ignores MPD values instead of adjusting segments to it. My solution proposals are: find and fix the bug or allow user to specify the segment offset with additional argument.

Last edited 2 years ago by TheRadziu (previous) (diff)

comment:3 by TheRadziu, 2 years ago

Summary: ffplay 404 when trying to play dash streamffmpeg/ffplay miscalculates $Time$, resulting in time from the future and 404 errors

comment:4 by TheRadziu, 2 years ago

Component: ffplayavformat
Keywords: 404 added
Priority: normalcritical

comment:5 by Carl Eugen Hoyos, 2 years ago

Keywords: dash added; ffplay time offset 404 removed
Priority: criticalnormal

comment:6 by TheRadziu, 2 years ago

as for today ffmpeg still cant do proper math and bug is still alive and well.

comment:7 by Harisfog, 2 years ago

I have same issue. any update?

in reply to:  7 comment:8 by TheRadziu, 2 years ago

Replying to Harisfog:

I have same issue. any update?

Sadly, 4 weeks in and no traction or whatsoever, latest nightly build still has the bug.

in reply to:  7 ; comment:9 by TheRadziu, 2 years ago

Replying to Harisfog:

I have same issue. any update?

found decent file-less bug workaround for the time being, it should work for you too. It uses streamlink to grab segments and pipe them to ffmpeg. If stream is not DRM free you need to use forked version that adds DRM support. If you want to use it like ffplay then pipe it to ffplay or player of your choosing instead.

streamlink https://live002.cda.pl/enc117/2x2hd/2x2hd.mpd \
    best \
        --stream-segment-attempts 9999 \
        --ffmpeg-dkey "<REDACTED>" \
        -O|ffmpeg -nostdin -v fatal -hide_banner -nostats -re -i pipe:0 -c:v copy -c:a copy -f flv output"

This being said I consider it only workaround and still will wait for proper ffmpeg bugfix.

in reply to:  9 comment:10 by Harisfog, 2 years ago

Replying to TheRadziu:

Replying to Harisfog:

I have same issue. any update?

found decent file-less bug workaround for the time being, it should work for you too. It uses streamlink to grab segments and pipe them to ffmpeg. If stream is not DRM free you need to use forked version that adds DRM support. If you want to use it like ffplay then pipe it to ffplay or player of your choosing instead.

streamlink https://live002.cda.pl/enc117/2x2hd/2x2hd.mpd \
    best \
        --stream-segment-attempts 9999 \
        --ffmpeg-dkey "<REDACTED>" \
        -O|ffmpeg -nostdin -v fatal -hide_banner -nostats -re -i pipe:0 -c:v copy -c:a copy -f flv output"

This being said I consider it only workaround and still will wait for proper ffmpeg bugfix.

Thanks! This is helpful!

Note: See TracTickets for help on using tickets.