[FFmpeg-user] Appending Video Stream to Existing or New File

Aydoğan Ersöz aydogan.ersoz at teknotel.com.tr
Mon Sep 9 16:18:15 CEST 2013

Dear ffmpeg users,

i can record 320x240 5-fps h264-encoded grayscale stream from internal
webcam of my laptop to avi file. Beside this function, i can manage to
extract a grayscale jpeg file every 5 seconds.

I do want to record from webcam to file cumulatively to the file. If file
(output avi) exists, script should append stream to end of file. If file
does not exist, script should create file and then write.

My code (script) overwrites the existing file, not appends to the end of

How can i achieve this functionality?

Here is my design: "*ffmpeg -f video4linux2 -i /dev/video0 -c:v libx264 -r
5 -s 320x240 -vf format=gray /home/aydu/Desktop/demo/cam0.avi -r 1/5 -vf
format=gray -f image2 -updatefirst 1 /home/aydu/Desktop/demo/image.jpeg*"

Best regards.

*Aydoğan Ersöz*
MSc. Control Engineer / R&D Director
Teknotel Elektronik Ltd. Şti.
Mimar Sinan Cad. No:6 34746 Yenisahra/Istanbul/Turkey
*Phone:* +90 216 472 83 13 - *Ext:* 30
*Fax:* +90 216 472 83 14
*Email:* Aydogan.Ersoz at teknotel.com.tr
*Web:* www.teknotel.com.tr

More information about the ffmpeg-user mailing list