Split, cut, or sample a video file on the command line

There are many reasons to cut or split a video file. For example, one may want to cut a long video into multiple parts to upload to YouTube. I first ran into this and this, which suggests:

 <pre class="src src-sh">ffmpeg -ss 00:00:00 -t 00:01:00 -vcodec copy -acodec copy -i in.avi out.avi

## -ss: start position ## -t: end position ## can re-encode with other codecs

However, for some reason my out file is almost as large as my in file, even though I’m only sampling 1 minute out of the 2 hour segment. This lead me to the mencoder solution:

 <pre class="src src-sh">mencoder -ss 00:00:00 -endpos 00:00:01 -ovc copy -oac copy in.avi -o out.avi

The file size of my out file is more reasonable, and the speed is incredibly fast since I am not re-encoding.

About Vinh Nguyen

Statistician

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>