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

Hector Cano hcano at mebcn.com
Mon Nov 28 16:39:58 CET 2011

On 28/11/11 16:18 , dE . wrote:
> 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.
Thanks for the idea. I'll give it a try.

The "post processing" in this case is some human interaction. I have to 
be able to supply on demand a stream with part of the recording, for 
someone to review it, without stopping the recording. Therefore having 
the video splitted makes it quite easy to get just the demanded part of 
the video and forward it to the user.

More information about the ffmpeg-user mailing list