16 Pixel Aspect Ratio

16.1 An introduction to Pixel Aspect Ratio (par)

Pixel Aspect Ratio (or PAR) is a term that is often used in digital video resizing and aspect ratio calculations. It denotes the ratio between vertical pixels and horizontal pixels, corrected for the aspect ratio of the video. Thus it is linked to the Image Aspect Ratio (or IAR) of a video, since IAR is the width-to-height ratio of a complete video frame. In short, the IAR tells you the shape of the video, while the PAR tells you the shape of the pixel distribution or pixel grid in it.

PAR = IAR * [vertical size] / [horizontal size]

The illustration below shows you four examples of PAR values. Each shows a square cut-out of a video in which the red dots represent the pixels. The white lines are drawn to clarify the shape of the pixel grid.

parA. PAR = 1.0. B. PAR = 1.0. C. PAR = 0.5. D. PAR = 2.0.

A PAR value of 2.0 indicates that there are twice as many vertical pixels as there are horizontal ones in a square area of the video. A PAR of 0.5 indicates the opposite. Note that both A and B have a PAR of 1.0. B has just twice the size of A both horizontally and vertically, but the ratio is the same. PAR is a ratio; it says nothing about the size. As long as you resize both horizontally and vertically with the same factor, the PAR will not be changed.

A PAR value of 1.0 is a special case: there are just as many horizontal as vertical pixels in a square video area; the pixel grid is square. This is also known as square pixel, a highly misleading term. Pixels are just a collection of numbers indicating brightness and color, and as such have no size or shape, and certainly not a square one. What the resulting picture looks like depends on how this information is interpreted by devices like DVD players, video cards and computer screens. Have a look at this document for more about this. Square pixel grid would have been a better name (and Pixel Grid Aspect Ratio while we are about it).

 

 

 

The PAR is particularly useful if you want to do vertical cropping (to crop away black pixels) before any filtering. In the main guide we discouraged this, but it is possible to do so with the use of PAR. The reason is that although resizing changes the size and the PAR, while cropping changes the size but NOT the PAR (see 16.5 for an illustration of this).

Using PAR values to calculate how to resize is a three step process:

16.2 Determining target PAR

Virtually all target PARs can be found on Jukka Aho's excellent site where you can simply look them up in a table. For clarity's sake, we shall calculate a few of them ourselves to demonstrate where these values come from. To determine PAR you need to know the Aspect Ratio of a video, and for that you need a reference. This reference can be found in ITU-R BT.470-6, which is explained more fully elsewhere in this guide. Briefly, it states that for PAL, a video signal of 52 µs wide and 576 lines high results in a picture with Aspect Ratio 4:3 when watched on a regular TV set. For NTSC, a video signal of 52.6555 µs wide and 486 lines high results in 4:3 aspect ratio. To get from this to size you need sample rates, as explained in chapter 5.2.

Example 1: square pixel:
As stated above, the most well-known PAR is that of regular computergraphics, square pixel. Suppose you have your screen size set to 1024x768. A regular computer screen has an aspect ratio of 4:3 or 1.3333; it is 33.33% wider than it is high. To calculate the PAR we have to correct for that to get the distribution in a square area. This is done by multiplying the vertical size with Aspect Ratio: 1.3333 * 768 = 1024. There are 1024 pixels both horizontally and vertically once you have corrected for the fact that the display is not square, which results in a PAR of 1024 / 1024 = 1.

Example 2: PAL DVD:
To determine the PAR of a PAL DVD, we first need to know the Image Aspect Ratio. From ITU-R BT.470-6 we know, that for PAL an active area of 52 µs x 576 lines results in a picture with 4:3 Aspect Ratio. A DVD has 720 pixels horizontally. From Jukka Aho's site we know that a DVD player has a sample rate of 13.5 MHz. This results in an active window width of 720 pixels / 13.5 MHz = 53.3333 µs. Vertically, 576 videolines are represented by 576 pixels; the height is not changed. This gives an Aspect Ratio of (4 / 3) * (53.333/52) = 1.3675. As you can see, the DVD window is not exactly 4:3, but a little bit wider. This results in a PAL DVD PAR value of 1.3675 * (576 / 720) = 1.094. (Exercise for the reader: do the same calculation for 704x576 PAL DVD and note this results in the same PAR.)

