I'm trying to encode a HLS video in a restartable way so that it can be run on a preemptive VM. It's possible with the segment muxer in FFmpeg to create HLS files with mpegts that can be restarted (Using the -ss [time], -segment_start_number [num], -mpegts_copyts 1, segment_list_type csv and -segment_list_flags live flags and a bit of coding) but I cannot find equivalent "live" writing for the hls muxer specifically.
Either I need a solution that allows for writing fmp4 fragments using the segment muxer or live writing for the hls muxer.
It is possible to accomplish this via
-hls_playlist_type eventand-hls_flags append_list. For example:The generated
init.mp4will always be (nearly) identical (differs by a few bytes but decodes the same), regardless of start point, so only the last copy needs to be kept. The actualm3u8can be generated using code at the end.