# [MPlayer-users] Converting 512:272 to 480:480 with aspect=4/3?

romildo at uber.com.br romildo at uber.com.br
Sat Jan 17 17:37:06 CET 2004

```On Thu, Jan 15, 2004 at 07:07:11PM -0500, D Richard Felker III wrote:
>
> On Thu, Jan 15, 2004 at 11:54:32PM +0100, Svante Signell wrote:
>
> > Need advise hoe to expand/scale/crop an avi clip of size 512x272 to an
> > mpeg2(SVCD) clip of size 480:480 expanded to 640:480 when displayed.
>
> You have to do the math to work out the right sizes,

Is the math the following?

width ------------------ height
640   ------------------ y

width * y = 640 * height

y = (640 * height)/width

In the example above of a frame size 512x272 we have y = 340.

> or else get
> mencoder to do it for you with fancy use of the automatic options for
> scale.

How would that be achieved?

> Try:
>
> -vf scale=480:340,expand=480:480

-vf scale=480:y,expand=:480

> Actually you should fudge the vertical scale slightly so that black
> borders end up _exactly_ at multiple-of-16 boundaries (in this case,
> scale to height 336 instead of 340) to maximize quality, but the above
> commandline will at least work.

That is not much clear to me. You say that the black borders should
end up exactly at multiple of 16 boundaries. What exactly a multiple
of 16 boundary mean?

0 ->	+-------------------------------------------+
|                                           |
|   (top black border)                      | 70
|                                           |
70 ->	+-------------------------------------------+ <- boundary ?
|                                           |
|                                           |
|   (movie image)                           | 340
|                                           |
|                                           |
410 -> +-------------------------------------------+ <- boundary ?
|                                           |
|   (bottom black border)                   | 70
|                                           |
480 ->	+-------------------------------------------+

Is a boundary an offset in the vertical axis?

Are the boundaries in the example 70 and 410? If so,
you are right. They are not multiples of 16.

Using a height of 336 instead of 340 will give the
boundaries (480-336)/2=72 and (480-336)/2+336=408, which
are not multiple of 16 neither.

In the example given, you say 336 is better than 340.
I see that the image height (336) is a multiple of 16,
but each black border height (72) is not. Is it
enough that the image height be a multiple of 16 to
get maximized quality?

Regards.

Romildo

PS: Which scaling method do you suggest for a good
speed/quality compromise?

```