[MPlayer-users] Wrong Movie Aspect Ratio in YUV4MPEG
Leonardo Giordani
leonardo.giordani at treuropa.com
Mon Feb 16 19:30:04 CET 2004
Hallo mplayer community,
using mplayer 0.92-3.2.3 I noticed the following bug.
(All image sizes and pixel aspect ratios are taken from Jukka Aho page
www.uwasa.fi/~f76998/video/conversion/)
I created a 702x576 PPM with GIMP and converted it to a YUV4MPEG stream
through mjpegtools: I use 702x576 pictures instead of 720x576 just to cover
only the visible part of the PAL frame.
ppmtoy4m -n 50 -F 25:1 -A 128:117 -I p -r sample.ppm > sample.y4m
the parameter A sets the pixel aspect ratio to 128:117 (1,094).
Playing it through mplayer I obtained the following output
...
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 702 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] 702x576 => 702x642 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.
I try to explain it: excuse me if my explanation is boring, but better boring
than obscure.
Follow the calculations: call PAR the Picture Aspect Ratio, XAR the piXel
Aspect Ratio and MAR the Movie Aspect Ratio.
You will agree that
PAR * XAR = MAR
In this case the stream has PAR = 702/576 and XAR = 128/117. The above
calculation gives 1.33.
Now you have a system where XAR is 1, so you have to do the following:
1. Read the Picture Dimensions: 702x576
2. Read the XAR: 1.094
3. Compute the MAR: 1.33
4. Compute the newXAR: 1
5. The newPAR is MAR/newXAR: 1.33
6. Scale the picture: 702/1.33=527.8 or 576*1.33=766.08
Now you do something wrong: you take the XAR as MAR (see the above output): so
you find that 702x576 is not 1.094 and scale it to 702x642. But 702x576 is
not computed with square pixels.
Probably you misunderstood the parameter into the YUV4MPEG stream.
If I am wrong please let me know. Thank you.
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