[FFmpeg-user] How to progressively save a file? -movflags faststart
barsnick at gmx.net
Tue Feb 14 11:20:11 EET 2017
On Tue, Feb 14, 2017 at 02:50:46 -0500, Osama Alshaykh wrote:
> What is the best approach to progressively save a file while encoding?
> I am encoding using x11grab and want to make sure there is an input file even if the process is not gracefully closed (example stopping it using SIGKILL).
SIGINT or SIGQUIT qould really be better, no-one in their sane mind
would kill a program with SIGKILL.
> I am encoding video as h264 and using MP4 mux.
I believe MP4 is the least suitable format for progressive saving.
Perhaps if written as a segmented or fragmented format, each finished
segment will be "complete", but if a single MP4 file is not finalized,
its content cannot be read.
Matroska (MKV) handles progressive writing fine, in my experience the
file can be read even if the temporary header doesn't contain the
complete information. Otherwise, MPEG-TS comes to mind as the "perfect"
format for arbitrary cuts. (It comes with a bit of overhead though.)
Once finished, you can always convert the .mkv or .ts file to .mp4
afterwards, if required.
More information about the ffmpeg-user