I am partially downloading a video file, sequentially.
What I've managed to achieve is for FFmpeg to encode the file as it is being downloaded if the download is faster than encoding. I cannot guarantee that the download will always be faster than encoding.
When download becomes slower than encoding I get this error, and ffmpeg exists:
[matroska,webm @ 0x1248040d0] File ended prematurely
What I am hoping to achieve is for FFmpeg to wait/hang until new bits are added to the input file, and continue with encoding when it has enough of bits for a new segment until file is complete.
I am using this command to generate hls stream:
ffmpeg -y \
-i ./appdata/input/Sintel.mkv \
-preset fast \
-c:a aac \
-b:a 192k \
-ac 2 \
-c:v libx264 \
-b:v 1024k \
-profile:v high \
-level 4.1 \
-crf 34 \
-pix_fmt yuv420p \
-threads 0 \
-f hls \
-hls_list_size 0 \
-hls_time 10 \
-hls_playlist_type event \
-hls_flags independent_segments+append_list \
-master_pl_name "livestream.m3u8" \
Can FFmpeg monitor and process the input as new bits are added to the input file?
Best solution I got so far was is to use segments and segments list from this answer: Resuming a partially-completed encode with FFmpeg
And couple it with some programming to keep retrying in the loop until the input file is complete, however, that feels like a bad solution that I would love to avoid.