Ffmpeg seeking in HLS m3u8 video

I'm having problem seeking in m3u8 hls video.
The m3u8 has 9-10 sec .ts fragments, with #EXTINF:<time>, before each fragment.

The entire video is 5 hours long and I'm trying to get clip from 3:10:00 to 3:45:00 like this:

ffmpeg -ss 3:10:00 -i 'http://example.com/v/vod.m3u8' -t 0:35:00 -c:v copy -bsf:a aac_adtstoasc out.mp4

When I execute that, it just waits forever. I tried both on Windows and Linux with the latest and older version of FFmpeg. I waited for like an hour yesterday and it didn't do anything. Log:

Input #0, hls,applehttp, from 'http://example.com/v/vod.m3u8':
  Duration: 05:25:27.08, start: 60.000000, bitrate: 0 kb/s
  Program 0
      variant_bitrate : 0
    Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 159 kb/s
    Stream #0:1: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:2: Data: timed_id3 (ID3  / 0x20334449)
Output #0, mp4, to 'out.mp4':
    encoder         : Lavf57.41.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=2-31, 30 fps, 30 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s
      encoder         : Lavc57.48.101 aac
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help

And it stays like this forever.

How can I seek to 3h10m without having to download the entire 5h25m?
-ss doesn't seem to do much

Is it supposed to go so slow or is the m3u8 corrupted? It looks like this inside:



And it has 12x #EXT-X-DISCONTINUITY, every ~174 parts.

When I use VLC or any other player to open the m3u8 directly I can seek without problem and it's instant. FFmpeg doesn't seem to use the same method of seeking, or it's broken.

To see what I mean, try seeking on this m3u8:


and try fast-seeking (-ss before input) to 2:30:00 and exporting 1 frame with frames:v 1 out.jpg

This question and all comments follow the "Attribution Required."

All Answers

Answers Loading...
Leave a Reply
You must be logged in to post a answer.
About the author