Log in

View Full Version : Determining Pixel Aspect Ratio (PAR)


vampiredom
25th November 2011, 04:17
This is a replacement for this discussion (http://forum.doom9.org/showthread.php?t=163164) which was so zany and nonsensical. When scaling video to another size, it is essential to determine the pixel aspect ratio (PAR) of the source in order to do it properly.

If your source looks stretched or squeezed horizontally (objects look too fat or too skinny) then it most likely it has non-square pixels. If you don't know where your clip originated, determining PAR can be difficult.

Fortunately, only certain dimensions tend to have non-square pixels and most sources of these sizes tend to follow one of the standards.

If your image is not of the dimensions listed below, it is most likely square pixels (PAR = 1) and requires no special consideration. [such as 1920x1080, 1280x720, 1024x768, 640x480, 640x360, 480x360, etc.]

In addition to common DVD formats, I have also included SVCD and a few oddball "internet" resolutions with decent guesses as to their possible PAR. Please remember that, unless your source comes directly from a DVD or some known standard format, these are only "educated guesses", but educated guesses can often be better than stabbing in the dark.

For each resolution there are two possible PAR values listed: The "normal" (4:3) aspect, and "widescreen" (16:9)

Common non-square pixel formats and their Pixel Aspect Ratio (PAR)

NTSC
===================================================================
720x486 \
720x480 \ image appears slightly stretched -----> PAR = (10/11)
704x480 / image appears squeezed ---------------> PAR = (40/33)
352x240 /
-------------------------------------------------------------------
480x480 \
360x360 \ image appears squeezed ---------------> PAR = (15/11)
352x360 / image appears extremely squeezed -----> PAR = (60/33)
/
-------------------------------------------------------------------
360x480 \
352x480 \ image appears extremely squeezed------> PAR = (20/11)
/ image appears ridiculously squeezed --> PAR = (80/33)
/
PAL
===================================================================
720x576 \
704x576 \ image appears slightly squeezed ------> PAR = (59/54)
352x288 / image appears extremely squeezed -----> PAR = (118/81)
360x288 /
-------------------------------------------------------------------
480x576 --- image appears extremely squeezed ------> PAR = (59/36)
--- image appears ridiculously squeezed ---> PAR = (59/27)
480x384 --- image appears slightly squeezed -------> PAR = (59/54)
--- image appears extremely squeezed ------> PAR = (118/81)
-------------------------------------------------------------------
360x576 \
352x576 \ image appears ridiculously squeezed---> PAR = (118/54)
/ image appears insanely squeezed-------> PAR = (236/81)
/
HD (either NTSC or PAL)
===================================================================
1440x1080 \
960x720 \ --------------------------------------> PAR = (4/3)
1280x1080 -----------------------------------------> PAR = (3/2)

vampiredom
25th November 2011, 04:24
To convert a non-square pixel image into square pixels without cropping, multiply its width by the PAR. The height does not change. So…
704x480 @ 10/11 PAR would be 640x480 because:
704 * (10/11) = 640

Likewise,
720x576 @ 118/81 PAR would be 1049x576 because:
720 * (118/81) = 1048.8888888888888888888888888889

Just because a particular PAR conversion is "correct", however, it does not always mean it is the best choice.
Let's have a look at the example above, which gave use 1048.8888888888888888888888888889x576 for a widescreen PAL DVD. Setting a decimal width is impossible - and setting an odd width such as 1049 will cause problems in YUY2 and YV12 colorspaces. For YUY2, it must be evenly divisible by 2, while YV12 requires mod4. Our example of 1048 will work fine for both. So, in the real world:
720 * (118/81) = 1048

In cases where a video is 720 pixels wide (like all DV and DVD formats), the actual 4:3 or 16:9 area is only 704 pixels wide. This how it is possible, for example, for 720x480 and 704x480 to have the same height and pixel aspect ratio. When converting to square pixels from such sources, it is usually best to crop 8 pixels off of each side and start with a 704x480 box.

(Note: Some older professional NTSC formats may use 720x486. In which case, crop 4 pixels from the top and 2 from the bottom.)

In AviSynth terms, that's:

# assume a 720x576 source (PAL)
Crop(8,0,-8,0)

# assume a 720x480 source (NTSC)
Crop(8,0,-8,0)

# assume a 720x486 source (NTSC, like Matrox I-frame AVI files)
Crop(8,4,-8,-2)

So, let's do our PAL widescreen conversion again using the cropped numbers
704x576 @ 118/81 PAR would be 1024x576 because:
704 * (118/81) = 1025.5802469135802469135802469136 = ~1024

So, why not 1025 or 1026? If you are doing RGB formats only (such as making still images) this may be an OK choice.
However, with certain digital video formats, it is advantageous or requried for dimensions to be mod16.
1024 is also a standard computer monitor width, so it is a good choice for several reasons (and nobody will ever tell the difference).

In these examples, we will assume the target it YV12 and use dimensions that are mod4 (evenly divisible by 4) for output.


# We are assuming our input it NTSC 16:9 DVD in this example
# Note the decimal point values so that AviSynth returns a float instead of an integer
PAR = 40.0 / 33.0

# determine new width, make it mod4-safe for YV12
NewWidth = Round(width() * PAR) / 4 * 4
Spline36Resize(NewWidth, height())

vampiredom
25th November 2011, 04:40
To convert a square pixel image to a different PAR is easy. Divide the width by the PAR like such:

640x480 @ 10/11 PAR
640 / (10/11) = 704
704x480

The above example is rather simplistic. In many cases, when converting from square pixels, we'll want to scale the image overall. First we need to determine the scaling factor. To accomplish this, divide the source height by the target height:

SourceHeight / TargetHeight = ScalingFactor

1280x720 -> 704x480 @ 40/33 PAR
480 / 720 = 0.66666666666666666666666666666667

Once we have the scaling factor, apply that to both width and height of the source.
1280 * 0.66666666666666666666666666666667 = 853.33333333333333333333333333333
720 * 0.66666666666666666666666666666667 = 480

Now, divide the source width by the target PAR:
853.33333333333333333333333333333 / (40/33) = 704

From this, we can see that 1280x720 transforms perfectly to 704x480 for widescreen NTSC. The same is true for widescreen PAL:
576/720 = 0.8
1280 * 0.8 / (118/81) = 702.9
720 * 0.8 = 576

Well, almost perfectly in the case of PAL… but 702.9 is more than close enough to 704 to call it 704x576.

Sometimes, however. It is necessary or advantageous to crop or pad the source image when converting to from square pixels. Let's take the case of a 4928x3264 photograph that we want to format for 4:3 PAL DVD.

First, determine if the image - when scaled proportionately - will be wider or taller than the destination. The destination in this case is 720x576 @ 59/54 PAR. Lets' turn this to square pixels (we don't want to round it yet)

