Avidemux, Video Aspect and the meaning of PAR.

Started by AQUAR, January 25, 2015, 05:24:22 AM

Previous topic - Next topic

AQUAR

Avidemux and Video Aspect.
Just to be sure -  the parameters of video aspect are Display Aspect Ratio (DAR) , Pixel Aspect Ratio (PAR) and Storage Aspect Ratio (SAR).
There was a recent topic "XVID ASPECT BUGS??" that was steeped in the game of video aspect.
See: http://avidemux.org/smuf/index.php/topic,16337.0.html
In this thread the Author questions the ways of the XviD Dialog for aspect ratios, and makes two rather interesting claims viz.
1) The dialog may set an incorrect PAR depending on source material, and demonstrates this with an example for the PAL (16:9) option.
2) Why not specify PAR values as per the X264 way? (Its much better!).

My response was (if I may quote myself!).
QuoteUse it accordingly to re-define the DAR, to match the source video PAR and SAR (Stored Aspect Ratio) to digital screen types.
This response was qualified with a pre-fix of  "we look at this dialog from a different perspective" and a post-fix with the "PAL PAR" is a fixed value for that option.
The arguments came thick and fast after that and unfortunately without resolving anything.

I wondered why this went of the rails so quickly and started to analyse my perception of this confusing game of video aspect.
That doodling seemed like a reasonable article so I thought why not share it here.
It is a little bit focussed on the XviD aspect dialog (because of that  "XVID ASPECT BUGS??"  topic!).
But seems quite helpful wrt configuring various video aspect dialogs in Avidemux.

My perception of the video aspect game starts by qualifying the above quote viz,
1) By screen types I am talking about  the Pixel Aspect Ratio (PAR) of the display hardware.
2) By "re-define the DAR" I meant expressing the relationship to include the PAR of the old screen type (PARo) with the PAR of the new screen type (PARn).

Doing that, the relation ship is defined as  DAR= (Scaling) x (SARo) x (PARn)  and  (Scaling) = (PARo)/(PARn) and (SARn)=(Scaling) x (SARo)
Simply:  DAR= (PARo/PARn)(SARo)(PARn) and yes, mathematically its the same DAR=SARxPAR (I am not cheating!)
This re-define allows me to better visualise the processing requirement from the point of view of changing screen types (pixel geometry!)
I prefer to associate a physical dimension with a physical device rather than digital data (digital data is afterall just a bunch of binary values).
This clarifies that the PAR value set by these XviD dialog options are the fixed value for a selected screen type (eg PAL (16:9)!). 
It also helps with seeing a PAL video source as meant for a PAL screen type, as there is no PAR meta data included for that video material.
The matching is inherent by selecting a compatible PAL display for a PAL defined video source (I know - there is more to this but it will do!).
Only when you recode for a new screen type do you need to include information about the PAR of the old screen type (hence the PAL(16:9) wording!).
Clearly you can see from the redefined expression how the scaling factor of PARn/PARo has to come into play (hope we all agree on this!).
That scaling takes place on the fly if you set a PAR flag or is done by way of resampling during the recode (info material for how to use ADM!).

Note for awareness:
1) Not all media players look at that PAR flag.
2) The PAR flag maybe in the container or the video stream, or both (if both it may have conflicting PAR values).
Because of these issues the DAR may be inconsistent amongst different media player (just need to know your hardware!)


And back to my perception:
For recoding to digital display types, PARn is normaly (1:1) and the equation simply folds back to DAR = PARo x SARo.
This demonstrates why "digital" people tend to prefer associating PAR meta data as a property of the video source rather than screen type.
For recoding between the same display types, PARo=PARn, and the equation simply folds to DAR=PAR x SAR.
This demonstrates that you may ignore scaling and the DAR will stay as is (although upsampling may be needed!).
And lastly recoding between digital screen types PARo=PARn=1, and the equation simply folds to DAR=SAR.
ADM presumes this and needs enduser interaction to correctly set it up for other cases (as it should be!)

Note about video editors:
ADM is not a media player but a video editor, and makes no association to match the type of video source to the type of screen.
Even PAR meta data is ignored when rendering the source to its unfilterd display.
In the case of PC monitors, the "pixel data" is simply mapped to  square pixels.
And if the source video was not meant for square pixels then ADM will render it with a DAR that looks wrong.
If you are good at maths:  then DAR on adm =  DAR for source / PAR intended for source.
Sticking with the PAL(16:9) case: Visible frame PAL source has SAR of (702 : 576) associated with PAL screen with PAR (16:11).
DAR of source =  (702/576) x (16/11) approximately 16:9 .
DAR on ADM display = 16/9 X 11/16 = 11/9 or 702/576  (as expected for direct mapping to square pixels!)


And back to my perception:
Looking at the relationships between DAR SAR and PAR from this "hardware" perspective:
The presentation of the XviD dialog makes perfect sense to me as its baseline is "analogue" incorporated.
The presentation of the X264 dialog makes perfect sense to me as its targetted for the "all digital" environment.
I guess the XviD dialog may seem strangely worded for people that haven't experienced the analogue era.

Well that is how I conceptually see the game of video apect.
Feel free to disagree, but not free to attack me personally for seeing video aspect in this manner (especially my friend ZAKK!):

Returning to that "XVID ASPECT BUGS??" topic:
DAR, SAR and PAR can all be variable at some point in the processing chain depending intentions.
Any response therefore requires to be anchored in that process with appropriate details (else its a looming disaster!).

So what is the correct PAR behind that PAL(16:9) option?
Choice is 16/11 or 64/45 (makes for 2.5% difference in the DAR!).
Is it 16/11 (closest to definition for PAL(16:9) screens). OR
Is it 64/45 (common value used for later video material with "full PAL frame" and not related to a screen type per se).
Answer - Neither are correct  - and I don't care (can't tell the difference on movies!).
To me, both are values of convenience that causes the original DAR to be scaled into a "16:9 digital frame".
Use 16/11 if dealing with the PAL from the old XviD era (702 x 576) - thats whats in the XviD dialog.
Use 64/45 if dealing with more current PAL sources (720 x 576) - thats whats in the X264 dialog.

But, very interested in other peoples opinion (except "the praying mantis"! ).
It's still  a very interesting issue!