Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Live streaming HLS via ffmpeg, How to force client to start playing from the beginning? From 1st segment

Is there a way, maybe via an ffmpeg option or flag, to force the client player to always start the playlist from the beginning when live streaming rather than the real time mid-stream?

Say the user comes in 1mn after the stream has started, rather than starting to watch at 1mn the player would start at the beginning of the video so minute zero.

Here is my ffmpeg command:

ffmpeg -f "screen capture" -s 1280x720 -r 30 -i :0.0+nomouse -f alsa -ac 2 -i pulse -async 30 -vcodec libx264 -pix_fmt yuv420p -acodec libfdk_aac -ar 44100 -b:a 64k -threads 0 -s 640x360 -f hls -g 1 -hls_time 1 -hls_list_size 1 -hls_allow_cache 0 /hls/#{@stream_name}/index.m3u8

Thanks!

like image 477
vedeojunky Avatar asked Mar 11 '15 07:03

vedeojunky


1 Answers

Use -hls_list_size 0 to keep all segments in the playlist. Using a value greater than 0 will cause the playlist to use a sliding window of hls_list_size length.

Also of note, using -hls_time 1 will greatly increase your playlist file size. The Apple recommended value is 6 seconds so you should try to increase it to a multiple of your desired keyframe interval.

like image 156
aergistal Avatar answered Nov 12 '22 14:11

aergistal