[MPlayer-users] use of libavcodec option aspect= and -vop crop

Chris Sincock csincock at airnet.com.au
Wed Feb 5 16:35:23 CET 2003

I just wanted to mention that as far as I can tell, 
it is probably not the best idea to use the libavcodec
aspect= option when you are reducing the vertical size of
a video unless you are also cropping it horizontally by
the correct corresponding amount.

for example, in this example given in the encoding.html page
in the MPlayer docs (note the command is split over several

$ mencoder sample-svcd.mpg -ovc lavc -lavcopts 
vcodec=mpeg4:aspect=16.0/9.0 -vop crop=714:548:0:14 -oac copy -o

Assuming that the uncropped height of the video was 576
(548 + 2x14), the width of the movie (before any cropping is 
done) is meant to be 1024 ( 576 * 16 / 9 )

As far as I can tell, that is cropping 28 pixels vertically.
If the aspect ratio is 16:9 (or 1.78), then since the aspect 
ratio is only applied to the video _height_ the resulting 
video when shown will be displayed with a a width of 974
(548 * 16 / 9).

Since 974 / 1024 = 0.951, you need to crop 4.9% of the horizontal
width of the video in order for the aspect ratio to be maintained.

For a video with width 720, (as I think the example is probably 
cropping 6 pixels off the right), 4.9% is 35 pixels so another 
29 or so would need to be cut out.

I think for the given example, the difference is not noticable, 
however with any video where more is cropped off the top and bottom,
it would become noticeable.
One example of a video with large black bands at the top is 
Falling Down, which if you crop the black bands off, has a height
of only 440.

The encoding.html page says you should really crop the black bits 
off, but that to avoid prescaling you can use the aspect= option.

However it seems to me that you can't really use them together 
without either cropping off more pixels horizontally, or else
rescaling the video up horizontally or down vertically, which
kind of defeats the purpose.

I am still not sure which is the best way to go, ie
   - leave the bands, no (or conservative) cropping and use aspect=
   - crop the black stuff, do a bit of calculation, rescale one 
     dimension, and use aspect=
or - crop the black stuff and just rescale the movie to the correct
    size, and don't use aspect=

I eventually went with option 1 after trying the different methods
 as it looked to me like it produced the best video quality for a 
 given bitrate.

originally I just tried aspect=<a calculated value> to correct the
difference, but it only accepts a few fixed aspects.

csincock at yahoo dot com

More information about the MPlayer-users mailing list