Example 3: NTSC DVD:
From ITU-R BT.470-6 we know, that for NTSC an active area of 52.666 µs x 486 lines results in a 4:3 picture. Again, a DVD has 720 pixels horizontally, which results in a window of 53.333 µs. But now, the number of lines is also different from the standard: a NTSC DVD has only 480 lines instead of 486. The NTSC DVD window is a bit wider and also a bit less high than 4:3. This results in the following Image Aspect Ratio: (4 / 3) * (53.3333/52.6555) / (480/486) = 1.3674. This results in a PAR of 1.3674 * 480 / 720 = 0.9116.

Example 4: NTSC VCD:
This format has a size of 352 x 240 and a sample rate of 6.75 MHz. So the video width is 352 pixels / 6.75 MHz = 52.148 µs. The height is 240 pixels, but these are played back to 480 lines. This brings us to an Image Aspect Ratio of (4 / 3) * (52.1481/52.6555) / (480/486) = 1.3370. The PAR is 1.3370 * 240 / 352 = 0.9116. Note that this is exactly the same PAR as for a NTSC DVD. Even though the size is lower, the shape of the pixel grid is the same.

As can be seen from the previous examples, Image Aspect Ratio is rarely exactly 4:3.

16.3 Determining source PAR

To determine your source PAR, you first have to know what the aspect ratio of the capture window of your capture device is. This capture window is fixed, but again it is rarely exactly 4:3. The device always digitizes the same area of your video and resizes it to the size you set in your capture application. The raw captured height is always 480 lines for NTSC and 576 for PAL. The width of the capture window has to be determined. A table with known values (and a more elaborate explanation) can be found in section 5.4. A method for determining this value yourself can be found in chapter 11.

Once you know the capture window width, the Image Aspect Ratio of your device can be calculated as:

PAL IAR = (4 / 3) * ([window width in µs] / 52.0 µs) / (576/576)
NTSC IAR = (4 / 3) * ([window width in µs] / 52.6555 µs) / (480/486)

This makes calculating your source PAR easy. Once you have determined the aspect ratio of the capture window of your specific device, you can write it down and you never have to do this again. Calculating PAR simply becomes multiplying this aspect ratio with the vertical size you set and dividing by the horizontal size:

PAR = IAR * [vertical size] / [horizontal size]

Example 1: BT878 with BTWincap drivers:
When capping a PAL signal, this combo has a capture window width of exactly 52 µs. This makes the Image Aspect Ratio of this device:

IAR = (4 / 3) * (52 µs / 52 µs) = 1.3333 = 4:3

This is exactly the PAL active window!

capture size PAR
768 x 576 1.3333 * 576 / 768 = 1.0 This is square pixel
720 x 576 1.3333 * 576 / 720 = 1.0666 This is PAL generic PAR
702 x 576 1.3333 * 576 / 702 = 1.0940 This is PAL DVD PAR
352 x 288 1.3333 * 288 / 352 = 1.0909 This is *not* PAL VCD PAR !
640 x 576 1.3333 * 576 / 640 = 1.1999 This is no special PAR in particular :)

As you can see, by selecting a certain capture resolution you can get different PAR values. 'Generic PAR ' refers to the PAR that results from capping at 720x576 using a device that has a capture window width that covers exactly the PAL active window of 52 µs. Since the DVD active window, 53.333 µs, is wider than the standard PAL window, capping like this would result in a smaller PAR value than the DVD PAR. Besides the BT878/BTWincap combo, few devices actually cap exactly this area. Most cap a bit more or a bit less. Also note that while capping at 702x576 would give you DVD PAR with this combo, some codec's will not work when you cap at a size that cannot be divided by 8 or 16, so you may have to cap at a different size and resize.

Example 2: Terratec Cinergy 400:
When capping a NTSC signal, this card has a capture window width of exactly 52.148 µs. This makes the Image Aspect Ratio of this device:

IAR = (4 / 3) * (52.148 µs / 52.6555 µs) / (480/486) = 1.3370

This is slightly wider than the standard NTSC active window.

capture size PAR  
704 x 480 1.3370 * 480 / 704 = 0.9116 This is NTSC DVD PAR
720 x 480 1.3370 * 480 / 720 = 0.8913  This is *not* NTSC DVD PAR
352 x 240 1.3370 * 240 / 352 = 0.9116 This is NTSC VCD PAR !
640 x 480 1.3370 * 480 / 640 = 1.0028 This is *not* square pixel

Example 3: ATI Radeon 8500 DV, Theater chip:
When capping a PAL signal, this card has a capture window width of 52.22 µs. So,

IAR = (4 / 3) * (52.22 µs / 52 µs) = 1.3390

capture size PAR  
768 x 576 1.3390 * 576 / 768 = 1.0043 This is square pixel
720 x 576 1.3390 * 576 / 720 = 1.0712 This is *not* PAL DVD PAR

