[MPlayer-users] Wrong YUV4MPEG aspect ratio code

Leonardo Giordani leonardo.giordani at treuropa.com
Wed May 26 12:22:35 CEST 2004


Hi all,

I created a YUV4MPEG stream with frames of size 720x576 and pixel aspect ratio 
59:54, but opening it with mplayer I noticed the following MPlayer output
(CVS snapshot 20040524):

[...]
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 720 x 576 (preferred csp: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1,09:1 - prescaling to correct movie aspect.
VO: [xv] 720x576 => 720x658 Planar YV12
Selected video codec: [rawyv12] vfm:raw (RAW YV12)
[...]

This is wrong. The movie aspect ratio is not 1,09, it is 1,33!
In fact the scaling is wrong and I see the movie squeezed.

The problem is in demux_y4m.c lines 198-200:

[...]
ratio = y4m_si_get_sampleaspect(priv->si);
if (ratio.d != 0 && ratio.n != 0)
  sh->aspect = (float)ratio.n/(float)ratio.d;
[...]

The Sample Aspect in YUV4MPEG header is the Pixel Aspect Ratio (PAR), not the 
Movie Aspect Ratio (MAR).

If you do not know the PAR just suppose it to be 1:1 and set

MAR = Xdim / Ydim

In this case you know the PAR, so the right computation is

MAR = Xdim * PAR / Ydim

giving for the above picture MAR = 1.3625 (in fact a correct PAL picture is 
702x576 and not 720x576, thus giving a MAR = 1.3284375 = 1.33 = 4:3).

Thank you for your work!

Leonardo Giordani

-- 
Leonardo Giordani

Tele-Rilevamento Europa - T.R.E. s.r.l.
a POLIMI spin-off company
Via Vittoria Colonna, 7
20149 Milano - Italia
tel.: +39.02.4343.121
fax: +39.02.4343.1230
e-mail: leonardo.giordani at treuropa.com
web: www.treuropa.com




More information about the MPlayer-users mailing list