'How to continue saving to an existing m3u8 playlist using ffmpeg

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



Solution 1:[1]

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.

Solution 2:[2]

There is an option append_list, whose explanation reads: "append the new segments into old hls segment list". It might work for you.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mecaf
Solution 2 Pablo H