How can I mix two movies together before I handbrake them?

How to approach this

If you have two input movies, and want to generate one output movie, you should try not to re-encode them as you go, but rather take the original bitstream.

In your case, the possibilities are either:

VideoTS Part 1 → MP4 Part 1
VideoTS Part 2 → MP4 Part 2
MP4 Part 1 & MP4 Part 2 → Final MP4

… or:

VideoTS Part 1 & VideoTS Part 2 → Intermediate Video
Intermediate Video → Final MP4

Concatenating with MP4Box

I would choose the first option since I don't know if there's any tool that would take the "raw" DVD files and concatenate them for you.

You can simply use Handbrake to encode the videos to MP4 files with appropriate settings (e.g. using the iPhone or iPod presets). It's important you choose exactly the same settings for both videos.

Then, use MP4Box to concatenate those:

mp4box -cat video-a.mp4 -cat video-b.mp4 final.mp4

Why you shouldn't re-encode

The important part is that you actually use a tool like MP4Box to concatenate the videos, and not a Non Linear Editor like Windows Movie Maker. As far as I know, WMM will not allow you to just copy the h.264 codec bitstreams, but needs to re-encode the video after you've concatenated them.

This means that you will experience generation loss, like you know from JPEG images. It might not be noticeable, but I don't know how good Windows Movie Maker's encoder even is to begin with. I would doubt the quality would be the same.


I haven't been able to do it in Handbrake (Kev's answer suggests it's possible with batch conversion but that doesn't work for me) but ffmpeg supports it using its concatenate feature. Concatenate multiple input files and encode the video stream with x264 and copy the audio stream to a single MP4 output file:

ffmpeg -f concat -i files.txt -c:v libx264 -crf 22 -c:a copy output.mp4

files.txt is a list of input files in the format

file '/path/to/file1'
file '/path/to/file2'