Concatenate multiple MP4 files?

rbk123

Senior member
Aug 22, 2006
748
351
136
Is there an easy tool to merge multiple MP4 files together into a single file?

I use Handbrake to create multiple MP4 files (i.e. from DVD's with multiple episodes on there) but then want to rejoin them into a single file. Is there a simple way to concatenate them together?
 

Blintok

Senior member
Jan 30, 2007
429
0
0
Concatenate? = concentrate? as in to merge or join? if so,

a google search on "merge mp4 files" brought me to a free program called
YAMB
http://yamb.unite-video.com/index.html

I have never used it but looks like it may do what you want. I use the the join feature in the VideoRedo TV H.264 suite (not free)
 

sdifox

No Lifer
Sep 30, 2005
98,798
17,267
126
try copy file1.mp4 + file2.mp4 + file3.mp4 newfile.mp4

ps I am not serious.


for the life of me I can't remember the name of the program I used and that machine is not working right now.
 
Last edited:

rbk123

Senior member
Aug 22, 2006
748
351
136
So I used avidemux and it partially worked.
- when I bring up each file I want to merge into avidemux, it pops up a window stating something like "H.264 identified; if the file uses b-frames as a reference it could crash or have stuttering, etc..."
- the files merge but there is stuttering, particularly in the audio which is slightly out of sync with the video

Any other options that handle h.264 better?
 

Modelworks

Lifer
Feb 22, 2007
16,240
7
76
So I used avidemux and it partially worked.
- when I bring up each file I want to merge into avidemux, it pops up a window stating something like "H.264 identified; if the file uses b-frames as a reference it could crash or have stuttering, etc..."
- the files merge but there is stuttering, particularly in the audio which is slightly out of sync with the video

Any other options that handle h.264 better?

Nope.
The problem with editing compressed files is that not all the information needed to construct the frame is in the frame , it is spread across several other frames depending on where the edit point is located. To fix that problem you don't use b-frames in the encoding, if the content did use them, usually done to try to save space, there is nothing that can edit them correctly without stripping them down to an encode that doesn't use them. People on video forums keep telling others to stop using b-frames and use I-frames or P-frames, but people are hard headed :( .

Without a solid frame of data at the edit point that isn't used as a reference point for frames in front of it or behind it then data will be missing to generate the next series of frames meaning the editing program has to do a best guess at the frame to use for the closest match, so you lose frames of data making the whole video stream out of sync.
http://en.wikipedia.org/wiki/Video_compression_picture_types
http://en.wikipedia.org/wiki/Inter_frame
 
Last edited:

muncrief

Junior Member
Jan 31, 2015
1
0
0
You can use ffmpeg. Following is an example if you're using windows:

Make a text file with all input videos like this:

# This is a comment
file 'G:\adir\part1.mp4'
file 'G:\adir\part2.mp4'

Assuming that you named it "input.txt" execute this command:

ffmpeg -f concat -i input.txt -codec copy output.mp4

That's it! Your joined file is output.txt. Note that you may get a warning like "[mp4 @ 0000000002bfb480] track 1: codec frame size is not set" but everything should work fine.

Note that you could also execute the command:

ffmpeg -f concat -i input.txt -acodec ac3 -vcodec copy output.mp4

And you wouldn't receive a warning, but the audio may not be selected correctly. For example when I used this command I got Dolby Digital 5.1 audio instead of the full Dolby Digital 5.1 EX audio. The first command works better because it automatically selects the correct codecs.

I hope this works for everyone! Cheers!
 

wetech

Senior member
Jul 16, 2002
871
6
81
You can use ffmpeg. Following is an example if you're using windows:

Make a text file with all input videos like this:

# This is a comment
file 'G:\adir\part1.mp4'
file 'G:\adir\part2.mp4'

Assuming that you named it "input.txt" execute this command:

ffmpeg -f concat -i input.txt -codec copy output.mp4

That's it! Your joined file is output.txt. Note that you may get a warning like "[mp4 @ 0000000002bfb480] track 1: codec frame size is not set" but everything should work fine.

Note that you could also execute the command:

ffmpeg -f concat -i input.txt -acodec ac3 -vcodec copy output.mp4

And you wouldn't receive a warning, but the audio may not be selected correctly. For example when I used this command I got Dolby Digital 5.1 audio instead of the full Dolby Digital 5.1 EX audio. The first command works better because it automatically selects the correct codecs.

I hope this works for everyone! Cheers!

I hope the OP figured this out over the course of the last 3 years.
 

bohannie

Junior Member
Apr 13, 2015
1
0
0
1. iMovie should be able to accomplish this.

Import your .mp4 files into iMovie first. Then make a new project, drag your files to the timeline back-to-back and then export the movie.

2. One of my friends show me a simple guide on how to join MP4 files into one without losing quality and re-encoding here

After tried, i find it really great, it can join MP4 files into one file without reencoding with fast speed. it also can join MP4 files into one AVI, MOV etc.
 

Paulin99

Junior Member
Sep 21, 2016
1
0
1
Besides using iMovie or other programs, you may google search for Video Converter Studio, Free Video Joiner, or MP4Joiner to join MP4 files. Withou any technical requirement, you just need to open the program, select your files and choose to merge directly.