[FFmpeg-user] Recording a live stream changing output file every x seconds

dE . de.techno at gmail.com
Mon Nov 28 16:18:27 CET 2011

On 11/28/11 16:20, Hector Cano wrote:
> Hi,
> I am recording live a stream from an Axis camera. It works perfect.
> I'm required to record for maybe a couple of hours at a time, and I'd 
> prefer to have several shorter files, maybe a new file every minute, 
> instead of a big file (to minimize risk, and to be able to start post 
> processing without having to wait till the end).
> Is there any option for ffmepg to do the job automatically?
> I've tried using -t 60, and restarting the capture, but the jump is 
> too noticeable.
> I am using an Ubuntu 11.10 server for the job, launching ffmpeg from a 
> bash shell.
> I tried to find the answer in the archives, but found nothing but an 
> old unanswered question "Recording and splitting at the same time".
> Any help would be much appreciated.
> Thank you,
I think some bash workarounds will do, you may start the other ffmpeg 
instances before the first one finishes using bash's '&' e.g. -

ffmpeg -t 00:01:00 -f x11grab -preset ultrafast -vcodec libx264 mp4.mp4 &
sleep 55; ffmpeg -t 00:01:00 -f x11grab -preset ultrafast -vcodec 
libx264 mp4.mp4 &

And repeat this using while loops.

I don't understand the post processing part. But as an alternative, for 
backups, you may try RAID mirroring using mdadm.

More information about the ffmpeg-user mailing list