View Single Post
Old 11th January 2003, 18:16   #1  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Resolutions, Aspect Ratios And The ITU-R BT.601 Standard

Hi-

We often get questions from people with varying degrees of experience, about the three subjects in the title of this thread.

One kind of question might have to do with the appearance of the vob files as they are displayed in DVD2AVI or after the .d2v is opened in GKnot. Sometimes people want to just crop the black bars and encode the vob as is, or even encode without cropping at all. But as most of us know, the vobs show the video as it's stored on the DVD, which is not the correct Aspect Ratio. Your DVD player will resize it depending on whether the Display Aspect Ratio (DAR) of the DVD is 4:3 or 16:9. The easiest way to get the DAR is from DVD2AVI when it creates the .d2v. So, the video should be not only be cropped, but resized to proper AR as well.

When cropping and resizing in GKnot, make sure that you have the proper Input Resolution ticked (PAL or NTSC) and the proper Input Pixel Aspect Ratio ticked (default is 16:9). If you use the Auto Crop, be sure and scroll the .d2v afterwards to make sure it did it correctly and that the Aspect Error is low. Or you can tick Pixel Crop, crop the black bars, and then use Smart Crop Left-Right or Smart Crop All. Personally, I set the horizontal resolution I'm aiming for, and then, using the Pixel Crop only, crop the black bars on all sides, and if necessary, crop more on the left and right sides and sometimes from the top and bottom, in order to get the Aspect Error as low as possible. Although it's been said that the eye can't detect Aspect Error until it's above about 2% (when round things start to appear as slight ovals), it should be pretty easy to get it down below .5%. In addition, I'll always try to make all crop figures as even numbers. Afterwards it's usually a good idea to hit View-Resized on the .d2v picture and scroll around to make sure that the faces look normal, and that round things (balls, sun, moon, clocks, wheels, etc.) look round. GKnot doesn't always give you even number crop values. The reasons for the importance of all even numbers are explained by hakko504:

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

There are some restrictions on cropping in AviSynth:

In YUY2:
width mod-2
height no restriction if video is progressive
height mod-2 if video is interlaced

In YV12:
width mod-2
height mod-2 if video is progressive
height mod-4 if video is interlaced


Using other crop-values can create strange artifacts at the end of lines/frames. Crop(3,0,716,480), for example, is NOT acceptable as it means you have split a pixel pair! The values are stored in AVIsynth in pairs (or 2x2 matrixes in the case of YV12), and they should never be separated. The restrictions I mentioned are applicable to both the values you feed to Crop() using the above notation, as well as the final resolution.

The reason interlaced YV12 has mod-4 resolution is that it stores the chroma for line 2 and 4 in the same unit! The chroma for line 1 and 3 is also stored in the same unit.

Consider this, a small progressive picture of 4x4 pixels:
Code:
Luma:             Chroma
AABB              A B      
AABB
CCDD              C D
CCDD
A,B,C& D are pixels that share chroma data.
Now this wouldn't be so bad to cut in half right? But now consider an interlaced picture with the same dimensions:
Code:
Luma:             Chroma
AABB              A B      
CCDD
AABB              C D
CCDD
If you cut this in half, the two bottom lines disappear, and along with them the color information for line 2! Not good.

But lets say that you cut 1 pixel from each side in the 4x4 frame. That should work, right? No, not really, because then you would have to interpolate to get the new chroma value { (A+B)/2 }

This situation will never appear in RGB as every pixel has full data in all channels, but even here it is a good idea to make the fields have the same size, hence mod-2 on height. YUY2 on the other hand stores the data so two pixels next to each other shares the chroma data, and should therefore not be separated.
=============================================================================

We frequently get questions about not being able to hit the desired resolution. Instead of 640x272, you might wind up with 640x256, or 640x288. You have to remember that a 2.35:1 movie (for example) isn't usually exactly 2.35:1. As near as I can tell, it might be between about 2.20:1 and 2.40:1, so you aren't always guaranteed to get the resolution you desire. But if you have followed the previous steps correctly, and have gotten a low Aspect Error, then you have a proper Aspect Ratio, and that's the main thing. But if you used Smart Crop All (which crops from the top and bottom), you might try Smart Crop Left-Right (which crops as the name implies).

And one more thing. Many people insist on messing around with the W-Modul and H-Modul. I highly recommend leaving them at their default values of 32 and 16. There is a case that can be made for setting them both to 32 (better compressibility, although it limits the resolutions available to you). And you can probably get away with setting them both to 16 (but with less compatibility). But for both compressibility and compatibility reasons, you should not set either of them to 8 or lower. TheWEF explains the reasons for this:
=============================================================================

