Join multiple AVI or MPEG videos into a single file with mencoder

I have some videos I wish to concatenate into a single one, without re-encoding.

It’s very easy with mencoder.

If they are avi:

mencoder -forceidx -ovc copy -oac copy part1.avi part2.avi part3.avi -o total.avi

-forceidx forces to rebuild the index, for seeking.

But if they are MPG files i should use the MPEG container (mencoder uses avi as default, regardless of file extension)

mencoder -forceidx -of mpeg -noskip -mc 0 -ovc copy -oac copy part1.mpg part2.mpg part3.mpg -o total.mpg

The mencoder manual advises the use of -noskip -mc 0 when muxing mpeg files.
For MPEG1 format this has to be specified, because MPEG2 is the default:

mencoder -forceidx -of mpeg -noskip -mc 0 -mpegopts format=mpeg1 -ovc copy -oac copy part1.mpg part2.mpg part3.mpg -o -o total.mpg
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s