Example 4: Nvidia with SAA7108 chip:
When capping a PAL signal, this card has a capture window width of 53.333 µs. So,

IAR = (4 / 3) * (53.333 µs / 52 µs) = 1.3675

capture size PAR  
720 x 576 1.3675 * 576 / 720 = 1.0940 This is PAL DVD PAR
704 x 576 1.3675 * 576 / 704 = 1.1189 This is no special PAR in particular :)

16.4 Resizing and cropping

Once you have the PAR values, two steps remain: first, resizing until you reach the target PAR. Second, crop of any excess pixels or pad if you have to few to get the target size. In these calculations, make sure you round the outcome to the nearest even number. In the following subsubsections, two possible cases are described.

16.4.1 You already know what vertical size you want, and you need to determine how to resize horizontally to get to the target PAR

Example 1: the Terratec NTSC capture at 720x480 above is converted to VCD:
source: 720x480, PAR = 0.8913
target: 352x240, PAR = 0.9116

1. determine target vertical size and divide by the source vertical size: 240/480 = 0.5
2. multiply the source horizontal size with (source PAR) / (target PAR): 720 * 0.8913 / 0.9116 = 704
3. multiply the number from step 2 with the number from step 1 and you get the target horizontal size: 0.5 * 704 = 352
4. crop / add pixels: not needed here, since 352 is already the target horizontal size

Thus, resizing the 720x480 capture to 352x240 results in a clip with correct VCD PAR.

Example 2: The BT878 / BTWincap driver combo PAL capture at 768x576 to SVCD:
source: 768x576, PAR = 1
target: 480x576, PAR = 1.6410

1. determine target vertical size and divide by the source vertical size: 576 / 576 = 1
2. multiply the source horizontal size with (source PAR) / (target PAR): 768 * 1 / 1.6410 = 468
3. multiply the number from step 2 with the number from step 1 and you get the target horizontal size: 1 * 468 = 468
4. crop / add pixels: add 12 pixels to get 480 horizontally

Thus, resizing 768x576 to 468x576 and padding to 480x576 results in a clip with correct SVCD PAR.

Example 3: ATI Radeon 8500 DV, Theater chip PAL capture at 720x576 to square pixel for DivX:
source: 720x576, PAR = 1.0712
target: 768x576, PAR = 1

1. determine target vertical size and divide by the source vertical size: 576 / 576 = 1
2. multiply the source horizontal size with (source PAR) / (target PAR): 720 * 1.0712 / 1 = 771.3
3. multiply the number from step 2 with the number from step 1 and you get the target horizontal size: 1 * 771.3 = 772
4. crop / add  pixels: crop 4 pixels to get 768 horizontally

Thus, resizing 720x576 to 772x576 and cropping to 768x576 results in a square pixel video.

Example 4: SAA7108 chip PAL capture at 720x576 to square pixel for DivX:
source: 720x576, PAR = 1.0940
target: 768x576, PAR = 1

1. determine target vertical size and divide by the source vertical size: 576 / 576 = 1
2. multiply the source horizontal size with (source PAR) / (target PAR): 720 * 1.0940 / 1 = 787.7
3. multiply the number from step 2 with the number from step 1 and you get the target horizontal size: 1 * 787.7 = 788
4. crop / add  pixels: crop 20 pixels to get 768 horizontally

Thus, resizing 720x576 to 788x576 and cropping to 768x576 results in a square pixel video.

16.4.2 You already know what horizontal size you want, and you need to determine how to resize vertically to get to the target PAR

Example 4: Terratec Cinergy 400 capture at 720x480 to VCD:
1. determine target horizontal size and divide by the source horizontal size: 352 / 720 = 0.4889
2. multiply the source vertical size with (target PAR) / (source PAR): 480 * 0.9116 / 0.8913 = 491
3. multiply the number from step 2 with the number from step 1 and you get the target vertical size: 491 * 0.4889 = 240
4. crop / add pixels: not needed here, since 240 is already the target vertical size

Thus, resize 720x480 to 352x240 for a NTSC VCD with correct PAR.

16.5 Some real analogue capping world examples

16.5.1 Cropping of all black borders before resizing

As stated in 17.1, cropping doesn't change the par. We start by two examples which show this:

Example 1a: capture followed by vertical crop:
This case is the easiest to understand. Suppose you capture at 720x576 with capture window w µs. The PAR is given by

par = (4 / 3) * (w µs / 52 µs) * 576/720

