View Full Version : Aspect Ratio trouble: AVS, CCE or DVD-lab?
ZenLord
8th November 2005, 00:42
Hello,
I tried to use the guide here as good as possible to convert an AVI to a PAL DVD using AviSynth, CCE trial and DVD-lab.
Everything works out beautifully, but I always (well, twice now) end up with a DVD with 'horizontally stretched' (or vertically squeezed) video, and I don't know where to start debugging:
1. it could be the AVS-script (fe I used: BicubicResize(720,304,0.333,0.333) and AddBorders(0, 136, 0, 136) on a source AVI that is 608x256 to make the DVD-stream PAL-compliant;
2. it could be a CCE-setting that I'm not aware of (I attached my CCE settings to this post), but basically I only changed the default template to VBR 2-pass, changed the min and avg bitrate and ticked off the 'audio'-tab. I also enabled 'close all GOPs' because DVD-lab complained about that one last time I tried.
3. It could be a DVD-lab setting, because when looking at the project properties, I can select different options for different situations (fe the 'widescreen movie display on 4:3' that I don't really understand)
4. It could be my primitive 4:3-television that displays my DVD incorrectly, but then again: it looks exactly the same on my PC-monitor, unless I enable the option 'scale to 16:9 TV' in MPC.
So in short: I don't know if I'm doing something wrong or not. The movie looks wrong, but maybe I'm using the wrong TV-settings... I read the aspect ratio-guide and several other 'related' guides and think I got it, but if something turns out wrong, you're not so confident anymore...
Help anyone? A link to an answer would be great! I tried to search Google and this forum, but I don't really know what to look for :(
Zl.
IvarssonW
8th November 2005, 10:23
I'm kind of a newbie but I believe you should do this:
BicubicResize(720,436,0.333,0.333)
AddBorders(0, 10, 0, 130)
Also encode this movie as 16:9 (an option in CCE Basic). I guess the same applies to CCE Trial.
ZenLord
8th November 2005, 11:20
One thing I'm afraid of is that I don't get the calculations needed to resize properly (according to the guide on the site). Could you plz tell me how you got those values? Remember it is PAL, so I should have 720x576 in the end. My calculation is:
720 / 608 = 1,18
256 * 1,18 = 303,16 (so rounded to nearest EVEN number gives 304)
576 - 304 = 272
272 / 2 = 136
I'm however not sure that this is the correct method to calculate the new resolution...
As to your other remark: I did encode my movie as a 16:9, but only forgot to mention that I had changed this option...
/EDIT: THX for your reply! I appreciate it very much!
ZenLord
8th November 2005, 13:41
I'm kind of a newbie but I believe you should do this:
BicubicResize(720,436,0.333,0.333)
THX to this site: http://81.98.148.105/03_Video_Only_Info/Pixel_Frame_Size_Totals.html I think I see where you get the number '436' - it corresponds with the Anamorphic 16:9 FAR -specs.
I can accept that number as a fact, but I don't get it. But hey: if you tell me to always use BicubicResize(720,436,0.333,0.333) for Anamorphic 16:9 content, then it's fine by me.
Hope to do some testing tonight with this.
Zl.
PS: I think your AddBorders(0, 10, 0, 130) is wrong: this way you will add a 10px border to the top and 130px to the bottom - hardly centered I guess ;). AddBorders(0, 70, 0, 70) would be more appropriate (from one newbie to another :p).
ZenLord
8th November 2005, 14:00
Hold the phone! :p
I think I am getting it (or at least the parts I need for my calculations):
Since my source is 608x256 (thus 2.38:1) and resolutions like 2.35:1 and 2.40:1 are considered 'anamorphic', I have to multiply the desired output with 16/9, thus:
720 x 16 / 9 = 1024
and
1024 / 2.38 = 430
So:
BicubicResize(720,430,0.333,0.333)
AddBorders(0, 72, 0, 74)
should do the trick! Correct or complete nonsense?
Zl.
IvarssonW
8th November 2005, 17:54
You got it! But the correct AR is probably 2,35:1 which is not always achieved because the xvid/divx sizes have to be dividable by 16 (I think). 1024/2,35 = 436.
Amnon82
8th November 2005, 20:25
@ZenLord: I hope not that in the zip is a 'tuned' Trialversion of CCE.
@All: Start reading our guides:
Unless your AVI already has the proper resolution and black bars, you'll first have to resize it, but to do that, you first need to know the resolution and aspect ratio of your movie.
As you should know by having read the aspect ratio article movies mostly have 3 aspect ratios: 1:1.33, 1:1.85 and 1:2.35 (GSpot inverses the two numbers in its display). As you can see on the left this particular movie has an aspect ratio of 1:2.35 (the 2.353 is much closer to 2.35 than 1.85 and 1.33).
http://www.doom9.org/images/gspot-goodar.gif
Now that you know aspect ratio and resolution, check this guide on how to write an AviSynth script to properly resize the video. You then have to add a few more lines to the script in case you're encoding subtitles as well:
LoadPlugin("c:\windows\system32\vobsub.dll")
avisource("moviename.avi")
BicubicResize(720,272)
AddBorders(0,104,0,104)
vobsub("subname")
ResampleAudio(44100)
Resizing AVIs for DVD encoding
There are two ways to do this, and proponents of both sides are religious about their way. There's the ITU way, and then there's the software DVD player way. All my guides are based on the latter (but of course we're doing the inverse step.. from DVD to AVI), so I'll stick to my guns. Ask the ITU fraction for their solution.
So let's start. Let's assume we're doing an NTSC DVD and our source has a resolution of 640x272. Our desired resolution is 720x480. As we can easily see, our AVI is too small:
http://www.doom9.org/mpg/images/frame1.gif
So what do we do? Diagonally stretch the video so that it fills the screen as shown below?
Good thought, but wrong. If you stretch the video like this, it will look okay when you encode it. But if you play the DVD, the video will look squeezed. But why?
http://www.doom9.org/mpg/images/frame2.gif
Because our playback resolution is not 720x480. Assuming we don't have an anamorphically squeezed AVI with a vertical resolution of 480, we'll create a 4:3 DVD. And the playback resolution of a 4:3 NTSC DVD is (480*4/3)x480 = 640x480 (more about DVD resolutions can be found here). So let's start over but this time we consider the playback resolution:
http://www.doom9.org/mpg/images/frame3.gif
The vertical playback resolution remains the same, but the movie has to look okay at playback resolution, or 640x480. Since our video is already 640 pixels horizontally, it fits perfectly into the playback window. All we have to do is add black bars to fill up the vertical space. We have to add 480 - 272 / 2 = 104 horizontal lines of black on top and bottom of our AVI.
In AviSynth lingo, we'd have to write the following:
AddBorders(0, 104, 0, 104)
Now, we have the perfect playback picture. However, our encoder expects a 720x480 picture. Well, that's no problem. Now we stretch the entire image horizontally to 720 pixels. It will look stretched that way, but that doesn't concern us because the player will do the inverse upon playback.
In AviSynth, add the following line to your script:
BicubicResize(720,480,0,0.5)
And that's it. Your script now has 3 lines:
AviSource("c:\movies\somemovie.avi")
AddBorders(0, 104, 0, 104)
BicubicResize(720,480,0,0.5)
http://www.doom9.org/mpg/images/frame4.gif
Okay, that was relatively easy. Now how about something more complex? Let's assume our source AVI has a resolution of 576x240. Let's see how this looks when compared to the playback resolution (that's right, let's not make the same mistake and worry about the encoding resolution):
What we have is the green rectangle, and what we need, is stretch the movie to full out the gray area as well. To stretch the movie horizontally to fill out the entire gray area, we have to stretch it by a factor of 640 / 576 = 1.11111
We of course also have to stretch the movie vertically by the same amount, which gives us a horizontal resolution of 240 * 1.111 = 266.6. Round this to the next even number, so 266. In script form, our stretching operation looks like this:
BicubicResize(640,266,0,0.5)
http://www.doom9.org/mpg/images/frame5.gif
Now remember, we're not done yet. The white area in the image above has to be filled with black bars. That can easily be done using the following script line:
AddBorders(0, 106, 0, 108)
And how did I get the number of black lines to be added? Remember that the vertical resolution of the stretched AVI is 266, and that the horizontal resolution of a DVD is 480. This means we have to add 480 - 266 / 2 = 107 lines of black on top and bottom of the image. However, 107 is an odd number, so let's pick two even numbers instead: Let's add 106 pixels of black on top, and 108 pixels of black at the bottom.
And we're still not done yet. Now we have to stretch the whole image to DVD resolution: 720x480.
As before, we can do this using the following line:
BicubicResize(720,480,0,0.5)
http://www.doom9.org/mpg/images/frame6.gif
Hmm, now you're wondering why we have two resizing lines. Can't we combine them? Indeed, we can. Instead of linearly zooming the source picture to fill our playback area horizontally, we can stretch it vertically to the proper size, and horizontally overstretch it to fit into our playback image as shown on the left (instead of zooming to the gray area we go for the gray + blue area). Thus, our first resize line would become:
BicubicResize(720,266,0,0.5)
Adding borders is still the same, so:
AddBorders(0, 106, 0, 108)
To recapitulate:
We have to stretch the source movie linearly so that it will look okay at the playback resolution (640x480 for NTSC). Then we have to add black borders to fill the image if it's not already filled after stretching (if your source is a 4:3 movie the area should be filled). Finally, we stretch our now properly looking movie to DVD resolution. During playback it will be unstretched again.
And here's the entire AviSynth script:
AviSource("c:\movies\somemovie.avi")
BicubicResize(720,266,0,0.5)
AddBorders(0, 106, 0, 108)
ZenLord
9th November 2005, 01:16
@ZenLord: I hope not that in the zip is a 'tuned' Trialversion of CCE.
@All: Start reading our guides:
1. THX for taking the time to c/p an entire guide in here...
2. I get the feeling that you didn't read my posts or that I did not express myself correctly: I have read THE guides on this site and have searched google to find some very interesting articles. But since it is far more complex than I thought it was, I posted my questions here. I am aware of the fact that probably most users here are toying around with aspect ratios as 10-year-olds with a kite, but to me it is not perfectly clear after reading quite a lot on the subject, and being a PC-enthousiast, I hate to be in the dark about something this interesting.
In other PC-related topics I am a lot more knowledgeable and I use that knowledge to help other people on other forums. Quite frankly I don't like the tone of your post towards me and 'all the rest'. No, I didn't include a 'tuned' version of CCE in my post, but only the exported settings of CCE I used to encode this source AVI I was talking about.
@ IvarssonW: THX for your replies: it was your post that helped me to find the answer to this question!
@ all: I am still having two questions:
1. I get the resizing for 2.35:1 - 1.78:1 and 1.33:1, but now only 1.85:1 remains unclear to me. The expected output should be somewhere around 720x560, but how do you calculate the '560'?
2. If I would like my DVD-player to recognize my output DVD as anamorphic, do I add the borders to get 720x576 or should my DVD-player add them dynamically? In this article (http://www.thedigitalbits.com/articles/anamorphic/index.html) I read the 'how' about anamorphic video, and would like my homemade DVD's to be in the best quality once I get a digital widescreen TV 'in a couple of years). So I would like to see my movies without the pads in full screen. If I add borders now, will they be removed by a digital widescreen TV or not?
THX!
Zl.
IvarssonW
9th November 2005, 09:04
@ ZenLord: For encoding a source with AR 1,85:1 to a DVD wouldn't want to resize to 576/(1,85/(16/9))=554 and add 23 in borders?
@ all: My understanding (which may be incorrect) is that you can calculate any resizing using the following formula:
PAL:
576/(Source AR/Target AR).
Be sure to use the correct AR for the source (anything close to 2,35 or 1,85 or 1,778 or 1,33 is these numbers. 608/256=2,375 would give 2,35 Source AR).
For instance my example above 576/(1,85/1,78)=554
NTSC:
480/(Source AR/Target AR).
For instance the example from Amnon82's post 576*240 on a 4:3 television which gives an AR of 2,40. The correct AR is actually 2,35 unless it is cropped vertically.
In my world this would give 480/(2,35/1,33)=272. Amnon82 has assumed that the correct AR is 2,40 hence the difference. (If you would use the 2,40 AR it would give 480/(2,40/1,33)=266.)
I think there is little need to follow the guide as it is quite confusing.
ZenLord
9th November 2005, 10:38
@ all: My understanding (which may be incorrect) is that you can calculate any resizing using the following formula:
Well, the math works out, and the way you calculate it looks logical... So it must be correct.
IMHO this formula can replace the whole guide (or should at least be appended to it)
THX alot, IvarssonW! You're not a newbie in my book (FWIW of course :p)!
Zl.
/EDIT: at this point I would like to understand JS, so I could make a simple calculator out of this formula. I do know PHP, but it would be more convenient to have a calculator like this working on the desktop... I'll look into this!
/EDIT2: what was I thinking? Of course someone has already done this before me: http://users.tpg.com.au/adslrotx/default.html (I haven't tested it yet, but will do so!)
/EDIT3 (last one): http://www.haku.co.uk/ARCT.html seems to do the job a little differently, but I think he knows this stuff better than I do...
Amnon82
9th November 2005, 13:04
I didn't read the guide to the end. (It wasn't mine and I only copy paste it here) Sorry to confuse you guys. The formular is right. I added a Borders formula:
Resize height = Target height/(Source AR/Target AR)
Borders = (Target height - resize height)/2
Border value must be even !!!
For instance IvarssonW's example above it will be:
576/(1,85/1,78)=554
(576-554)/2=11 (10/12)
AVISource("<Somepath>")
Bicubicresize(720,554)
AddBorders(0,10,00,12)
Encode it as 16:9.
The guide I posted creates a 4:3 AVS-Script.
Also I overflow your posts. The part 'Start reading our guides:' was a mistake by me.
I should start reading the posts (rightly).
Boulder
10th November 2005, 18:05
Uh.. why not use FitCD and let it do the math?
ZenLord
10th November 2005, 21:56
Uh.. why not use FitCD and let it do the math?
Interesting program, but the script it generates for me is:
# -= AviSynth v2.5.5.0 script by FitCD v1.2.8 =-
DirectShowSource("")
BicubicResize(688,320,0,0.6,3,0,602,256)
AddBorders(16,128,16,128)
#Trim(0,-1).FadeOut(150)
...and I cannot get it to use the full width of my DVD-movie (720)... Why is that? Is that a bug in the program (unlikely) or is there something I'm overlooking (much more likely)?
/EDIT: nevermind - found the overscan feature (don't understand why, but now I know where to turn it off). And seems I had 'anamorphic' ticked wrongfully on my source -> corrected now!
Zl.
PS: if it would have settings to do bitrate calculation for DVD, than it would come close to being the perfect program!
Boulder
11th November 2005, 07:28
The one that calculates avg bitrates for DVD is Fit2Disc but it's not free. There's a bunch of tools for that anyway.
Using overscan blocks can increase compressibility quite a bit. Your TV set doesn't show the whole video, it crops the image from all sides. My TV has over 24 pixels of overscan on the left and right and over 16px on top and bottom. When you use overscan, FitCD resizes the video so that more actual film pixels will be seen and the black borders will be cut off by the TV.
ZenLord
14th November 2005, 15:58
Using overscan blocks can increase compressibility quite a bit. Your TV set doesn't show the whole video, it crops the image from all sides. My TV has over 24 pixels of overscan on the left and right and over 16px on top and bottom.
Interesting! How did you find out about your TV? Is something like this mentioned in the specs of your TV, or is there a 'regulation' about it for all (PAL-)TV's, or do you have to test it out yourself? (please don't tell me you've been counting the visual pixels on your TV-screen :p)
Zl.
Boulder
14th November 2005, 16:31
It's based on my experiences. If I have had 24-pixel borders on the top and bottom, I've seen a small part of the borders when viewing the video on the TV. With 16-pixel borders I don't see any of them. On the left and right, 24-pixel borders don't show up.
Do a small test DVDRW with 8, 16 and 24 pixels of overscan - basically the same as 1, 2 and 3 blocks of overscan. Sometimes the 24-pixel borders are needed even if you use 2 blocks of overscan so that's why you should check that too. The biggest compressibility gain comes from 16-pixel borders.
Kika
14th November 2005, 17:52
If the Source is 608x256 with an AR of 2.35:1 and the target is PAL DVD non-anamorphic, resize to 704x320. If you want an anamorphic output, resize to 704x432. Where's the problem?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.