mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.04k stars 2.88k forks source link

Can't seek byterange MP4 HLS stream #13211

Open nihaals opened 9 months ago

nihaals commented 9 months ago

Important Information

Provide following Information:

Reproduction steps

Try to reproduce your issue with --no-config first. If it isn't reproducible with --no-config try to first find out which option or script causes your issue.

Describe the reproduction steps as precise as possible. It's very likely that the bug you experience wasn't reproduced by the developer because the workflow differs from your own.

  1. Run mpv --no-config "https://framatube.org/static/streaming-playlists/hls/66fcff64-d8f9-49c1-8deb-011b115786de/73451ad8-d30e-4beb-aa92-3dba23ba07c8-720.m3u8"
  2. Notice skipping ahead to cached parts of the video works fine
  3. Skip to a part of the video that isn't cached
  4. Notice MPV freezes
  5. Notice the errors (shown below)
  6. Notice MPV crashes

Expected behavior

Video plays

Actual behavior

Video freezes and errors are logged:

[ffmpeg] NULL: Invalid NAL unit size (-20372128 > 35).
[ffmpeg] NULL: missing picture in access unit with size 39

MPV then crashes

Log file

mpv.log

Sample files

https://framatube.org/static/streaming-playlists/hls/66fcff64-d8f9-49c1-8deb-011b115786de/73451ad8-d30e-4beb-aa92-3dba23ba07c8-720.m3u8

Extra context

The example video is from #10029 as I'm not able to share the video I found the issue with, but it doesn't seem to be a duplicate of that issue. Based on experiments, this seems to only happen with playlists that use byte ranges on a single MP4 file. This might be caused by the boundaries not being in ideal places but I don't know much about how MP4 files work. VLC can play these streams as expected but prints errors like mp4: Fragment sequence discontinuity detected 677 != 0. It looks like VLC might download the previous chunk to get the data it needs to play the actual timestamp skipped to but I'm unsure.

llyyr commented 9 months ago

This is a feature request for ffmpeg. The same issue can be reproduced with ffplay where it'll try to download all the segments sequentially even if you seek way ahead of the current pts but still fail to continue anyway.

  1. Notice MPV crashes

This shouldn't and doesn't happen, in my case mpv and ffplay continuously download the file until they reach the end but the playback never resumes. Looking at the logs, it seems to be the case for you too.

[  51.911][v][lavf] EOF reached.
[  51.911][v][vf] filter input EOF
[  51.911][v][vf] filter output EOF
[  51.911][v][cplayer] video EOF reached
[  51.911][d][cplayer] video EOF (status=4)
[  51.911][v][af] filter input EOF
[  51.911][v][af] filter output EOF
[  51.911][v][cplayer] audio filter EOF
[  51.911][d][cplayer] video EOF (status=4)
[  51.911][v][cplayer] audio ready (and EOF)
[  51.911][d][cplayer] video EOF (status=4)
[  51.911][v][cplayer] starting audio playback
[  51.911][v][cplayer] audio draining
[  51.911][v][cplayer] playback restart complete @ -9223372036854775808.000000, audio=draining, video=eof
[  51.911][v][cplayer] audio EOF reached
[  51.911][d][cplayer] video EOF (status=4)
[  51.911][v][cplayer] EOF code: 1  

mpv reaches EOF so it exits, that's not a crash.

stonerl commented 4 months ago

Quick question. Has this been reported upstream?

I searched their bug tracker but haven't found a ticket that resembles this one.

nihaals commented 3 months ago

I haven't had a chance to so there might not be a ffmpeg issue yet.

BlakeB415 commented 1 month ago

It's an open defect with fmp4 handling. https://trac.ffmpeg.org/ticket/7359 https://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/261343.html There's a patch from 2020 but it hasn't been merged.

llyyr commented 1 month ago

Ping the patch or resubmit it to the ML