In recent versions of FFmpeg, use the
ffmpeg -i in.mp4 -filter:v "crop=out_w,out_h,x,y" out.mp4
Where the options are as follows:
out_w is the width of the output rectangle
out_h is the height of the output rectangle
y specify the top left corner of the output rectangle
So, for example, to crop a 640×480 window, starting from position (100, 100), you'd do:
ffmpeg -i in.mp4 -filter:v "crop=640:480:100:100" out.mp4
Be aware that FFmpeg will re-encode the video using x264. With no additional options, this defaults to a constant quality factor (CRF) set to 23. To increase the quality, use a lower value, maybe go down to 18:
ffmpeg -i in.mp4 -filter:v "crop=640:480:100:100" -crf 18 out.mp4
For older versions of FFmpeg, information is provided on this site:
CROPPING AND PADDING THE IMAGE
Let's take our original kitty.flv movie and turn it into a widescreen MPEG movie that can be used on a DVD-Video. The trouble is,
its aspect ratio is 4:3, which is narrower than the 16:9 of widescreen
format. Its current size is 320x240. If we want to give it a
widescreen aspect ratio, its height should be 320/(16/9)=180 pixels
instead of 240. If we simply resize the image in order to squash it
vertically, the picture will be deformed. The only thing we can do in
order to stop the picture from going anamorphic is to trim off parts
of it, or to "crop" it. The picture is 60 pixels too "tall" so let's
shave 30 pixels off the top and off the bottom, then convert the
result to a 16:9 NTSC DVD:
$ ffmpeg -i kitty.flv -croptop 30 -cropbottom 30 -target ntsc-dvd -aspect 16:9 kitty.169.mpg
The "-croptop" and "-cropbottom" options slice the given number of
pixels off the top and the bottom of the image respectively. There are
also "-cropleft" and "-cropright" options for narrowing an image with
an aspect ratio that's too high. The number of pixels to slice off
must be an even number. The various "-crop" options act BEFORE any
resizing takes place. They crop the specified number of pixels off the
ORIGINAL image. Now let's turn this 16:9 NTSC video into a 480x360
letterboxed AVI at 15 frames per second. "Letterboxed" means that we
keep the whole widescreen image and put bars on the top and bottom so
that the resulting bar-image-bar sandwich has the required aspect
$ fmpeg -i kitty.169.mpg -acodec mp3 -ar 44100 -ab 128k -vcodec msmpeg4v2 -b 500k \ -s 480x270 -r 15 -padtop 44 -padbottom 46 -padcolor 000000 -f avi kitty.letterbox.avi
If we want to maintain the same aspect ratio for the image itself and
if we want to make it 480 pixels wide, then the height will have to be
480/(16/9)=270 pixels, hence the "-s 480x270".
Our image being 270 pixels high while we need it to be 360 pixels high
in order to obtain the standard 4:3 aspect ratio, we need to slap an
extra 90 pixels on it. However, the number of pixels specified in the
"-padtop" and "-padbottom" options has to be an even number, hence 44
for one and 46 for the other rather than 45 each.
The color of the padding is specified using the "-padcolor" option.
The argument given is a color expressed as three hex bytes just like
in HTML (but without the leading "#" sign). See here for a conversion
tool that can convert a color into hex notation. There are also
"-padleft" and "-padright" options for widening an image with an
aspect ratio that's too low for the target.
The various "-pad" options are applied AFTER resizing has taken place.
They add the specified number of pixels to the RESIZED image.
Additional information can be found on the ffmpeg-wiki pages, of which I suggest you to start with the "FilteringGuide" section, in which you will find a really comprehensive list of ffmpeg filters.