MaxWidth = 720 * (59/54) = 786.66666666666666666666666666667
MaxHeight = 576

From this, we'll get the effective Display Aspect Ratio of the target in square pixels:
TargetDAR = MaxWidth / MaxHeight = 1.3657407407407407407407407407407

Let's now compare this with the photograph:
SourceDAR = 4928/3264 = 1.5098039215686274509803921568627

From this, we can see that the DAR for the photo is larger, meaning it is wider than the Standard 720x576 4:3 PAL DVD.
We have the choice of cropping from the sides or letterboxing it (putting bars on the top and bottom of the image.) Let's try it both ways:

Cropping to fit another format

To determine the cropping, let's get the closest PAL-sized box within that image, in round pixels.
We'll use source image's height and the target format's DAR to determine that:
3264 * 1.3657407407407407407407407407407 = 4457.7777777777777777777777777776 = ~ 4458

Which gives us a cropped dimension of 4458x3264.

Is is best that this number is evenly divisible by 2. In this case, it is.
Were it not, we could have rounded up or down to the nearest 2. More than close enough for this kind of conversion.

Letterboxing to fit another format

Now, we'll do letterboxing instead of cropping. Width is easy here (Our target width will be 720) we only need to determine height.
First, we'll determine our scaling factor. In this case, this will be determined by the target and source widths.

TargetWidth / SourceWidth = ScalingFactor

ScalingFactor = 720 / 4928 = 0.1461038961038961038961038961039

Now, multiply the height by the scaling factor:
3264 * 0.1461038961038961038961038961039 = 476.88311688311688311688311688313

At this point, we are still dealing with square pixel values for the image. We need to apply the PAR to our new height:
476.88311688311688311688311688313 * (59/54) = 521.03896103896103896103896103897 = ~ 520

In AviSynth, we would do something like this to fit our photo into letterboxed PAL 4:3

# load the 4928x3264 image
ImageSource("bigphoto.jpg")

