I’m using nginx rtmp module to run a live streaming server that encodes a rtmp stream to a hls playlist. Is there a way to continue with an existing m3u8 file instead of creating a new playlist when I start ffmpeg? Streams can be disconnected sometimes and I want to keep a single playlist when a user resumes streaming.
Here’s ffmpeg command I’m running:
ffmpeg -i rtmp://localhost/live/$name -c:v libx264 -x264opts keyint=60:no-scenecut -s 720x1280 -r 30 -b:v 2000k -profile:v high -preset veryfast -c:a libfdk_aac -sws_flags bilinear -hls_list_size 0 /tmp/hls/$name_720p_.m3u8
3
Answers
Use
hls_cleanup off
directive which in this case it won’t remove old hls fragments and files, but you must use nginx rtmp hls instead of creating it with ffmpeg.There is an option
append_list
, whose explanation reads: "append the new segments into old hls segment list". It might work for you.You have to add the flag "append_list" to the directive hls_flags:
for more information:
https://ffmpeg.org/ffmpeg-formats.html