View Full Version : not wide enough for 16:9
magic144
2nd December 2005, 07:30
hello
apologies for dumbness - this is my first post here
I have an .avi file (XviD) of 640x416, 25fps (1.538 aspect ratio)
I would like to try and use DGPulldown to construct an NTSC DVD equivalent of this file - as such, I need to generate a 25fps modified version of the original (same framerate, suitable frame size)
In particular, I would also like to have the end-product be anamorphically encoded (16:9)
I know the target size is 720x480 for NTSC, but I'm having trouble figuring out how to adjust the resizing (scaling)
I need to devise an .avs file to feed into CCE for encoding
Can somebody please explain to me (with calculation examples if possible!!) what combination of LanczosResize and/or Crop (and what else?) I will need to use to maintain the correct aspect ratio (in a 16:9 encode) in the mpeg2 output
I am having trouble figuring this out since the original source is not wide enough as is (i.e. it's not wider than 16:9)
can I
a) lose some top and bottom video (i.e. crop to get the aspect width)
or
b) do I have to encode 4:3?
thank you SO much in advance if you can help
magic144
2nd December 2005, 08:02
in fact, a nice formula for using in Lanczosresize/Crop/whatever-else
for a generic input .avi file of size
x * y
for either 4:3 or 16:9 target as 720*476 or 720*576 NTSC/PAL would be awesome!
if you can post here or give me a link - thanks again in advance if you have an idea
Mug Funky
2nd December 2005, 11:05
that ratio smacks of 14:9, special-for-TV aspect.
this is where a 16:9 master is cropped at the sides and letterboxed on the top and bottom to make something that's like widescreen but on a 4:3 screen. the idea is to minimize the black bar areas but preserve as much of the original composition as possible (i'm encoding some stuff like this right now - Midsomer Murders... don't know why they didn't send 16:9 masters as it was obviously shot that way. oh well).
in this case leave the height as is, and resize out to 704, then add borders to make 720x480.
encode as 4:3 - you'll keep more picture that way.
[edit]
in avisynth language, you should get something like this:
lanczosresize(704,last.height)
addborders(8,(480-last.height)/2,8,(480-last.height)/2)
this _should_ give you correct aspect and a nice NTSC frame with minimal loss.
magic144
2nd December 2005, 13:59
hi mug funky
thanks so much for your reply
you're right - it was a TV rip, so no doubt it is in this halfway-house ratio to "try" and satisfy both 4:3 and 16:9 TV owners
like I said, the original (4:3 TV DAR) file resolution is 640x416
from your formula above, by last.height do you mean 416 scaled up by the same amount as 640->702, i.e. 416*702/640 = 456???
and if I may ask, why use 702 and not 720?
I was really hoping to encode this anamorphically if at all possible since I own a large-screen 16:9 set and hate to watch anything stretched or with grey bars at the sides (that my TV inserts automatically)
is there an AVS file combo I could use to encode this anamorphically
(either to insert black bars - i.e. blank space - at the sides, or to crop a portion of the top and bottom and resize?)
I tried something like this (for the inserting blank at sides)
LanczosResize(622,480)
AddBorders(49,0,49,0)
but CCE doesn't recognize the input at all!
and it'd probably be better to lose a bit of top and bottom and get full width anyway...
help if you can - cheers!!!
SirCanealot
2nd December 2005, 14:16
Check if your TV has a 14:9 setting. The one in my room now does (32" Hitachi CRT), and it works basically perfectly for content like that (when it's on TV anyway). Then you just encode at 4:3 and set the TV to 14:9...
Of course, with this TV that means stretching the scanlines out a bit... which makes it look a little worse...
magic144
2nd December 2005, 14:20
nope it doesn't have 14:9 - I'm in North America where anything non-standard is just not catered for - try finding a TV in North America that will play a PAL signal!
I know I can encode at 4:3 no probs, but am still wondering what values I could use to encode at 16:9??! (accepting the fact that I'll either be adding black borders at the sides, or losing some top and bottom)
is this possible?
Didée
2nd December 2005, 14:39
You could try to cheat alittle ... some small cropping at the top & bottom, then use WarpedResize (from Tom Barry's SimpleResize plugin) to squeeze it to 16:9 ... something like
crop(0,8,-0,-8)
lanczosresize(1280,800)
WarpedResize(1280,720, 0.92,1.04))
Repair(last.sharpen(.6),last,1,2)
LanczosResize(704,480)
AddBorders(8,0,8,0)
This is quickly pulled out of the sleeve (not checked for correctness) to spit out anamorphic 16:9 content (NTSC). However something like "correct" aspect ratio here does not exist anymore ...
Play with the warping values (those last two numbers in the WarpedResize line), and see if you get something to your liking.
Mug Funky
2nd December 2005, 14:50
even numbers for yuy2 widths...
you can crop inside the resize commands, and it's quite extensible too (ie crop by a negative number - this will be the same as addborders, but you can do floating point precision).
try this:
lanczosresize(720,480,-103,0,853.3,416).letterbox(0,0,104,104)
there's a slight subpixel shift (like it matters) because NTSC doesn't perfectly do 16:9 width for 480 height (480*16/9 is a rational number, not a nice power-of-two integer like 576*16/9 is, and i didn't want to fill this post with maths)
i tested this with some crap i had lying around, and it looks right, so hopefully my calculations were correct.
i suggest trying both 4:3 and 16:9 modes and see which works best for you.
[edit] btw, if you want non-standard TV modes in the USA, either buy a pro monitor, or try ebay europe and see if any kind souls will ship overseas :)
Didée
2nd December 2005, 15:17
even numbers for yuy2 widths...
you can crop inside the resize commands, and it's quite extensible too (ie crop by a negative number - this will be the same as addborders, but you can do floating point precision).
try this:
By any chance, are you in a nagging mood? :)
Well, I could have also written that code as "compact" as
WarpedResize(Lanczosresize(1280,800,0,8,640,400),1280,720,0.92,1.04)
LanczosResize(Repair(sharpen(.6),last),704,480,-16,0,1316,720).letterbox(0,0,8,8) instead, but I thought writing discrete steps makes it easier to follow what's actually happening ... ;)
edit: corrected the mess :)
magic144
2nd December 2005, 15:29
cheers guys
I'll try the warped resize in a bit - want to try and keep things "in proportion" if poss!
funky,
lanczosresize(720,480,-103,0,853.3,416).letterbox(0,0,104,104)
this looks right on the screen - but one last thing, can you please explain where 104 comes from?? (I assume this is also what -103 is related to)
thanks again
magic144
2nd December 2005, 15:40
err,
think I see it now
640 + 2*104 = 848 which is nearly the 853.3 virtual source width we want to shrink to 720 for anamorphic widescreen
so wouldn't 106 be more correct? 640+2*106=852? I know it's a tiny difference, I'm just wondering :-)
magic144
2nd December 2005, 16:30
mmm,
I think the aspect is wrong though
I think this does the right thing... (with some top/bottom truncation)
correct me if I'm wrong:-
Crop(0,28,640,360)
Lanczosresize(720,480)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.