Log in

View Full Version : Aspect Ratio(s) in MPEG4


MarcN
25th October 2004, 13:36
Hello

With the latest firmware upgrade my DVD stand-alone-player (Medion 7457) seems to use the aspect ratio information stored in a MPEG4 AVI. Now I would like to know what kind of AR information that really is. XviD allows to set a ‘Pixel Aspect Ratio’ or ‘Picture Aspect Ratio’, MPEG4Modifier ‘Pixel AR” or ‘Display AR’. But after setting an AR and (re-)opening the file in MPEG4Modifier it sometimes seem to change:

Set with XviD :

PixAR 1:1 reports in MPEG4Modifier Square Pixels (OK)
PixAR 4:3 Pal reports in MPEG4Modifier PixAR 4:3 Pal (OK)
PixAR 16:9 Pal reports in MPEG4Modifier PixAR 16:9 Pal (OK)

PicAR 4:3 Pal reports in MPEG4Modifier PixAR Custom 16:15 (checked) + DisAR 1,333 : 1 (CHANGED)
PicAR 16:9 Pal reports in MPEG4Modifier PixAR Custom 64:45 (checked) + DisAR 1,778 : 1 (CHANGED)

Modified with MPEG4Modifier:

PixAR Square reports in MPEG4Modifier Square Pixels (OK)
PixAR 4:3 Pal reports in MPEG4Modifier PixAR 4:3 Pal (OK)
PixAR 16:9 Pal reports in MPEG4Modifier PixAR 16:9 Pal (OK)

DisAR 4:3 Pal reports in MPEG4Modifier PixAR Custom 12:11 (checked) + DisAR 1,333 : 1 (CHANGED)
DisAR 16:9 Pal reports in MPEG4Modifier PixAR Custom 16:11 (checked) + DisAR 1,778 : 1 (CHANGED)

So what is actually stored in the MPEG4-Stream? PAR and/or DAR? And how should the values be interpreted?

Thanks MarcN

sysKin
25th October 2004, 14:31
What do you mean by "changed"? All values appear to be OK.

As for the question, it is P(ixel)AR that is stored.

Radek

SeeMoreDigital
25th October 2004, 16:21
sysKin

I thought the XviD codec can generate Mpeg4 streams with either PAR or DAR signalling!

Confusingly, the encoder lists DAR (Display Aspect Ratio) as "Picture Aspect Ratio" (please change this guys)...

Quite a few players fitted with the MediaTek chip-set can "auto AR" PAR and DAR signalling encodes, however, more testing needs to be done to determine whether some pixel frame sizes b0rk!

And for those who don't already know... Philips players using the ESS chip-set b0rk when presented with Mpeg4/DAR signalling encodes. But copes fine with Mpeg4/PAR... Which is kind odd because the player can't auto AR Mpeg4 streams anyway... well not yet!


Cheers

MarcN
25th October 2004, 16:32
With 'changed' I meant that when I set a DAR and re-open the file with MPEG4Modifier it seems to have both DAR and PAR (with the PAR-Box checked). So when setting a DAR in XviD or MPEG4Modifier that ratio is transformed into a PAR? But how does MPEG4Modifier know that a DAR was originally chosen when only the PAR is stored?

MarcN

@SeeMoreDigital:
I have tested your XviD AVI with ‘With Anamorphic Signalling’. It was shown correctly on my 4:3 TV-Set. (stretched without the signalling)

SeeMoreDigital
25th October 2004, 16:55
Thanks for confring that Marc

With regard to Mpeg4 Modifier, I noticed the other day that the current version does not put a little "dot" in DAR: -

http://img37.exs.cx/img37/3402/SMD_Mpeg4_Modifier_DAR_signalling_info.png

.... Does it for you?


Cheers

MarcN
25th October 2004, 17:09
Same here. The green 'dot' only appears on the left side, in the Pixel AR Column, when I open an AVI. However that could be caused by the GUI. The 10 checkboxes are grouped together, only one can be set at a time.

SeeMoreDigital
25th October 2004, 17:26
I will let Moitah know, maybe he can fix it.

As it's useful to be able to distinguish between the two!


Cheers

sysKin
26th October 2004, 04:56
Originally posted by SeeMoreDigital
I thought the XviD codec can generate Mpeg4 streams with either PAR or DAR signalling!
There is no DAR signalling in mpeg-4, only PAR.
Confusingly, the encoder lists DAR (Display Aspect Ratio) as "Picture Aspect Ratio" (please change this guys)...Heh I know, my fault. I didn't change that because it would confuse people even more and create inconsitancies in all the FAQs and other guides.

As you probably know, there are two schools of thoughts among opensource developers: (a) create a confusing and obscure GUI and stick to it, and throw RTFMs and "use search"s at everyone who doesn't understand it or (b) warp the gui, rename components and change APIs every week, and throw RTFMs and "use search"s at everyone who's lost.

As we know, XviD chose (a).

Originally posted by MarcN
With 'changed' I meant that when I set a DAR and re-open the file with MPEG4Modifier it seems to have both DAR and PAR (with the PAR-Box checked). So when setting a DAR in XviD or MPEG4Modifier that ratio is transformed into a PAR? But how does MPEG4Modifier know that a DAR was originally chosen when only the PAR is stored?
There is always both DAR and PAR - I mean, every picture has some proportions and every pixel has some proportions.

PAR, DAR and resolution are bound together by a single set of equations, so you can always calculate one of them from the other two.

I don't know why MPEG4Modifier does not calculate DAR for you if one of the mpeg-4 preset PARs are chosen, but calculates if "custom" PAR is chosen. The actual bitstream signalling mode doesn't make any difference for final result.

Radek

SeeMoreDigital
26th October 2004, 10:56
Originally posted by sysKin
There is no DAR signalling in mpeg-4, only PAR.
Thanks for confirming this. Moitah has done much the same over in his MPEG4Modifier thread (http://forum.doom9.org/showthread.php?s=&postid=561784#post561784). This has made the PAR/DAR situation much clearer and has provided some likely reasons as to why some players have trouble coping with some "custom" PAR settings!

Originally posted by sysKin
Heh I know, my fault. I didn't change that because it would confuse people even more and create inconsitancies in all the FAQs and other guides.Okay... given that DAR information can't be stored in the Mpeg4 bit-stream. If you are going to re-name (it at some time), how about calling it "Pseudo DAR"?

Now... I've also asked Moitah the same but do you know whether DAR signalling (in it's truest sense) can be stored in the AVI or MP4 container, as I seem to remember the guys at 3ivx discussing this?

And do you know where the DAR information is stored with Mpeg2 streams. Is it in the stream or in the container?

Thanks again for confirming this...


Cheers

sysKin
27th October 2004, 02:36
Originally posted by SeeMoreDigital
Okay... given that DAR information can't be stored in the Mpeg4 bit-stream. If you are going to re-name (it at some time), how about calling it "Pseudo DAR"?Heh, but it is real DAR not pseudo ;)
Technical detials about how this is stored in the stream are not GUI material imho. User just chooses a DAR and xvid's logic does the rest - that doesn't mean it's somehow "pseudo", does it?

Now... I've also asked Moitah the same but do you know whether DAR signalling (in it's truest sense) can be stored in the AVI or MP4 container, as I seem to remember the guys at 3ivx discussing this?No I don't think so. AVI has "pixels-per-meter" which could be interpreted as one-over-PAR. I don't think MP4 has any aspect ratio since it would conflict with m4v's PAR.

And do you know where the DAR information is stored with Mpeg2 streams. Is it in the stream or in the container?Sorry, no idea at all.

stegre
27th October 2004, 03:39
====================================================================================
Assuming

DAR = display aspect ratio - x/y ratio of physical dimensions (e.g inches or cm - NOT pixels) of display screen
PAR = pixel aspect ratio - x/y ratio of the physical dimensions of a single pixel
SAR = storage aspect ratio - x/y ratio of the #of pixels being encoded, always known from the file

====================================================================================
MPEG-4

DAR = PAR x SAR, where

PAR is based on "aspect_ratio_info" in the Video Object Layer

For aspect_ratio_info values 1 - 5,
PAR = 1:1, 12:11, 10:11, 16:11, and 40:33 respectively.

If aspect_ratio_info = 15, PAR is the custom value:
"par_width" / "par_height"

where par_width & par_height are any two relatively prime integers
between 1 and 255. Those two values are stored in the VOL as well.

====================================================================================
MPEG-2

Based on "aspect_ratio_information", stored in the Sequence Header

If aspect_ratio_information is "1", PAR = 1:1, and therefore DAR = SAR

If aspect_ratio_information is "2", "3", or "4", DAR = 4:3, 16:9 or 2.21:1 respectively,
in which case PAR = DAR/SAR

However (this is relatively rare):

If Sequence Display Extension is present and display_horizontal_size
and display_vertical_size are present and differ from the SAR,
then their ratio will replace SAR in the above equation.

====================================================================================
MPEG-1

Based on "pel_aspect_ratio" located in the Sequence Header

DAR = PAR x SAR

where PAR = the reciprocal of 1.0000, 0.6735, 0.7031, 0.7615, 0.8055,
0.8437, 0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575 or
1.2015 for pel_aspect_ratio values of "1" thru "14" respectively.

However:

0.9157 is commonly accepted to mean 11/12 or .9166, the reciprocal of 12/11 (1.091) and,
1.0950 is commonly accepted to mean 11/10 or 1.1, the reciprocal of 10/11 (0.909)

====================================================================================

:cool: more or less, anyway

stegre
27th October 2004, 13:20
Basically, for MPEG-1, MPEG-4, an that lone "1:1" case for MPEG-2 (knnda rare), DAR is not specified, but may be calculated from PAR, which is.

In the remaining MPEG-2 cases, PAR is not specified but may be calculated from DAR, which is.

Unfortunately, in second situation above, there are only three different DAR values to choose from, leading to the "only two types" of DVD limitation - 4:3 & 16:9. Though there could be a third (2.21:1), too.