PDA

View Full Version : Problems when resizing to 220x176


n3wbi3
27th July 2005, 01:10
I want to resize any .avi to 220x176 (letterboxed), so they can be played back on my iRiver H340. This is the script I wrote:


function iRiver_Resize(clip temp_clip)
{
hor = 220.
ver = 176.

y = Height(temp_clip)
x = Width (temp_clip)

factor = x/hor

y = Floor(y/factor)

a = y%4
b = 4-a
y = y+b

border = Floor((ver-y)/2.)

hor = Floor(hor)

temp_clip = BilinearResize(temp_clip, hor, y).AddBorders(0, border, 0, border).ConvertToYV12.ChangeFPS(10)

return(temp_clip)
}

AVISource("Filename.avi").iRiver_Resize


The output has stripes (as in the attachment) and false colours in it. When resizing to 160x144 (both dividable by 16), the output looks good. If I AddBorders to match 220x176, it's looking crappy again.

I tried Bilinear-, Bicubic- and LanczosResize.

Is there a possibility to resize to resolutions that are closer to the desired one? Or is there a mistake in my script?

mg262
27th July 2005, 08:11
It sounds like you might be having the same problems with using xvid as a YV12 decoder that I did recently. To make sure, would you try this:

AVISource("Filename.avi").iRiver_Resize.converttoyuy2

At your target resolution?

Edit: by the way, you are stretching your clip vertically in the case when Floor(y/factor) is a multiple of four... (because b=4)... is this what you intend?

n3wbi3
27th July 2005, 09:33
I thought, it has to be dividable by 4, so I added it. But now it works without any stretching, thank you :)

:thanks:

mg262
27th July 2005, 09:41
So if this works:

AVISource("Filename.avi").iRiver_Resize.converttoyuy2

then the problem is that you are using XVid as a video decoder, and XVid can only cope with multiples of 8 as widths. If you install ffdshow (and possibly use its configuration panel to choose it as the YV12 decoder instead of xvid), the problem will go away.