# resize and add borders to fill 720x576
Spline36Resize(720, 520)
AddBorders(0,28,0,28)

vampiredom
25th November 2011, 04:43
Most times, when converting from one non-square pixel format to another, we are converting PAL to NTSC or vice versa – or converting to/from a scaled format like SVCD. These types of standards conversions usually require only changing the height or width and leaving the other alone. Note: Any interlaced sources must be deinterlanced (or "bobbed") before scaling the height.

As far as scaling is concerned, these kinds of standards conversion are extremely easy and there really is no math required by the user:

# Restore a 480x480 SVCD to full size for DVD output
Spline36Resize(720,480)

# Scale the image from 720x480 NTSC -> PAL
Spline36Resize(720,576)

# Scale the image from 704x576 PAL -> NTSC
Spline36Resize(704,480)

Of course, for real NTSC<->PAL conversion, you need to choose a good deinterlacer and then convert the framerate from 60Hz <-> 50Hz, but we are only discussing scaling here.

Let's look at one case where we are not doing NTSC <-> PAL and where some math is required for the conversion.

Our source here will be HDV 1440x1080 @ PAR 4/3, which is widescreen. We will convert this to a 720x480 widescreen NTSC DVD two different ways; once with pillarboxing, and again with cropping.

First, we'll set the basic parameters common to both versions:

# Assume a 1440x1080 16:9 HDV source
SourceWidth = width()
SourceHeight = height()
SourcePAR = 1.333333

TargetWidth = 720
TargetHeight = 480
TargetPAR = 1.212121


Since the DAR of 720x480 widescreen DVD is slightly wider, the pillarboxed version will resize the video to 704x480 and add 8 pixel borders on each side. Here is VersionA:

# Scale factor based on heights = 0.444444
ScaleFactor = Float(TargetHeight) / Float(SourceHeight)

# Determine the width to scale to (no need to determine height)
ScaleWidth = Float(SourceWidth) * SourcePAR * ScaleFactor / TargetPAR

# Round to mod4 -> 704
ScaleWidth = Round(ScaleWidth * 4) / 4

# Determine the border size
PadX = (TargetWidth - ScaleWidth) / 2

VersionA = Spline36Resize(ScaleWidth, TargetHeight).AddBorders(PadX, 0, PadX, 0)

Now, if do it without adding borders, we'll have to crop a tiny bit from the top and bottom to preserve the aspect ratio accurately. We'll crop the source (as opposed to cropping the output) for a little more accuracy and increased performance. Here is VersionB:

# Scale factor based on widths = 0.5
ScaleFactor = Float(TargetWidth) / Float(TargetHeight)

# Determine the cropped height relative to the source
TargetDAR = Float(TargetWidth) * TargetPAR / Float(TargetHeight)
CropHeight = Float(SourceWidth) * SourcePAR / TargetDAR

# Round to mod2 -> 1056
CropHeight = Round(CropHeight * 2) / 2

# Determine the cropping amount for the top and bottom edges
CropY = (SourceHeight - CropHeight) / 2

VersionB = Crop(0,CropY,0,-CropY).Spline36Resize(TargetWidth, TargetHeight)

Both versions should be accurate conversions of the source.

Keiyakusha
25th November 2011, 06:28
Again this pure-math talks. Oh well, I'm not going to participate in such discussion again, just want to tell for those who hopefully will be able to read it below all this wall of text that there is plenty of dvds that are utilize full 720 pixels width and to get everything right needs to be resized like 720->853 without any cropping (and of course there is nothing to crop at all accept maybe ~2 semi-dark pixels which are normal and happens to be even on BD). Perhaps all american DVDs respect so called standards, I don't own any of such dvds so not sure, but this is not the case for other countries. And this is the case for pal-land too. So don't forget to use your eyes too, not pure math.

vampiredom
25th November 2011, 07:23
So don't forget to use your eyes too, not pure math.

Absolutely. This is very true. The stuff I put in here is meant to be a starting point and not a one-size-fits all solution. I hinted at that at the top of the post: That the pixel dimensions are not an absolute guarantee of the PAR for any given clip. (Though I state that DVDs adhere to standards, I guess I should have said that they should adhere to such standards).

there is plenty of dvds that are utilize full 720 pixels width and to get everything right needs to be resized like 720->853 without any cropping

Yes, many DVDs do ... and if you really want the full image, you should not crop. Using 853 for width, however, will only work out correctly with RGB, 852 would be a good choice for YUY2 or YV12.

