Friday, September 9, 2011

Split or Trim Videos With mencoder

It's easy to split a video file into several smaller video files with the mencoder utility.  For example, the following two commands will split a video into two parts at the one-hour (01:00:00) mark:

mencoder -endpos 01:00:00 -ovc copy -oac copy video.avi -o part01.avi

mencoder -ss 01:00:00 -oac copy -ovc copy video.avi -o part02.avi

The "-endpos" option tells mencoder the ending position at which it should stop copying the video to the output file.  Conversely, the "-ss" option tells mencoder the start position at which it should begin copying video to the output file.

Using these commands in other ways, it's possible to split a video into more than two pieces or to trim the beginning and end from it.

No comments: