[FFmpeg-user] why doesn't fast seeking work in live hls

Louis Letourneau lletourn49 at gmail.com
Sat May 20 00:49:07 EEST 2017

Just a question before I start diving in the code, why doesn't fast
seeking work on live hls feeds/streams/files?

If you create a dummy video:
mkdir -p a;ffmpeg -y -s 640x480 -f rawvideo -pix_fmt rgb24 -r 25 -i
/dev/zero -vf "drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeMono.ttf:
text=%{n}: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1:
boxcolor=0x000000FF" -an -vcodec libx264 -preset medium -tune
stillimage -crf 24 -pix_fmt yuv420p -shortest -force_key_frames
"expr:gte(t,n_forced*5)" -bf 0 -hls_time 5 -hls_list_size 0 -hls_wrap
0 -hls_allow_cache 1 -hls_segment_filename "a/a_%04d.ts" -t 9999

let it encode
and in another terminal try to seek (once the encoding passed the time
you want to seek to)

ffmpeg -v info -ss 00:00:10 -y -live_start_index 0 -i a/a.m3u8 -f
image2 -vframes 1 a.png ; feh a.png

You'll get in the logs
a/a.m3u8: could not seek to position 11.400

and then ffmpeg will decode all frames until the asked frame.

If you quit the encoder and seek again, it fast seeks immediately
(jumps to the right segment and decodes te right frame). It doesn't
need to fo through all the segments.

My question is, if the segments (.ts) are already there and the
manifest, m3u8 already shows that they are there, why doesn't fast
seeking work?


More information about the ffmpeg-user mailing list