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
    Metadata:
      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':
  Metadata:
    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
    Metadata:
      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:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#ID3-EQUIV-TDTG:2015-12-16T03:24:26
#EXT-X-PLAYLIST-TYPE:EVENT

#EXT-X-ELAPSED-SECS:0.0
#EXT-X-TOTAL-SECS:19527.08
#EXTINF:9.268,
index-00000-vdyz-0.ts
#EXTINF:10.000,
index-00001-AiD9-0.ts
(...)

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:

http://vod167-ttvnw.akamaized.net/07e4ac668a/lirik_7709808752_7709808752/chunked/index-dvr.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