I appreciate your comments. If you or anyone finds an error in what I've written here, please let me know so I can correct it. I am trying to provide some clear guidance in an orderly fashion to newbies, so as to possibly avoid pointless discussions like the one I mentioned previously.

Keiyakusha
25th November 2011, 07:34
Using 853 for width, however, will only work out correctly with RGB, 852 would be a good choice for YUY2 or YV12.
Of course. Well, personally i'm not a fan of 852 too, I prefer anamorphic stuff :p

Ghitulescu
25th November 2011, 08:27
There is a lot of misunderstanding (and because of that also lots of misinformation) concerning the aspect ratio in general.
While some of them may derive from notations (SAR) and others from changes in standards and official recommendations (EBU), I think the bulk of misunderstandings comes from a very simple yet overlook issue: the difference between the framesize and the image size (which generally is smaller than the framesize, due to overscan, blanking, and various "safe" settings), and this concerns mainly the people using only the PC that do reencodings, these people having only PC-background.
There are only 2 DARs (FS and WS, 4:3 and 16:) and 2 alternatives each (standard-analog, also called non-ITU, and ITU-R). However, since the material was processed maybe with a combination of digital (not necessarily ITU) and analog gear before editing (which also may influence the PAR), it is really difficult to find an one-for-all PAR/DAR solution. Depending on the source and its processing, all values may be correct, use your eyes and a PAR 1:1 display :).

TheSkiller
25th November 2011, 10:29
Nice table! :cool:
There is however one point where I disagree with what the table states and that is the SVCD PAR.
The table assumes the 480x576/480 pixels used in SVCD make up a 4:3 frame. I'm pretty sure though, and that's also what I have observed capturing the output of DVD-Players playing a 480x576 test video, that these 480 pixels are simply a downsized version of 720 which means it has the same characteristics as 720 (wider than 4:3, scanline length is 53.333µs).
Therefore the PAR of PAL SVCD is 177/108 and the PAR of NTSC SVCD is 15/11.

Edit: Those are for 4:3 video, 16:9 is as follows: PAL 177/81 NTSC 60/33
It's actually just the PAR for 720,704 multiplied by 1.5.

hello_hello
25th November 2011, 11:48
Fortunately, only certain dimensions tend to have non-square pixels and most sources of these sizes tend to follow one of the standards.

The problem is, they generally don't. At least not in my opinion. How were you able to come to a definitive conclusion they do?
(Edit) Sorry, I noticed in a later post you modified "tend to" with "should".
I don't think you can really generalise and say something like "crop to a width of 704 then use this pixel aspect ratio" etc. and know it'll be correct much of the time, because there's no way to know it will be. Admittedly if it's wrong it won't be out by much, but it can still be wrong. If only DVDs did all stick rigidly to some sort of standard.....

Personally I think DVDs (at least) are less likely to follow one of the standards than they are to follow them. My usual way of resizing DVDs is to use a straight 16:9 or 4:3 resize (I can't remember the exact PARs off the top of my head) then crop off only the necessary crud (or crop to mod16), encode what's left and at least 9 times out of 10 that'll be correct. I think DVDs which use the "official" PARs are the exception, not the norm, and I've come to this conclusion after comparing many old DVD encodes with their Bluray equivalent.

Anyway, being a GUI kind of guy I tend not to think about PAR all that much (I just choose non-ITU resizing, crop and encode) but for those times I do have to think about it, this resize calculator comes in quite handy as it'll let you choose between resize methods and it'll calculate the aspect ratio distortion for you as you crop. Yoda's Resize Calculator (http://www.mediafire.com/?09v9bldu9a6hm00)
At least with the calculator handy it's not necessary to remember a table of PARs.

vampiredom
25th November 2011, 17:15
Nice table!.
Thank you!

The table assumes the 480x576/480 pixels used in SVCD make up a 4:3 frame
Yeah, it really is all about the "should" thing. Of course, there is no way of knowing what somebody did when they made that SVCD and, if it was made from a DVD source, if the source was correct to begin with. However, I am pretty sure that most DVD players and player software will assume the same standard, so using this PARs in AviSynth will get you no worse results that you'd see when watching the original SVCD (or DVD, or whatever).

I don't think you can really generalise and say something like "crop to a width of 704 then use this pixel aspect ratio" etc. and know it'll be correct much of the time, because there's no way to know it will be.

I can't. But, I can say that this is how it should work out. If somebody did not adhere to the standard then that is their error (and, if the error is bad enough, you'll have to compensate for it). Same point as above: This is only so that you can "restore" the frame size the way that a DVD/SVCD player would.

