Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !

# Calculating letterbox in AVS

1. When converting an AVI of a widescreen source to make a standard DVD, it has to be letterboxed to fit in a standard 16:9 frame.

But I'm unsure if I'm doing it right.

For example:

AVI is 720x304 @ 25 fps.
So aspect ratio (assuming square pixels) is 720/304=2.37:1

I want to scale and letterbox to fit a PAL 720x576 16:9 (1.78:1) frame.

My logic is that the height needs to be scaled to 576 * (1.78/2.37) = 432
Then letterboxed to fill 576.

So I do
Code:
```LanczosResize(720,432)
This seems to look right -- circles are circles, for instance.

Is this correct; or is there a simpler way to work it out?
2. Use FitCD to give you a comparison point for the script values.
3. Originally Posted by guns1inger
Use FitCD to give you a comparison point for the script values.
Thanks.
The only way I can see to do that is to manually dial down the height in the "Resize" box till the destination "Real aspect" matches the source "Real aspect".
That gave me the slightly different result:

Code:
```LanczosResize(720,446,0,0,720,304)
Is that right?
It looks OK, if so, what is wrong with my previous calculation?
4. I wrote a small resize calculator tool a couple of years ago. It gives me 720 x 448 for PAL 16:9 based on your source (it doesn't produce an AVS script though - when I wrote it I was still using Virtualdub for resizing).

The issue with your calculation, I believe, is that you also have to convert your square pixel source to non-square pixels. There are four PARs, one for each of the possible outputs;

NTSC 4:3 - 10:11
NTSC 16:9 - 40:33
PAL 4:3 - 59:54
PAL 16:9 - 118:81

(source : http://www.mir.com/DMG/aspect.html#reftable)

FitCD (and my calculator as well) also does some adjusting to get to a Mod16 solution for encoder efficiency.

I have attached a copy of my tool to this post for comparison. It requires .net to run though. I will see if I can find the source code and if so, will post the calculations it uses.

avi_rc2.exe
5. I get the same as AlanHK's first calculation. If I turn off ITU resizing I get the same as guns1inger's calculation:

Of course:

LanczosResize(720,432,0,0,720,304)

Can be written as:

LanczosResize(720,432)
6. Originally Posted by AlanHK
So I do
Code:
```LanczosResize(720,432)
This seems to look right -- circles are circles, for instance.

Is this correct; or is there a simpler way to work it out?
This is correct (as already mentioned, without ITU's refinement for the horizontal size in pixels).

And yes, there's a simpler logic for calculations between those two AR's. The height of a letterboxed 16:9 image within a 4:3 frame is exactly 3/4 of its height in pixels. So with any video originally intended for displaying as 16:9 you can take 3/4 of PAL's 576 for height which is 432 (and mod16 at that), add complementary borders - and that's all you need to calculate. For width just use horizontal DVD number of the 4:3 frame and resize the original 16:9 (by DAR) image (which may be any pixel type) to those pixel numbers. If you want to make the horizontal size ITU compliant (702 is the border of a 4:3 PAL image after standard sampling), use 704 instead of 720 (with or without adding borders).

Code:
```LanczosResize(720,446,0,0,720,304)