Cropping videos using ffmpeg / libav / avconv30 Dec 2012
Ubuntu (my distro of choice) and others are transitioning from ffmpeg to libav, libav is a fork of ffmpeg and most tools are drop in compatible, the method described in this post should work with recent versions of either, the command line tools
avconv are interchangeable.
Old MethodHistorically ffmpeg had
-cropleftetc. parameters used for cropping videos, these have now been replaced by the
-vfor video filter option which is a little more complex.
-vfoption can be used to specify a section of the source video to use in the output by specifying the size and position of a rectangle to crop to:
-vf option takes the argument
crop=outw:outh:x:y - to create a new video file
output.mpeg cropped to 720px x 600px and aligned 240px from the top:
avconv -i input.webm -vf crop=720:600:0:240 output.mpeg
In the example I'm also converting a webm video to mpeg along with cropping it, to convert webm to mpeg at the same dimensions just remove the cropping options.