More and more, however, I believe that discs will be sticking to the standard... because, finally, most editing software is using the same standard, digital TV broadcasts are using the same standards, etc. For many years, it was not this way (I still remember Adobe using 0.9000 for NTSC in version CS3, etc.)

Heed Keiyakusha's words and you'll be fine: use your eyes, too!

TheSkiller
25th November 2011, 22:18
Yeah, it really is all about the "should" thing. [...] However, I am pretty sure that most DVD players and player software will assume the same standard, so using this PARs in AviSynth will get you no worse results that you'd see when watching the original SVCD (or DVD, or whatever).

Yes, the "should" is what I'm talking about, maybe I didn't say clearly what I mean: SVCD should be using the PARs I stated because that's the way they are treated by standalone players (software players are always different, they always play "dumb" and resize only to either exactly 4:3 or 16:9 which is nothing specifically related to SVCD, it's the same for 720x... DVD). And it's also the way they are derived: It makes sense that a 480x576/480 video is derived by downsizing a 720x576/480 source since nothing is 480x... to begin with. For example in digital TV transmissions the incoming signal to the MPEG encoder is pretty much for sure always 720x576/480 (or even 486), and if the broadcast is done in super-duper low bitrate in reduced resolution, like 480x..., then the encoder takes those 720x... and resizes them to 480x.... The result is of course the same as the original 720x... video but horizontally squeezed, and therefore it is still covering an area wider than 4:3 or 16:9.


In conclusion, and that's my point, if you say a video of 720x... has those particular PARs mentioned in the table then you are ought say that a video of 480x... has those PARs I mentioned, otherwise it wouldn't be consistent. 720 is 1.5 times 480, so the PAR of 480 is also 1.5 times the PAR of 720.

vampiredom
26th November 2011, 00:23
In conclusion, and that's my point, if you say a video of 720x... has those particular PARs mentioned in the table then you are ought say that a video of 480x... has those PARs I mentioned, otherwise it wouldn't be consistent. 720 is 1.5 times 480, so the PAR of 480 is also 1.5 times the PAR of 720.

Thank you. I do see what you are saying.
** EDIT ** correct numbers now incorporated in the table ** EDIT **

Asmodian
26th November 2011, 02:00
I think DVDs which use the "official" PARs are the exception, not the norm, and I've come to this conclusion after comparing many old DVD encodes with their Bluray equivalent.

Do you have a reason to assume the blurays do it correctly more often then DVDs?

Keiyakusha
26th November 2011, 02:13
Do you have a reason to assume the blurays do it correctly more often then DVDs?

May I put it in the other way? How many anamorphic BDs you saw? I saw only the ones that use square pixels. So of course they are something that you can compare to.

TheSkiller
26th November 2011, 11:13
480x480 -------------------------------------------> PAR = (15/11)
--- image appears extremely squeezed ------> PAR = (50/33)
480x576 -------------------------------------------> PAR = (295/216)
--- image appears ridiculously squeezed ---> PAR = (295/162)

