[Libav-user] ffmpeg fragmentation

simone cilli simone.cilli at spark-security.com
Wed Feb 18 10:56:52 CET 2015


Hello everybody,
I'm trying to create a fragmented mp4 recording using ffmpeg API. I'm running on an ARM Linux system. I have two main purposes:

*         Avoid corrupted recordings in case of system crash;

*         Allow user to play file while recording.

Reading ffmpeg documentation (https://www.ffmpeg.org/ffmpeg-formats.html#mov_002c-mp4_002c-ismv) I used different combinations of these flags:

*         movflags frag_keyframe

*         movflags empty_moov

*         min_frag_duration
The result is always the follow:

1.       I start the recording;

2.       A file is created in the output directory with size 28 B;

3.       The size is kept until the end of the recording;

4.       I stop the recording;

5.       The file size increases until to reach the final size;

6.       The file could be read with ffplay and/or VLC.
If I shutdown the system while recording, the video is a 28 B file not playable. It seems ffmpeg keeps in memory the recording until the stop and only then it writes in file system.
Using frag_keyframe and min_frag_duration in Windows I see the file increase its size while recording.

What is the common behavior of ffmpeg fragmentation? Is file "buffering" expected? Can I activate some flag to flush the file periodically?
Any idea to achieve my two goals?
Thanks in advance,
Simone Cilli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150218/0c721fc8/attachment.html>


More information about the Libav-user mailing list