divx is encoded in macroblocks of 16 x 16 pixels.

e.g.:

640 x 272 = 174080 pixels = 680 macroblocks.

640 x 274 = 175360 pixels (0.7% more) = 720 macroblocks (5.9% more).

more macroblocks - more compression overhead.

for compressibility reasons i highly recommend to at least use w-mod and h-mod of 16 pixels.

w-mod 32 is recommended for playback compatibility on older gfx-cards.
=============================================================================

The main reason for this thread though, is to post a reply that TheWEF made recently on the subject of the Pixel Aspect Ratio (PAR) and the ITU-R BT.601 Standard. In the Options Tab of GKnot is an option to check in order to resize to the standard. We often get questions about whether or not to check the box. Here is what he has to say on the subject:
=============================================================================

with gknot you want to create divx-avi-computer-video. the correct pixel aspect ratio for this type of video is 1/1 (square pixels).

most video formats do NOT have square pixels, reasons are historic, most formats are of analog origin.

so we have to stretch the pixels to get correct aspect ratio in our avis.

but how do we know the pixel aspect ratio of the input format? - usually resolution is a good hint. following the link below you find "3. A Conversion Table for Digital Video Formats". every resolution has a certain pixel aspect ratio.

of course, with a computer, you can produce video with "any" resolution and PAR you like. so you could download an avi of 720x480 with a PAR of 1/1. someone just made it that way, it will not fit in the conversion table.
but if the source is any kind of standard video, like broadcast, dvd, vcd, svcd, vhs, hi-8, any capture.avi,...anything, the values in the table are correct.

example:
resolution on most ntsc-dvds is 720x480.
in the table you find 72/79 = 0.911 is the PAR for this resolution.

now there is one more thing: it's possible that a video is stretched even more in a certain standardized way called "anamorphic transfer". the PAR values you find in the table are for "non anamorphic transfer". if you want the anamophic PAR for a certain resolution you have to multiply the value with 4/3 = 1.333

example:
720x480 ntsc anamorphic
PAR = (72/79) x (4/3) = 1.215

in gknot you can always see the currently selected PAR right next to "other..." in the "Input Pixel Aspect Ratio" box.
if you open a video with a resolution of 720x480 gknot will automatically select ntsc anamorphic and you can read a PAR of 1.125

you can enter any PAR you like in the "other..." box. usually that doesn't make much sense. but if you press "select" you can select from all the common PARs in the table, anamorphic or not.

some capture cards use some strange half resolutions, e.g. a common one in the PAL world is "Halfe-D1" (360 x 576), half of 720x576.

example if you want to convert such a capture.avi to divx:
press "select", select "128/117 PAL (720x576),..." and check "double" - press "OK".
new PAR is (128/117) x 2 = 2.188


got all that? - ok.




gknots output PAR always is 1/1. but it's possible to convert to any output format you want, you just have to do some manual calculations.

example - you want to convert an ntsc-dvd-anamorphic to a pal-svcd-non anamorphic:
input res is 720x480 -> input PAR=(72/79) x (4/3)
outut res is 480x576 -> output PAR=(128/78)
in "other..." you enter (input PAR) / (output PAR) =
((72/79) x (4/3)) / (128/78) = 0.7405
move the slider to get a resolution width of 480 and save the avs.
you have to edit it manually and "AddBorders()" to get a output resolution hight of 576.
(read avisynth docs if you don't know how to do that)
then e.g. encode with tmpg...



now what's this ITU checkbox in gknot?

if you leave it checked gknot will simply follow the standards and use the PAR values from the table - highly recommended.
if you enter a custom PAR value in "other..." or use the "select" button the checkbox does not have an effect anyway.

so why uncheck it?

if you resize a full non anamorphic ntsc-dvd frame (720x480) to 640x... according to CORRECT standards you get 640x468 and that is NOT a display aspect ratio of 4/3.
if you watch it on your 4/3 computer monitor using a 4/3 desktop resolution (e.g. 640x480) the frame does NOT fill the screen.
when you watch the dvd with your software dvd player (e.g. powerdvd) the frame DOES fill the screen. why? because the programmers accepted a slight AR-error in order to avoid black bars in full screen. the players do it WRONG, but you can't see it because the difference, the AR-error, is too small. you could see the black bars though, so...
some people prefer to resize like the software dvd players do, so they uncheck itu.



it's quite hard to understand all the stuff you can read in the Quick Guide to Digital Video Resolution and Aspect Ratio Conversions. it's simply too much for most people. that's why doom9 still has the simple explanation in his Aspect Ratios Explained. it's an easy way to look at the problem and enough for most people.



wef.

Last edited by manono; 15th January 2003 at 19:19.
manono is offline