Please let me know and I will revise it.Sorry, those numbers are wrong, exept the first one. :( You forgot that PAL has 576 lines, not 480.

For example: (NTSC wide)
40/33 * 1.5 = 60/33

Now the test:
720 * 40/33 = 872.72
480 * 60/33 = 872.72

As you can see the 60/33 PAR is giving the same result for the 480 video as the 40/33 PAR does for the 720 video.

PAL:
59/54 * 1.5 = 177/108
...and so on.

It should look like this:


480x480 -------------------------------------------> PAR = (15/11)
--- image appears extremely squeezed ------> PAR = (60/33)
480x576 -------------------------------------------> PAR = (177/108)
--- image appears ridiculously squeezed ---> PAR = (177/81)

Ghitulescu
26th November 2011, 16:11
Do you have a reason to assume the blurays do it correctly more often then DVDs?

Almost 100% of the BDs originated from film material use only a PAR of 1:1 throughout their process.

vampiredom
26th November 2011, 17:50
Sorry, those numbers are wrong, exept the first one. :( You forgot that PAL has 576 lines, not 480.

No, I didn't forget. I just started multiplying by the wrong number - just for the fun of it! :) Oops. Sorry 'bout that. I am putting the correct numbers in the table now. Thanks.

hello_hello
26th November 2011, 18:26
Do you have a reason to assume the blurays do it correctly more often then DVDs?

I guess the square pixel thing has me assuming. I hope it's a reasonable one.

I'll admit I did some more thinking on this topic due to this thread, and I must admit that living in PAL-land there's a chance I'm making too quick an assumption the same thing also applies to NTSC DVDs. I have encoded quite a few of them, and I'm sure I've got a few lying around I'll be revisiting again due to this thread, but if the aspect ratio of Bluray discs can be taken as accurate, then in PAL-land at least, I'm absolutely certain by far the majority of discs use straight 16:9 or 4:3 resizing.

PAL actually has "digital" pixel aspect ratios, which differ from those vampiredom posted, and if memory serves me correctly they resize to exactly 16:9 or 4:3, although I'm not sure I actually understand them fully yet (cause of the 720 vs 704 width thing).
http://en.wikipedia.org/wiki/Pixel_aspect_ratio#Pixel_aspect_ratios_of_common_video_formats
They also seem to be the same pixel aspect ratios used in digital PAL SD TV.
http://en.wikipedia.org/wiki/Standard-definition_television#Resolution
Now didn't vampiredom post something about DVDs, digital TV and editing software all using the same standard?

For NTSC the PARs are always the same as those vampiredom posted so if NTSC discs do use straight 16:9 or 4:3 resizing the reason for it is something I'm still yet to learn.... maybe I'm just plain wrong about the way NTSC disc are resized.
I'm very tired at the moment though, I'll have to think about this some more tomorrow. In the meantime, comments anyone?

TheSkiller
26th November 2011, 19:13
Yes, as stated on the wiki page you linked, those are the official Rec.601 and "common digital" PARs. They differ in less than or about 1 pixel, it is actutally the 702<->704 issue (702 no typo). 702 because that is the very exact active image area in analog PAL. The "digital" PARs assumes 704 which is fine as well, since the difference is too small for any practical application (however 720 generic 4:3/16:9 resizing vs. PAR/ITU based resizing is).

See:

720 * 59/54 = 786.66
720 * 12/11 = 785.45

and

720 * 118/81 = 1048.88
720 * 16/11 = 1047.27

Nothing to worry about imo.

vampiredom
27th November 2011, 07:11
UPDATE: I added the text and examples to #4 (http://forum.doom9.org/showthread.php?p=1541002#post1541002) above.

They differ in less than or about 1 pixel, it is actutally the 702<->704 issue (702 no typo).

Yes, a negligible difference. The NTSC values, however, seem completely consistent here.

vampiredom
27th November 2011, 09:59
OK, it's pretty basic but it may be helpful (and avoid the hassle of having to look up the "standard" PARs.)

** EDIT: The GuessPAR() function is now a part of PARResizer.avsi ... see this thread (http://forum.doom9.org/showthread.php?t=163245).

The first parameter can be either a clip or a string in the format of "640x480", or "720x576", etc.

The second parameter, ws, specifies whether the widescreen PARs (ws=true) or standard 4:3 PARs (ws=false) should be assumed (since there is no way to automatically guess this).

GuessPAR() will return 1.0 if it cannot find a matching non-square pixel standard for the given dimensions.

Examples:

# load a widescreen .avi file
AviSource("MyFile.avi")
par = GuessPAR(last, ws=true)
Subtitle(String(par))

# Print an arbitrary PAR
BlankClip()
par = GuessPAR("704x480", false)
Subtitle(String(par))

hello_hello
27th November 2011, 11:08
Yes, as stated on the wiki page you linked, those are the official Rec.601 and "common digital" PARs.

Yeah but what about the info above the table?
"Note that sources differ on PARs for common formats – for example, 576 lines (PAL) displayed at 4:3 (DAR) corresponds to either PAR of 12:11 (if 704×576, SAR = 11:9), or a PAR of 16:15 (if 720×576, SAR = 5:4)."

That's what I'm still vague on, because both of those examples give you a PAR of exactly 4:3.
It seems to me most (PAL 4:3) DVDs use a PAR of 16:15 regardless of whether the extra 8 pixels each side contain image or not, but I'm still trying to understand this properly.

As a side note, a bit more browsing through the same wiki page led me to the sight below where they say the HDMI spec specifies an exact 4:3 or 16:9 aspect ratio and refers to the way anamorphic SD video is upscaled.
If it's true maybe it's another indication that exactly 16:9 and 4:3 are more standard than the official standards these days.
http://lurkertech.com/lg/video-systems/#pixelaspect_hdmi

Sharc
27th November 2011, 16:08
.....It seems to me most (PAL 4:3) DVDs use a PAR of 16:15 regardless of whether the extra 8 pixels each side contain image or not, but I'm still trying to understand this properly.

Well, one simply has to accept that anamorphic DVD's can use the Generic or ITU PAR (or a mod-16 compliant approximation of it).
My experience: The majority of those (older?) DVDs which have about 8 pixels borders left and right follow the ITU PAR. This is no proof however, as the picture could also have been scaled to accommodate overscan. Those DVD with an active picture width of 720 (no left and right borders) are likely to follow the generic PAR.
One can try to do the "circle test" to conclude on the PAR (unfortunately a reliable circle may not be readily found in the source), or one can try to 'reverse-engineer' the PAR starting from the Movie Aspect Ratio (like 2.39, 2.35, 1.85, 1.7778 etc. as indicated on the cover or found on imdb).
What the playback device eventually does with it is a totally different story. For example, my standalone plays ITU DVDs via HDMI including the black borders left and right as 4:3 or 16:9, means the active picture is in fact 2.5% too narrow, wheras my old DVD player using the SCART interface to an analog TV plays these DVDs undistorted ...

hello_hello
28th November 2011, 09:26
Well, one simply has to accept that anamorphic DVD's can use the Generic or ITU PAR (or a mod-16 compliant approximation of it).

I don't recall ever stating they couldn't.

My experience: The majority of those (older?) DVDs which have about 8 pixels borders left and right follow the ITU PAR. This is no proof however, as the picture could also have been scaled to accommodate overscan. Those DVD with an active picture width of 720 (no left and right borders) are likely to follow the generic PAR.

Well I won't argue about older DVDs, but I'd certainly agree regarding most newer DVDs, which is the point I was making originally. The PARs posted at the beginning of this thread are all well and good, but if the majority of DVDs don't actually use them.....

What the playback device eventually does with it is a totally different story. For example, my standalone plays ITU DVDs via HDMI including the black borders left and right as 4:3 or 16:9, means the active picture is in fact 2.5% too narrow, wheras my old DVD player using the SCART interface to an analog TV plays these DVDs undistorted ...

I guess unless you tend to use your older player more often, it's probably a good thing most DVDs aren't ITU.
If newer equipment seems more likely to use generic 16:9 & 4:3 aspect ratios, and newer DVDs seem far more likely to have used them also, what's the motivation for studios/DVD manufacturers to suddenly do an about-face which makes returning to the official standards for DVDs likely?
Personally I think when it comes to understanding the "official" way to resize a DVD it's nice to know... but when it comes to instructing people how to "properly" resize a DVD or determine PARs etc, it's really probably time to let it go. Or at least explain both methods.... the one which is supposed to be used, and the one which is more likely to be used.

Alex_ander
28th November 2011, 11:31
I'd say that document-wise, there is no such a universal thing as 'ITU PAR', since there are 3 different ITU documents in
use for different cases:

1. BT.601 - for video capture and broadcasting - that's where the so-called 'ITU PAR' come from
2. H.262 (mpeg2) - is believed* to be used by DVD (digital storage)
3. H.264

* The DVD specification itself is not a widely quoted document.

#2 ITU document says that a standard mpeg2 decoder maps all the stored samples (like 720x480) to the AR (4:3, 16:9 or 2.21:1, unless it's SAR=1:1 - 'square sample') written in file header. Any other proportions can be only obtained using optional sequence_display_extension. There's also an example of usage SDE for possibly providing BT.601 proportions. But in practice (some people at videohelp looked through their collections), SDE is only used with pan&scan (of the stored samples, 540x480 are mapped to 4:3 then). This might explain why many (if not most) DVD's don't actually follow #1 document.

#3 ITU document is quite different and the first one to explicitely define standard SAR's (standard name for 'PAR' - Sample Aspect Ratio) for H264 encoded files (their codes are written in file header). There are 16 recommended values and all of them are calculated from 704 rather than 720 (no 702, no 711 and the like). For 720 and 480 'horizontal overscan' is mentioned in the table. It is actually 720/704 linear correction in direct calculations from 'resolution+AR' numbers and can be easily applied instead of referencing to any tables (making them absolutely useless). This apparently applies to SD content on BD, but leaves a doubt about about mpeg2 BD content (can it still follow #2 document or not).

TheSkiller
28th November 2011, 13:14
Well I won't argue about older DVDs, but I'd certainly agree regarding most newer DVDs, which is the point I was making originally.
I agree with you that most (maybe even almost all) newer Hollywood film DVDs, for whatever reason, are using the non-ITU method (strictly talking about PAL discs here, don't know about NTSC ones), but it does not mean any new DVD is likely to do that because it also depends a lot on where the video originates from and what kind of "video" it is.
Footage that was shot with video cameras (in contrast to film cameras which requires a film->digital transfer) is much much more likely to follow ITU (yes, even today). In other words, footage that was shot to be viewed on a TV only, not in the cinema.
If you buy a DVD of a TV soap opera or something that was shot with SD(!) video cameras then you can be almost certain that it is following ITU, even if all 720 pixels of the DVD are filled (this is due to the fully digital recording and transfer to DVD). If it was shot using HD video cameras things depend on how it was downscaled, if all 720 pixels are containing picture then it is probably using non-ITU.
Of course, still, having all 720 pixels filled or not is not a fool proof method, but it's something to consider if you're willing to try and find out which one is correct.

mnm-a
24th December 2017, 23:52
To convert a square pixel image to a different PAR is easy. Divide the width by the PAR like such:

640x480 @ 10/11 PAR
640 / (10/11) = 704
704x480

The above example is rather simplistic. In many cases, when converting from square pixels, we'll want to scale the image overall. First we need to determine the scaling factor. To accomplish this, divide the source height by the target height:

SourceHeight / TargetHeight = ScalingFactor

1280x720 -> 704x480 @ 40/33 PAR
480 / 720 = 0.66666666666666666666666666666667

Sorry, AFAIU this has a mistake.
It should be

TargetHeight / SourceHeight = ScalingFactor

therube
3rd January 2018, 01:48
Yoda's Resize Calculator (http://www.mediafire.com/?09v9bldu9a6hm00)
At least with the calculator handy it's not necessary to remember a table of PARs.
Link looks to be 404?
Videohelp hosts, Yoda's Resize Calculator 0.3.5.11 (https://www.videohelp.com/software/Yodas-Resize-Calculator).

(For reference, the thread here at doom9, Yoda's Resize Calculator (https://forum.doom9.org/showthread.php?t=173635).)

hello_hello
6th January 2018, 03:08
Link looks to be 404?
Videohelp hosts, Yoda's Resize Calculator 0.3.5.11 (https://www.videohelp.com/software/Yodas-Resize-Calculator).

(For reference, the thread here at doom9, Yoda's Resize Calculator (https://forum.doom9.org/showthread.php?t=173635).)

I think the links for the newer version in that thread are dead, so here's a new one for version 0.4.0.1 (https://files.videohelp.com/u/210984/YodaResizeCalculator%200.4.0.1.zip).
I was never officially released, but it works fine and includes mpeg4 PARs as well as the old ITU PARs for NTSC and PAL. I'll see if I can get the VideoHelp page updated with the newer version at some stage, given Yoda has stopped development and the attachment in his post was never approved.
https://forum.doom9.org/showthread.php?p=1825751#post1825751

StainlessS
6th January 2018, 14:25
I think the links for the newer version in that thread are dead

No not dead, simply awaiting attention of a vigilant moderator to approve Yoda's attachment. [it might take some time] :devil:

hello_hello
7th January 2018, 16:45
No not dead, simply awaiting attention of a vigilant moderator to approve Yoda's attachment. [it might take some time] :devil:

Not to worry. The VideoHelp page has been updated with the newer version now.
https://www.videohelp.com/software/Yodas-Resize-Calculator

Logan9778
23rd April 2018, 23:11
Lol, here we go again.

THIS is what really helped me with BBC encodings (Doctor Who, The Young Ones, Fawlty Towers, etc.) I can't put it in enough posts.

BBC USES THEIR OWN UNIQUE SYSTEM!

Good that you mentioned BBC.

BBC used a different approach.

The digital frame sizes are 788 and 1050 respectively (PAR=1), for they include also what BBC calls blanking. The extra pixels are usually painted black.

Resize then to 788/1050 then cut the black borders and you'll end with some strange number of pixels but quadratic.