Log in

View Full Version : Cropping for VDub


peppi_le_piou
13th February 2012, 08:28
If I have a widescreen letterbox film (with top/bottom matting), whose picture content is actually 2.35, I put it into GSpot which says that it has a resolution of 720x480 (which will include the matts).

In VDub I add a Resize filter and want to crop the clip to remove the matt. Using the X/Y co-ordinates I have -62 top and -66 bottom (keeping within the 16 multiple).

Now for the math. 480 - 128 = 352 pixels for the height.

To get the width do I multiply 2.35 x 352 which equals 827 and to keep within 16 multiple this would give me a choice of using 816 or 832 pixels wide (ie, 816x352 or 832x352) so, 2.32 or 2.36

Am I on the right track or is there some other way to do this?

I am aware that if I play this back on an 16:9 TV that the matting will be reinserted but to leave the content as close to 2.35 will retain best picture quality.

CWR03
13th February 2012, 09:34
to leave the content in true 2.35 will retain best picture quality.
Not if you're maintaining AR.

I crop away black borders (Sometimes there's a pixel or two of video that's distorted, so I can get rid of that too) and then add them back to the encode. This ensures the borders are absolute black and take no appreciable bitrate but the video maintains 16:9.

hello_hello
13th February 2012, 09:38
Yoda Resize Calculator (http://www.mediafire.com/?09v9bldu9a6hm00)

It lets you choose between ITU and non-ITU resizing for DVDs (I generally use the latter) and calculates the aspect ratio distortion so you can adjust the cropping to minimize it. In your example above you'd probably crop a few extra pixels from the sides before resizing to a width of 704, assuming the rest of the calculations are correct. I haven't used GSpot in a long time so I can't remember what it calculates.

I wouldn't take an aspect ratio of 2.35 (for example) as being 100% accurate, especially for DVDs. As the aspect ratio of the encoded video generally uses mod16 dimensions, and as you pointed out it generally doesn't give you an exact aspect ratio in relation to the original movie, the choices are to either distort the picture a little when you resize it or crop a little extra.

For DVD to AVI conversion I still use AutoGK as it re-sizes quite intelligently. It basically crops a little extra from the sides if necessary in order to fit the video into mod16 dimensions without distorting it, and it takes all the thinking out of it. Plus it tells you what the quality will be.

hello_hello
13th February 2012, 09:44
I crop away black borders (Sometimes there's a pixel or two of video that's distorted, so I can get rid of that too) and then add them back to the encode. This ensures the borders are absolute black and take no appreciable bitrate but the video maintains 16:9.

I assume you're referring to anamorphic encoding though? If so it'll probably confuse the issue.
In the OP's case, where he's converting to AVI, I'd assume he'd probably want to be sticking to square pixels.

peppi_le_piou
13th February 2012, 10:06
Yes, square pixels, and as I stated it will be 2.32 or 2.36 if what I am doing is correct.

peppi_le_piou
13th February 2012, 10:57
How can a person not use GSpot, and then to use Yoda one needs to know the source details and the pixel shape to get a final DAR. (ie SAR, PAR, DAR)

I tried putting my figures into Yoda.

If I was to use 816 as in my calc why does Yoda go red. Can't I go beyond 720? Are there some limitations applied?

Ghitulescu
13th February 2012, 11:51
Your approach is wrong from the beginning.
You should first render the DAR of the whole frame, then perform the cropping. Once you did them in reverse order you have already lost the PAR/DAR information.

hello_hello
13th February 2012, 13:37
How can a person not use GSpot, and then to use Yoda one needs to know the source details and the pixel shape to get a final DAR. (ie SAR, PAR, DAR)

I tried putting my figures into Yoda.

If I was to use 816 as in my calc why does Yoda go red. Can't I go beyond 720? Are there some limitations applied?

DVDs only have two aspect ratios (including any black bars). 4:3 and 16:9. You only need to know which it is and whether it's NTSC or PAL. The only other choice is whether to use ITU ("official") resizing. In my opinion most DVDs don't.

Using Yoda if your source is a DVD you select the appropriate type in the "Source" section (NTSC 4:3 or 16:9 etc) and whether to use ITU resizing or not (I usually don't). From there you add your cropping and find the nearest mod16 size. If you use the slider Yoda will adjust both the width and height together.

If either go red it's simply to let you know you're resizing "up" (after cropping), or in other words using more pixels than the original video. There's no reason why you can't, but standard practice is to resize "down" as most AVI capable DVD players have a width limit of 720 pixels. So basically rather than increasing the width in order to resize using square pixels, you're reducing the height instead. If you're using a PC or a Bluray player etc. for playback then it doesn't matter, but of course resizing "up" will increase the file size as well as the quality.

According to Yoda after cropping (62 and 66) your video has an aspect ratio of 2.42, not 2.35, so if you were to resize "up" then 848x352 would be close to the dimensions you'd want to use (that's with the "ITU Coeff" option NOT selected). If you crop an extra 2 pixels from each side, then 848x352 is about as close as you'll get to perfect, giving you only a 0.06% aspect error.

When resizing down, using your original cropping figures (62 and 66) and with the "use ITU-R...." option NOT selected, then according to the calculator 704x288 will only cause a 0.26% aspect ratio error if you increase the cropping by an extra 2 pixels top or bottom.
If you choose 720x304 then according to the calculator with the top and bottom cropping at 62 and 66, cropping 8 pixels from each side too will allow you to resize the video (to 720x304) with only a 0.08% aspect ratio error.
Either would be fine. 704x288 retains more picture but the resolution is slightly lower.

It's just a matter of playing around I guess, but hopefully I've explained it well enough. I just try to keep any aspect error to under 1% myself, but some people don't mind more. I think 2% is generally considered the maximum "acceptable" aspect error.

peppi_le_piou
16th February 2012, 23:39
@hello_hello, thanks, very helpful. If we don't stick to ITU standards will the standalone dvd player playback avi's ok?

hello_hello
17th February 2012, 05:59
Thanks for the thank you. It makes a nice change.... :)

