Mencoder, the free audio / video manipulation software packaged with MPlayer, offers a free command line (CLI) method for combining many video clips into one. (It can also do a variety of transcoding operations in the style of ffmpeg, but that is not the focus of this post)

Why would you choose this over the multitude of free GUI transcoding programs out there?
- Mencoder is very fast
- Processes can be scripted
- Wide range of codecs
- Cross-platform compatible
Once you learn the syntax, you can append videos much quicker with Mencoder than a more user friendly GUI program (which may use Mencoder behind the scenes anyway). And, it works on Linux, Macintosh, and Windows machines, so you don’t have to learn 3 different programs if you work on multiple operating systems.
Here’s the basic format of a Mencoder append command:
mencoder -oac copy -ovc copy -o 'combined_clip.avi' 'clip1.avi' 'clip2.avi'
Simple as that. The breakdown is as follows:
- -oac
Tell Mencoder what audio codec to use. For a complete list of options, check out the Mencoder documentation. In this case we have simply used “copy”, which will keep the current audio codec the same without transcoding (this option should only be used if the audio codecs are the same for all the clips). - -ovc
Tell Mencoder what video codec to use. Otherwise, same as above. - -o
Define the paths to input and output files. First list the output filename, then all the clips in the order which they will be appended.
Knowing this, it is easy enough to script the process. Say I have a whole directory of video files that I want to combine (ex: VID001.AVI, VID002.AVI, VID003.AVI, etc.). I could use the following ruby script to string them all together in their numbered order:
#!/usr/bin/ruby
vlist = String.new()
vpath = "/path/to/my/video/directory/"
vdir = Dir.new(vpath)
vdir.each do |v|
if v.include?(".AVI") == true
vlist << "\'#{vpath}#{v}\' "
end
end
cmd = "mencoder -oac copy -ovc copy -o \'combined_clip.avi\' #{vlist}"
system cmd
Save the script as VAppend.rb and run it like so:
ruby VAppend.rb
(you must be in the same directory as the script in order to run it with the above command)







