[FFmpeg-user] Best format for arbitrary start/stop stream recording?
dflett at bigpond.net.au
Sat Apr 7 04:41:50 CEST 2012
I am writing an application to record a live video stream from a capture
card to multiple flash memory sticks simultaneously. This is to replace our
current rack of domestic DVD recorders.
We record live events and at the end of the event we stop the recording and
want to give the media (DVD or memory stick) to the clients as soon as
possible after the event finishes.
DVD recorders are annoying in that the finalize process is fiddly and takes
too long, and they machines themselves are unreliable - e.g. recordings
often fail for no apparent reason and can't be finalized.
So far what I've written works pretty well. I set up ffmpeg to record with
the following command-line:
ffmpeg -y -isync -i INPUT -vcodec copy -acodec copy -f mpegts pipe:1 | tee
-a OUTPUT1 OUTPUT2 ... OUTPUTn > /dev/null
Using mpegts allows me to start and stop at any time and the file is
readable. Using "tee -a" allows me to append video to existing files - e.g.
to restart a stopped recording, without creating new files.
Also, I can play back the files as they are being written to, which is good
for "confidence monitoring".
The one major drawback that I can see so far is that the resulting files
have no time index. They play in VLC, but there is no time indication at
Is is possible to add time index metadata to a file after it has been
written, without having to create a new file i.e. I want to modify the
existing file "in place".
Or, is there a transport-stream-compatible container that is able to write
time index data as the video is being written?
Some of the video files I am recording will be 3 or more hours in duration -
when I stop recording I don't want to wait for the whole file to be
rewritten to get a time index.
More information about the ffmpeg-user