[MPlayer-users] Question about mplayer/mencoder

Corey Hickey bugfood-ml at fatooh.org
Wed Mar 19 19:04:25 CET 2003

Pigeon wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]

> 	mplayer doesn't play any sound (it said "no sound") for this mpg,
> while xine plays it without sound either, plus the image stopped every
> now and then.
> 	I was just wondering there's any option I should use for encode them
> so that the movie file is more "compatible" with other players, like
> windows media player, for example.
> 	Thanks again.
> Pigeon.

I don't know if this is what might be causing your green-blocks-in-xine
problem, but windows players do not honor the -lavcopts aspect= option,
even though it's perfectly valid. A better course with regard to
compatibility would be to rescale the image before encoding, with -vop
crop=a:b:c:d,scale=x:y (read the manual for which parameter does what).
Here's my technique for this. Your numbers will be different.

1. $ mplayer -dvd 1 -vop cropdetect
    seek around a bit until you get meaningful values

2. Play the DVD with the suggested values.
    $ mplayer -dvd 1 -vop crop=718:368:0:54
    I like to set the border style of the video window to "borderless",
    and look closely for any black fade-in at the edges or dark lines a
    few pixels in.
    In this case, there's a bit of fade-in at the top, so I remove two
    pixels from the top:
    $ mplayer -dvd 1 -vop crop=718:366:0:56
    which looks good.

3. Find the aspect ratio with mplayer -dvd 1. Look for a line like this:
    VO: [xv] 720x480 => 854x480 Planar YV12

4. Since the X axis was originally scaled up, I scale Y down by the same
    factor: 720 / 854 * 366 = 308.57  (the 366 if from the cropping step)
    This gives me a resolution of 718x308.57, which is the exact same
    aspect ratio for the cropped data, but not multiples of 16.

5. Since multiples of 16 is better, make a quick list:
    $ for i in $(seq 45 -1 15) ; do echo $((16 * $i)) ; done

6. Find possible values for X and Y that are close to the exact cropped
    aspect ratio ( 718 / 308.57 = 2.33 )
    I work my way down the list I made, starting at the first multiple
    below the Y resolution, and use the aspect ratio to calculate X.
    Hopefully this will be close to a multiple of 16 in the first few
    304 * 2.33 = 708.32 (kind of close to 704)
    288 * 2.33 = 671.04 (very close to 672. good enough for me)
    If you find that you don't get near multiples of 16 without
    decreasing the resolution unacceptably, you can either
    a. live with a bit of distortion or
    b. revise your cropping values to shave a bit off an axis.

7. And, there we have it, 672x288.
    mencoder -dvd 1 -vop scale=672:288,crop=718:366:0:56 ...<whatever>


That may look like lots of steps, but it really only takes a few
minutes. Bear in mind that if your DVD upscales the Y axis
( VO: [xv] 720x480 => 720x540 Planar YV12 )
You'll have to adjust your calculations accordingly.


More information about the MPlayer-users mailing list