Page 1 of 1

About the new aspect ratio option in MediaCoder

Posted: Fri Jan 01, 2010 6:24 pm
by stanley
Image

As you might have noticed, the aspect ratio option has been changed in the recent releases of MediaCoder. The new option has 4 choices as shown above. Here I explain the feature of each option.

1. Keep DAR

This will keep the original DAR (display aspect ratio) for the output file. In this case, changing the resolution won’t affect the display aspect ratio.

2. Keep PAR

This will keep the original PAR (pixel aspect ratio) for the output file. This is usually used when you are applying cropping (but no resizing which cause screen geometric change).

3. Set DAR

This will set the DAR of output file to your specified value (the value can be entered or chosen in the blank next to the aspect ratio option). This is usually used when you change the DAR of the original file or apply cropping + resizing to fit for screen geometric size different from the original target.

4. Set PAR

This will set the PAR of output file to your specified value (the value can be entered or chosen in the blank next to the aspect ratio option) . This is usually used when you change the PAR of the original file. This is usually used when you know the target PAR and want to control the DAR through resolution.

Re: About the new aspect ratio option in MediaCoder

Posted: Thu Jan 07, 2010 4:25 pm
by stanley
Please be noted that PAR referred here is not "Picture" Aspect Ratio. PAR is identical to SAR.

Re: About the new aspect ratio option in MediaCoder

Posted: Fri Jan 08, 2010 6:18 pm
by stanley
In additon, the SAR I refer to is not Storage Aspect Ratio but Sample Aspect Ratio. There are too many confusing abbreviations. Here I list them:

DAR - Display Aspect Ratio
PAR - Pixel Aspect Ratio (common) or Picture Aspect Ratio
SAR - Sample Aspect Ratio (identical to PAR) or Storage Aspect Ratio (width/height in pixels)

Re: About the new aspect ratio option in MediaCoder

Posted: Fri Jan 08, 2010 6:52 pm
by meRobs
It's a pity you use SAR to mean "Sample aspect ratio", and therefore equal to PAR, because this just adds to the confusion.
I have been working with video editing for years and I have never seen SAR to have the meaning you use!
When discussing or deciding how to use PAR and DAR in mediaCoder, we need to refer to SAR (W/H of the pixel frame). If SAR can no longer be used because it has your meaning or it is ambiguous we have no suitable alternative!

This may be just a Language thing.
It has always been defined in English articles and References as: Storage Aspect Ratio , the width divided by the height as given by the resolution (the storage frame)!
In test books and references on Video and TV: DAR = SAR x PAR.

See also the Topic ... viewtopic.php?f=17&t=8197&p=25018#p25018

Re: About the new aspect ratio option in MediaCoder

Posted: Sat Jan 09, 2010 2:51 am
by stanley
I don't understand why using SAR for Sample Aspect Ratio is a pity? I think you must be encoding with x264 which has an option named "--sar" and you specify SAR or PAR with it.
It's true English is not my native language, but I've been programming for 20 years mostly in English. Here is the class I wrote to calculate between DAR and PAR. I paste it to show there is no mis-calculation between DAR and PAR in MediaCoder.

Code: Select all

class CAspectRatio
{
public:
	CAspectRatio():dar(1) {}
	CAspectRatio(int width, int height)
	{
		SetRes(width, height);
		dar = (double)width / height;
	}
	void SetRes(int width, int height)
	{
		this->width = width;
		this->height = height;
	}
	void SetDAR(double dar)
	{
		if (dar > 0) {
			this->dar = dar;
		} else {
			dar = (double)width / height;
		}
	}
	void SetDAR(int dar_num, int dar_den)
	{
		if (dar_num > 0 && dar_den > 0) {
			dar = (double)dar_num / dar_den;
		} else {
			dar = (double)width / height;
		}
	}
	void SetPAR(double par)
	{
		if (par > 0) {
			dar = par * width / height;
		} else {
			dar = (double)width / height;
		}
	}
	void SetPAR(int par_num, int par_den)
	{
		if (par_num > 0 && par_den > 0) {
			dar = (double)par_num / par_den * width / height;
		} else {
			dar = (double)width / height;
		}
	}
	double GetPAR(int* par_num = 0, int* par_den = 0);
	double GetDAR(int* dar_num = 0, int* dar_den = 0);
private:
	int width;
	int height;
	double dar;
};
Maybe we should just avoid using abbreviations. There are always arguments about the aspect ratio topics (on doom9 for example). To avoid confusion and conflict, the equation should be like this:
DAR = (Width/Height) x PAR.

On the other hand, I admit the aspect ratio is not correctly set when encoding AVI files and I am looking for a solution.

Re: About the new aspect ratio option in MediaCoder

Posted: Sat Jan 09, 2010 9:07 am
by meRobs
Why a pity? Because of the ambiguity that arises when a term has two meanings. People in the video field will assume the one I mentioned and unless SAR is defined each time, there will be a problem. Also, users will use freebies like Gspot to get the paramaters for a file before encoding. This App lists SAR, PAR and DAR.

in any case, I agree that it is usually better to avoid abbreviations. Especially now after you have explained that there is another meaning for SAR.

There is no problem with PAR and DAR in MediaCoder, which are used on the Picure tab. And I agree that during discussions we could use Width/Height for SAR.
But, a novice may still be confused and we need to explain which width & height?
Not that of the video he/she sees, but that of the data frame, etc. Even saying the 'pixel width' and 'pixel height' is not enough because the DAR is often described in pixels.

But sometimes in an in-depth, self-contained discussion it is convenient to use the 3 abbreviations and, then, the definition of the terms should be spelt out in detail to avoid confusion. That is why in viewtopic.php?f=17&t=8197&start=0, the discussion of Aspect Ratio begins by carefully explaining the terms that are used in that topic.

In the future I shall avoid the term SAR on the Forum unless its meaning is made clear at that time.

Thanks for looking at the problem with AVIs. As you know I have found a few strange results when testing MediaCoder for the above topic on aspect ratio.
And as you suggested I have described them on the Post you began for this purpose: viewtopic.php?f=17&t=8269

Re: About the new aspect ratio option in MediaCoder

Posted: Sat Jan 09, 2010 1:12 pm
by stanley
Yes GSpot refers SAR to Storage Aspect Ratio, but x264 and mplayer/mencoder refer it to Sample Aspect Ratio. MediaCoder has no relationship with GSpot but it does rely on x264 and mplayer/mencoder. So I think it's not a pity but quite natural to obey the rules of the latters. I don't think there is universal acknowledged reference for SAR, which can even be referred to Signal Aspect Ratio in video field.

Re: About the new aspect ratio option in MediaCoder

Posted: Wed Jan 13, 2010 2:01 am
by rhycos
Thanks..........that clears the smoke around .......how mediacoder deals with aspect ratio's :)

Re: About the new aspect ratio option in MediaCoder

Posted: Thu Jan 28, 2010 2:20 am
by benoitvm
Sorry if this a dumb remark, but why are some "obvious" 16:9 (PAR=1:1) dimensions not listed in the dropdown ?
e.g. 320*180 (useful for 320*240 PDA displays), 640*360 ?
(not sure to what usual DAR dimensions like 320*160 or 640*368 correspond ?)