Using FFMPEG to generate video clips

Published on 2010-05-28 by John Collins. Please follow me on Twitter for more: 

I use a Pentax K-7 as my main camera these days. Apart from shooting 14MP stills, it shoots high-definiton videos. Sometimes I need to generate shorter clips from the original files, and once again FFMPEG comes to the rescue with this easy command:

ffmpeg -i original.avi -ss 0 -t 5 -vcodec copy -acodec copy clip.avi

The key components here are the -ss and -t parameters, which express in seconds the start point and end point of the clip to extract from the original. Once I run the above command on the original.avi file, the new clip.avi file will be created which will contain the first 5 seconds of the original.avi file.