kidox
kidox

Reputation: 61

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

Upvotes: 1

Views: 3509

Answers (3)

Juan Trejos
Juan Trejos

Reputation: 111

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

Upvotes: 1

Pablo H
Pablo H

Reputation: 659

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

Upvotes: 1

mecaf
mecaf

Reputation: 85

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.

Upvotes: 1

Related Questions