Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg HTTP LIVE STREAMING remove old segments

Hello i Have a Live HTTP stream input for ffmpeg i want to create HLS streaming im using ffmpeg to do this

ffmpeg -i http://127.0.0.1:4242/bysid/7275 -map 0 -codec:v libx264 -codec:a copy -f ssegment -segment_list playlist.m3u8 -segment_list_type hls -segment_list_size 10 -segment_list_flags +live -segment_time 10 out%03d.ts

i works fine i just want to delete the old segmens that are not shown in playlist.m3u8

segment_list_size 10

this will keep the last 10 in the playlist file i want to keep only these files on hard disk

like image 764
k961 Avatar asked Dec 01 '14 11:12

k961


2 Answers

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

like image 142
Bent Olsen Avatar answered Sep 17 '22 06:09

Bent Olsen


USE

-segment_wrap 10

for wrap and rewrite segment files

like image 28
Andrew Zolotarev Avatar answered Sep 19 '22 06:09

Andrew Zolotarev