0

I'm serving an HLS stream with the following ffmpeg command:

ffmpeg -f flv -i rtmp://127.0.0.1/live -crf 22 -ar 44100 -ac 2 -fps_mode passthrough -force_key_frames expr:gte(t,n_forced*2) -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -c:v libx264 -filter:v:0 scale=1280:720 -maxrate:v:0 3000k -c:a aac -b:a:0 160k -c:v libx264 -filter:v:1 scale=854:480 -maxrate:v:1 2000k -c:a aac -b:a:1 160k -c:v libx264 -filter:v:2 scale=640:360 -maxrate:v:2 1000k -c:a aac -b:a:2 128k -var_stream_map "v:0,a:0,name:720p v:1,a:1,name:480p v:2,a:2,name:360p" -preset veryfast -hls_list_size 30 -threads 0 -f hls -hls_time 2 -master_pl_name master.m3u8 -y %v.m3u8

The playlist is limited to 30 segments of 2 second duration, 60 seconds total. I'm using hls.js with low latency enabled for html video playback.

I'd like to make the stream have up to 12 hours of duration, which is 720x longer than it currently is. Is there a way to do this without creating enormous playlists? If I adjusted my command to just have a higher list size that would make the user have to constantly fetch ~500kb m3u8 files.

I figured if we know the overall duration and the segment duration then we can make a pretty accurate guess what # segment to serve if the user rewinds 6 hrs into a 12 hr stream...

I assume there's something in the HLS spec that allows for very long/infinite duration streams. Is there? If so how do I implement it?

1
  • If you want a limited no. of segments, add -hls_flags +delete_segments, this leads to a sliding window. If you want users to be able to rewind, then you have to keep all segments listed - a player isn't going to guess or remember the entry and its filename for an earlier time.
    – Gyan
    Commented Feb 22 at 5:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.