Yes, the only difference between using ITU resizing and not using it is the way the video is resized before it's encoded. Non ITU resizing gives you exact 4:3 and 16:9 aspect ratios (before cropping). I think ITU resizing is around 2% wider. Once it's encoded as a square pixel AVI though it's just a square pixel AVI. There's not a huge difference between the two resize methods and unfortunately there's no way to know for certain which method was used, and I'm fairly sure some video has it's aspect ratio "fudged" a little during the process of being transferred to DVD anyway.

If you're really fussy (and you can preview an encode using either resize method) the only way to guess which method was used is to find a "straight on" shot of something round (a clock or a car wheel etc) and compare it using each resize method see see which way it looks "round".

For the record.... all PC software I know of uses straight 4:3 and 16:9 (non-ITU) resizing when playing DVDs. DVD players probably use ITU resizing with analogue connections, but I'm pretty sure the HDMI spec is non-ITU resizing, so it's a bit of a mess. At least where I am (PAL-land) non-ITU resizing seems to be the norm for most DVDs, unless they're fairly old. NTSC may be different, but I suspect not.

On a different note, if you're worried about DVD player compatibility there's also a possible issue of encoder settings and bitrate control to worry about. That's another reason I keep using AutoGK for converting DVDs to AVI. You just pick the desired width and type of audio and it does all the cropping, resizing, de-interlacing, IVTC etc without you needing to think about it too much, and it rarely gets it wrong. It also has a couple of hardware compatibility options. Using the "ESS" option pretty much guarantees 100% player compatibility. It also runs a compression test before encoding and reports the expected quality so you can adjust the file size if need be, or if you just pick a file size and leave everything in "auto" mode it'll adjust the resolution and audio type automatically to give you the best quality... and of course it'll also let you choose which resizing method to use. If you haven't tried AutoGK maybe consider giving it a spin.