Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created some time-lapse videos from photos, using this command:

ffmpeg -i IMG_%03d.JPG -s 1440x1080 -sameq video.MP4

And it worked great. Now I want to join several of these time-lapse videos to make a single, longer video (all the input videos have the exactly same format). I already tried using:

cat video1.MP4 video2.MP4 > stitch.MP4

but the output ends up being equal to video1.MP4

I don't want to transcode nor changing any parameter of the video, I just want a end-to-end stitching, as if those videos were on a playlist.


share|improve this question

The output won't be equal to video1.mp4, but the headers/footers for the video will start and end around video1.mp4, so your player won't go into video2.mp4. Assuming the videos are the same bitrate/codec etc:

cat video1.MP4 video2.MP4 | ffmpeg -y -i - -genpts -vcodec copy -acodec copy stitch.MP4

Bear in mind that this is not necessarily the best method (would be better to make all of the time lapses at the same time in one video) as if the codec is lossy you will induce generation loss.

share|improve this answer
It doesn't work. It says it "couldn't detect codec parameters" – tomm89 Feb 4 '11 at 2:00

With a recent version of ffmpeg, you can use the concat demuxer. Create a file called inputs.txt containing lines like:

file 'input1.mp4'
file 'input2.mp4'
file 'input3.mp4'
file 'input4.mp4'

With a bash shell, you can use a for loop to create the file like so:

rm inputs.txt
for f in input{1..4}.mp4; do echo "file '$f'" >> inputs.txt; done


ffmpeg -f concat -i inputs.txt -c copy output.mp4

Since it uses -c copy, this will be completely lossless.

share|improve this answer

I know you said with ffmpeg but I've had good luck using mp4box for just simple stitching together of files. You can download it here.

Here is the command line example:

mp4box -cat <file> -cat <file> dest.mp4
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .