Does anybody know how to stitch two (or more) videos together using ffmpeg (or another cli)? This is assuming that all the videos are in the same format and the video format being used allows for lossless stitching (no transcode, just end-to-end stitching).
-
did the answer work for your scenario? – Andrew Dec 22 '09 at 15:12
5 Answers
You can stitch two or more videos with ffmpeg that are in a format that can be concatenated by doing this:
$ cat file1.avi file2.avi > cat_output.avi
$ ffmpeg -i cat_output.avi -r 25 -sameq stitched.avi
The second step it necessary where ffmpeg merges the joined files into a proper readable video file.
There is no such thing as -newvideo in ffmpeg to my knowledge.

- 201
- 1
- 2
- 6
for newer ffmpeg's there is a "concat" input option too: http://ffmpeg.org/faq.html#How-can-I-join-video-files_003f

- 1
- 1

- 62,887
- 36
- 269
- 388
You can concatenate and encode multiple .avis using mencoder
like so:
$ cat part1.avi part2.avi > tmp.avi && mencoder -forceidx -oac copy -ovc copy tmp.avi -o final.avi && rm -f tmp.avi
If you're using OS X, mencoder
is part of the mplayer
Homebrew package. You can install it easily enough with:
$ brew install mplayer

- 122
- 1
- 4
Using ffmpeg I think the command you want is
-newvideo
the help describes this as "add a new video stream to the current output stream"
although I personally have not tried it.

- 2,598
- 16
- 27
We added support for stitching videos with ffmpeg (static build required) in Java to ffmpeg-cli-wrapper. For stitching videos, check out this example. Library also supports fade in, fade out, text overlays etc.

- 1,562
- 15
- 18