PDA

View Full Version : Special case of AR discussed


ulfschack
10th April 2003, 17:03
Hi all

Just wanted to share.

In the case of putting an avi (lets say a divX) on DVD, should the need ever arise, I have wrestled and made new calculations each time I make an encode over how addBorders and/or resize in order to maintain the same Aspect Ratio as the original (Divx) has, while still using 16:9 flag in the mpeg on a 4:3 TV. Yesterday I sat down and produced a formula which in the end turned out to be really simple (a lotta stuff cancelled out)

So if following is the case:

* A clip has the dimesions h x v, where h/v > 16/9 (i.e slimmer)
* Your final mpeg has the 16:9 flag set
* Your TV set is 4:3
* Your system is PAL (720 x 576)

then you might wanna do the following:

* h should be resized to 720
* v should be resized to 1024*v/h.
* The borders added (top/bottom) should be: 288-512*v/h each.

If it doesn't end up being 576 vertically just add a pixel or two when resizing or adding borders, but it might be a good idea to have the picture to be a multiple of two-to-the-power-of-the-highest-"something" (2, 4, 8 ...)

The clip should now have the same AR when playing on your standalone, save impact from overscan. If anyone is interested at all I could try to work out a formula for not doing any resizing at all and just pad it with borders, OR pad just enough for eliminating overscan issues, OR go for the next lower resolution 352x576. I find it pretty stimulating :)

cheers

PS Is this the right forum? I thought about it for a while, but ....

Wilbert
10th April 2003, 18:43
Good ...

Corrected for the ITU standard:

border=(576-(P*576)/AR)/2 for PAL

border=(480-(N*480)/AR)/2 for NTSC

with AR = h/v.

PAL: P = 4/3*59/54*720/576
NTSC: N = 4/3*10/11*720/480

ulfschack
11th April 2003, 00:20
Wilbert,

I ran your numbers on a 640x280 movie and ended up with borders being 58 pixels thick, while my formula yielded 64.

A backwards check using 64 does produce a move that occupies 315 of the total 576 scanlines in the vertiacal plan. the same as would happen to the vertical where you to resize the 640 to 720 proportionally.

Are you sure the 16:9 stretch is included in your formula.

Maybe I don't understand what "corrected to ITU standard" really means, while your "good..." tells me that I'm in some sense correct.

I never really did fully grasp the 704-720-760 relationship tho, so maybe that's it then (?) ... maybe the TV isn't 720 across, but the picture will have the same proportins whether it's a TV-out divx or a DVD stand-alone that is displayed ... in this manner

cheers

RB
11th April 2003, 09:15
There is free software that does all these calculations for you, and in the most exact manner. http://shh.dvdboard.de , get FitCD.

ulfschack
11th April 2003, 12:10
Looks to be a very competent program. I used the figures from my above example and it gave me the same result i.e 64 pixel wide borders. So I guess my formula is correct (and this was with the two boxes "anamorphic" (16:9) and "ITU .." checked.). In the horisontal plane he'd added 16 pixel borders to compensate for overscan, which would explain the ~2% error in aspect ratio he's getting (red text showing saying just that ... not my figure)

All in all though 1024*v/h is simple enough to memorize plus I don't need an additional app. I do of course recognize that FitCD has other qualities than just calculating my special special case, however I don't need them :)

cheers

Wilbert
11th April 2003, 14:08
Looks to be a very competent program. I used the figures from my above example and it gave me the same result i.e 64 pixel wide borders. So I guess my formula is correct (and this was with the two boxes "anamorphic" (16:9) and "ITU .." checked.).
It's not what I get with FitCD. My settings:

- source: 640x280, 1:1 monitor, PAL, ITU-R BT.601-4
- no crop
- resize to 720x460
- round to 4 MMX
- target: 720x576 DVD anamorphic

==> AddBorders(0,58,0,58)

about the 16:9 in my formulas, they are replaced by:
PAL: P = 4/3*59/54*720/576 = 1.8210
NTSC: N = 4/3*10/11*720/480 = 1.8182
while 16/9 = 1.7778

If you don't correct for ITU (this non-square pixel stuff), then your settings are correct. link: http://forum.doom9.org/showthread.php?s=&threadid=42708

ulfschack
11th April 2003, 15:28
How embarrasing ... I just took a screenshot to prove that I was not making stuff up. ITU, anamorphioc and PAL was indeed checked, but unfortunately I now saw that it applies to the source (didn't see the destination checkboxes) :(

Also pressing the "downarrow" somewhere in the middle was "part of the plot". It's really uncanny how that misstake came to show the exact same numbers I'd arrived at.

Anyhow, you were absolutely correct in your first post. My formula does only apply without ITU compliance (which I btw read in the help could actually help if left unchecked). My apologies.

Please see the screenshots that will explain better. (In "fitcd_err.gif" 640x280 was transformed to 720x576 when pressing the downarrow, something I "conveniantly" missed while focusing on the avisynth script)

RB
12th April 2003, 19:07
Are you sure you are using FitCD correctly? You need to click on that "Source" button with the little folder icon and load the AVI you are trying to resize, otherwise FitCD will not get the correct source parameters. Also I don't think ITU and anamorphic should be checked for an AVI source. Also always use the "accurate" cropping method or you will get slight aspect ratio errors.

ulfschack
14th April 2003, 09:47
Right the boxes for the source shouldn't be checked. The screenshoot is only there to explain how I managed to get some strange numbers to contradict wilbert's claims. (just so that he wouldn't think I was making stuff up :) )

The loading of the source tho, is only for those who dont know the original resolution (or wont go through the trouble of typing it in) It affects nothing more than if you just enter it manually.

I'm still not sure though, what the "downarrow" right next to "source" and "Film pixels" does. If it resets or what. Anyhow that arrow played a major part in getting those strange results mentioned in my third post.

Anyhow, my formula is dead simple and I'm still gonna use it even if it doesn't take ITU into account (a measly error of a percent or so)

cheers

RB
14th April 2003, 12:26
Originally posted by ulfschack
The loading of the source tho, is only for those who dont know the original resolution (or wont go through the trouble of typing it in) It affects nothing more than if you just enter it manually.


No, the source resolution boxes are greyed as you can see and cannot be typed in manually. You are likely mixing this up with "Film pixels" which is NOT the actual source resolution but the actual "motion area" minus black borders (if any). Even though the source may not have black borders, you need to load the source file. I talked about this with the author of FitCD a while ago and he said that unless you actually load the source file, results are not guaranteed to be accurate.

ulfschack
15th April 2003, 11:28
But for divx sources (that has no borders). The Source and "film pixels" are the same value since borders and cropping both are zero. He still always seem to add 16 pixels to the sides for overscan, which I think is a good default. I got your point though :)

It's a pity that while the resizing (lower part of the window) takes DVDs into account, the bitrate calculation window does not. It seems geared only towards VCD and SVCD (hence the name it take it :))

cheers

RB
15th April 2003, 12:29
Set "TV Overscan" (lower right) to 0 and it will stop adding borders.

If you need DVD bitrate calcs, donate a small amount and you'll get Fit2Disk (see his homepage), an extended version of FitCD, which also has a preview mode for detecting the actual film pixels. Highly recommended.

Blankman
16th April 2003, 18:35
Originally posted by ulfschack
But for divx sources (that has no borders). The Source and "film pixels" are the same value since borders and cropping both are zero. He still always seem to add 16 pixels to the sides for overscan, which I think is a good default. I got your point though :)


Interesting, I'll have to give that a try. I've been getting by on AVI -> NTSC SVCD by allowing my encoder to resize to 430x430 then centering.