mpv-player / mpv

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

m3u8 http live streaming (hls) playback not using all offered parts #7768

Closed DonRichie closed 4 years ago

DonRichie commented 4 years ago

Hello devs,

Behaviour

I wrote a small Flask application giving me a http server providing an m3u8 file. The idea of my program was to extend a given hls-URL with only 3 parts to one having all the parts, so I can play a live stream from the beginning. (You can find it here: https://paste.ricl.de/view/13bcbb96)

But when entering "mpv http://127.0.0.1:5000" only the last 3 parts of my file are playing.

My program gives the following text via http-GET using "application/x-mpegURL" as Mimetype:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:10
#EXTINF:10.00,
https://url/gear5_0.ts
#EXTINF:10.00,
https://url/gear5_1.ts
#EXTINF:10.00,
https://url/gear5_2.ts
#EXTINF:10.00,
https://url/gear5_3.ts
#EXTINF:10.00,
https://url/gear5_4.ts
[...]

(>800 parts in total)

Problem and Expected Behaviour

What led me to open an issue was that vlc is working as expected. If I open the URL via vlc the file starts playing from the first part and is dynamically searchable to any location up to the recent part. Since it is working in VLC I would assume my m3u8 files syntax is correct. I also guarantee that every single file I included in the m3u8 is downloadable.

Recommended Changes

ghost commented 4 years ago

That's a ffmpeg issue. You can pass the libavformat option from mpv to the ffmpeg HLS code by using --demuxer-lavf-o. FFmpeg doesn't provide enough API as that we could handle this well.

DonRichie commented 4 years ago

Thank you @wm4 for pointing me to the right direction

ghost commented 4 years ago

Of course it would be good if ffmpeg just added the required API bits so mpv could do this on its own.

adriel commented 1 year ago

That's a ffmpeg issue. You can pass the libavformat option from mpv to the ffmpeg HLS code by using --demuxer-lavf-o. FFmpeg doesn't provide enough API as that we could handle this well.

Are you able to elaborate on which libavformat option/s are needed? I'm not sure I get what I need to change. I'm facing the same issue as the OP.