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

Aydoğan Ersöz aydogan.ersoz at teknotel.com.tr
Tue Sep 10 09:29:42 CEST 2013


Yes, that's a good idea but if append function exists in ffmpeg, it would
be good for me because i am porting a Gstreamer script to ffmpeg. Append
function is working in Gstreamer. Here is my Gstreamer script that i want
to port to ffmpeg.

"gst-launch-0.10 v4l2src device=/dev/video${i} ! videorate !
video/x-raw-yuv, width=320, height=240, framerate=5/1 ! tee name=tp tp. !
queue ! videobalance saturation=0.0 ! textoverlay halign=left valign=top
text="(c)PARK ON OM " shaded-background=true ! clockoverlay halign=right
valign=top time-format="%D %T " text="Date:" shaded-background=true ! queue
! ffmpegcolorspace ! ffenc_mpeg4 ! avimux ! filesink
location=$DIR/CAM${i}_${DTIME}.mp4 append=true tp. ! queue ! jpegenc !
multifilesink location=$DIR/webcam${i}.jpeg &"

Here, we can see "append=true" flag that works for appending stream to
existing mp4 file.


On Tue, Sep 10, 2013 at 5:24 AM, littlebat <dashing.meng at gmail.com> wrote:

> On Mon, 9 Sep 2013 17:18:15 +0300
> Aydoğan Ersöz <aydogan.ersoz at teknotel.com.tr> wrote:
>
> > 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 file.
> >
> > 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*"
> >
>
> Don't know how to append it. There is another idea:
> 1, Record your video to a temporary file;
> 2, Join the old file and your new temporary file using the way: How to
> concatenate (join, merge) media files
>
> https://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20concatenate%20%28join%2C%20merge%29%20media%20files
> 3, When the new recording start, duplicate the steps above.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>



-- 
*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