[MPlayer-dev-eng] Wrong YUV4MPEG aspect ratio code

Attila Kinali attila at kinali.ch
Sun Oct 17 16:33:30 CEST 2004


On Mon, 24 May 2004 09:21:32 +0000
Leonardo Giordani <leonardo.giordani at treuropa.com> wrote:

> 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).


Any comments on this one ?

			Attila Kinali
-- 
egp ist vergleichbar mit einem ikea bausatz fuer flugzeugtraeger
			-- reeler in +kaosu




More information about the MPlayer-dev-eng mailing list