I would like to join mp4 videos like I join pdfs by
Is there any default tool to join videos?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Yes, you can join multiple videos into one file using default terminal commands. Using a simple
cat will do want you want.
cat video1.avi video2.avi videon.avi > output.avi
There is a big but here - this method will output the
video1.avi header onto
output.avi. Therefore, the header of
output.avi is the same as
video1.avi, so on most video players, it will look like
videon.avi are lost - source 1, source 2.
To fix this, you need additional tools. There are many other terminal tools for joining movies that update the header as well. The most known video editing tools are
mencoder (which is a part of MPlayer) and
ffmpeg. Both have an enormous amount of options and settings and it is beyond this forum to go into much detail, but I will give the short commands below.
The use and installation of
ffmpeg can be intimidating, but the video editing capabilities are the most powerful I have encountered so far. As the installation from source can be a hassle for native OS X users, I advise you to use Homebrew.
To install these tools using Homebrew, run this one-liner in your terminal:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Homebrew is now installed, it is wise to follow the installer's suggestions after installation. Now we install
brew install ffmpeg mplayer
Now we can use
mencoder to merge the two videos:
mencoder -oac copy -ovc copy -idx -o output.mp4 video1.mp4 video2.mp4 video3.mp4
Or we can use
ffmpeg to merge the two videos:
ffmpeg -i concat:"video1.mp4|video2.mp4" -codec copy output.mp4
Note that you may need to escape the character "
|" which is special for many shells, so
ffmpeg -i concat:video1.mp4\|video2.mp4
You specifically ask for
mp4 is a container format, it is possible that the default installation of
mencoder does not have the correct coding/decoding ('codecs') packages by default and that you need to install these separately. But that is beyond the scope of this topic.