ffmpeghttp-live-streamingrtmp

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

  • You have to add the flag "append_list" to the directive hls_flags:

    ffmpeg -i in.nut -hls_flags append_list out.m3u8
    

    for more information: https://ffmpeg.org/ffmpeg-formats.html