Merging (joining) two videos with cat and QuickTime X

QuickTime 7 had this great feature of merging two videos together just by dragging a video file from the Finder to another QuickTime video. Unfortunately this is not possible in QuicTime X. But I still wanted to do it without installing additional software and came up with a solution that includes a small hack :).

Assume we have 2 video files named video1.dv and video2.dv in ~/Movies folder that we want to merge.

1.  Open the Terminal and navigate to Movies folder

$ cd Movies

2. Concatenate two files

$ cat video1.dv video2.dv > video3.dv

This step will take a while and the result is a strange (I don’t really want to say corrupted as it is just split in two MPEG containers) file, which will still play in most video players (I tried VLC and QuickTime X). This procedure works with transport stream formats (e.g. .dv, .ts, .mp3, .m2ts, etc.)

3. Open the new file in QuickTime X and re-save it 

File -> Save As and select one of the available formats or use

File -> Save for web and choose the desired quality

QuickTime X will re-save the file frame by frame with a proper (e.g. MOV or MP4) container.

It is off course possible to use other software (e.g. ffmpeg) and procedures.

PS: Comments on Mac OS X Hints are worth reading

Edit 22/4/2011:
I found out that it is possible to merge videos with cat and mencoder (mplayer) that rebuilds the index afterwards:

1. Install mencoder

$ sudo port install mplayer

2. merge videos together

2.1 AVI

$ cat movie1.avi movie2.avi > movie_new.avi
$ mencoder -forceidx -oac copy -ovc copy movie_new.avi -o movie.avi

2.1 MPG

$ mencoder -oac copy -ovc copy movie1 movie2 -o movie.mpg

Edit 11/9/2012:

This tip is more a proof of concept than a serious/professional way of joining videos. I still receive emails about this though. If you need something graphical with an UI, still light and opensource (and free as in free speech) try Avidemux. It can also concatenate or append (how they call it) files one after another. See the step 3.


Authors gravatar


Odd, it didnt really work for me. I merge two m4v files and it opens just the first part in QT X.. Also, when i try to save that file it only save the first part again, so i end up with video1 with another name. 🙂

Authors gravatar

Matjaž Kljun

Interesting. What about the file size of “the merged file”. Is it as big as the first file only or does it have a combined size of both files you try to merge?

My m4v files were created with iMovie (from my video camera). But AFAIK the m4v uses a transport stream and cat should work.

Authors gravatar


H.246 codec, a friend sent it to me i think he did it in Premiere.
The size of the merged file is file1+file2, although QTX only plays the first part (and hence, only saves the first part)

Tried merging with QT7Pro (got it off the snow leo disk) but its actually not that good. It inserts few frames of a white “pause” and i cant make him save in the same format so it always encodes it again.

Authors gravatar

Matjaž Kljun

Most video authoring applications save video as a Program stream. There is a difference between Program stream and Transport stream. I’m really not an expert but these links (sorry I can’t make them clickable) should explain the difference:

As far as I know the h.246 is tipicaly used in MPEG2 TS. But it might be that Premiere saves it as PS which is also possible.

I would try two things:

1. convert videos using QT X (File->Save for web) and try to merge two converted files


2. Use some other software (e.g. MPEGStreamClip as suggested on Mac OS X Hints).

Hope this helps you in some way.

Authors gravatar

Matjaž Kljun

One more thing. What happens if you play “the merged” video in another player like VLC?

Authors gravatar


It plays exactly the same that is, only the first part.
I’ll just call the guy and just tell him to give me the full version in one piece for now because i have deadline, and i’ll play with it later when i have some free time.
Thanks for all your help, much appreciated!

Leave a Reply