Vertically cropping of you capture with an amount y gives 720x(576-y), the par is given by

par = (4 / 3 * 576 / (576-y)) * (W µs / 52 µs) * (576-y)/720 = (4 / 3) * (w µs / 52 µs) * 576/720

Example 1b: capture followed by horizontal crop:
This case is a bit harder to understand. The point is that the horizontal crop is cancelled by a change in the capture window. The new capture width (after cropping) is given by

w2 = (720-y)/720 * w

and the par is given by

par = (4 / 3) * (w2 µs / 52 µs) * 576/(720-y) = (4 / 3) * ((720-y)/720 * w µs / 52 µs) * 576/(720-y) = (4 / 3) * (w µs / 52 µs) * 576/720

We will continue with a real analogue capping example, where the black borders (both horizontally and vertically) will be cropped before resizing.

Example2: cropping and resizing SAA7108 capture:

Suppose we have used the SAA7108 chip to capture PAL at 720x576. As stated in the introduction the capture window is 53.333 µs. By, inspection it turns out that for getting the picture without black borders we have to: crop 8 from the left, 80 from above, 22 from the right and 82 from below. The size of the picture becomes 690x414 after cropping. The PAR (of the source and the cropped clip) is given by

IAR = (4 / 3) * (53.333 µs / 52 µs) = 1.3675

PAR = 1.3675 * 576 / 720 = 1.0940

We want to make a XviD out of it which has a PAR of 1 and size 640x480.

1. determine target horizontal size and divide by the source horizontal size: 640 / 690 = 1.0435
2. multiply the source vertical size with (target  PAR) / (source PAR): 414 * 1 / 1.0940 = 378.4
3. multiply the number from step 2 with the number from step 1 and you have the target vertical size: 378.4 * 1.0435 = 396 (rounded to an even number)
4. crop / add  pixels: add black pixels to get 480 vertically

Thus, crop to 690x414 to get rid of the black borders, resize to 640x396, and add black pixels to get 640x480.

16.5.2 NTSC to PAL conversions

Suppose we have used the Terratec Cinergy 400 to capture an anime NTSC VHS tape and want to make a PAL DVD out of it. Obviously, the first step would be to IVTC to 24 frames per second. Look elsewhere in this guide to find out how and why to do that.

We start with a capture at 704x480 with PAR = 0.9116. There are 4 lines of junk at the bottom and 16 on the right which we crop of. Because we crop, the PAR is unchanged; we now have a source with 688x476, PAR = 0.9116. We don't mind padding horizontally, but we don't like to do it vertically (in our final clip, thus after resizing). So, our target width is 720 and the target PAR for a PAL DVD is 1.0940.

1. determine target horizontal size and divide by the source horizontal size: 720 / 688 = 1.0465
2. multiply the source vertical size with (target PAR) / (source PAR): 476 * 1.0940 / 0.9116 = 571.24
3. multiply the number from step 2 with the number from step 1 and you have the target vertical size: 571.24 * 1.0465 = 598
4. crop / add pixels: crop of 22 pixels vertically

So, crop to 688x476 to get rid of the VHS noise, resize to 720x598 and crop of 22 pixels to get 720x576.

On second thought, doing it this way we have lost some of our capture. Maybe it would be better not to resize horizontally, but to pad instead. We decide to keep the resolution at 688 horizontally instead and pad when we are done.

1. determine target horizontal size and divide by the source horizontal size: 688 / 688 = 1.0
2. multiply the source vertical size with (target PAR) / (source PAR): 476 * 1.0940 / 0.9116 = 571.24
3. multiply the number from step 2 with the number from step 1 and you have the target vertical size after rounding off to an even number 571.24 * 1.0 = 572
4. crop / add pixels: add black pixels to get 576 vertically

So, crop to 688x476 to get rid of the VHS noise, resize to 688x572, add black pixels to get 720x576 (or 704x576, which is also a valid DVD size).

References:
An analysis of sampling and filtering: About why a pixel is not a little square, but just a point sample.
Jukka Aho: A Quick Guide to Digital Video Resolution and Aspect Ratio Conversions
Der Karl's Capture Karten aspect ratio fuer Dummies: Der Karl's Capture Card Aspect Ratio for Dummies (in German).
Der Karl's Capture Cards aspect ratio for Dummies: Der Karl's Capture Card Aspect Ratio for Dummies (translated by Arachnotron).


Back to VirtualDub postprocessing

Back to AviSynth postprocessing

Back to the Index: HOME


Last edited on: 06/12/2004 | First release: n/a | Author: Version4Team | Content by doom9.org