Been using ffmpeg for live streaming via HLS and playing through video.js. It works but there is a 20s delay between the time the stream starts to the time it actually starts playing.
Do you know why ffmpeg command below doesn't create segements that are 3 seconds like I have defined it in the command. The segments tend to be 9s or 10s. Can't get them to a shorter size
ffmpeg -f x11grab -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 -hls_time 1 -hls_list_size 1 -hls_allow_cache 0 /tmp/hls/#{@stream_name}/index.m3u8
Here is the m3u8 playlist file:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:9
#EXT-X-MEDIA-SEQUENCE:10
#EXTINF:8.333333,
index10.ts
#EXTINF:8.333333,
index11.ts
#EXTINF:8.333333,
index12.ts
#EXTINF:8.333333,
index13.ts
#EXTINF:2.366667,
index14.ts
#EXT-X-ENDLIST
You must also specify the keyframe interval. Also known as the GOP (group of pictures) size.
-g [time]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With