ffmpeg HTTP LIVE STREAMING remove old segments

USE

-segment_wrap 10

for wrap and rewrite segment files


You can use the recently added option to the HLS segmenter:

-hls_flags delete_segments

You will need to change your command to use the HLS segmenter rather than the stream segmenter by using -f hls instead of -f ssegment.

I've been using this option and it doesn't do exactly what you request, but rather it's implemented to be compliant with the HLS spec. See the ffmpeg documentation for more information: https://www.ffmpeg.org/ffmpeg-formats.html