PDA

View Full Version : Can one add WHITE borders....


matrix
23rd October 2002, 02:40
Can the color of the borders added to a clip, be changed somehow?

I'd appreciate any answers

zettai
23rd October 2002, 03:06
Well, if I wanted to make my anamorphic footage 16:9 with white borders, I'd do....


top=AVISource("F:\thatothergirl\finalrenderrgb.avi").converttorgb32().bicubicresize(720,360)
bottom=blackness(Framecount(top),720,480).levels(0,1,255,255,255)
layer(bottom,top,y=(Height(bottom)-Height(top))/2)


To make a red border, for example, I'd do


top=AVISource("F:\thatothergirl\finalrenderrgb.avi").converttorgb32().bicubicresize(720,360)
bottom=blackness(Framecount(top),720,480).levels(0,1,255,1,255).rgbadjust(255,0,0,0)
layer(bottom,top,y=(Height(bottom)-Height(top))/2)


[edit - this was added:]

You have to make both clips the same format - my source was rgb24. For YUY2 you'd have to do:

top=AVISource("C:\youryuy2source.avi").bicubicresize(720,360)
bottom=blackness(Framecount(top),720,480).converttoyuy2().levels(0,1,255,255,255)
layer(bottom,top,y=(Height(bottom)-Height(top))/2)

or similar

matrix
23rd October 2002, 03:36
First, thanx for the quick answer.

What about the sides. Can it be done?

crow
23rd October 2002, 03:42
Wouldn't white borders raise the file size...?

matrix
23rd October 2002, 03:47
I don't mind about the size.

zettai
23rd October 2002, 03:48
ok, just realised that you can do it much easier than that with blankclip and choosing colour :) - and yes, this version will do the sides too, just cahnge outx and outy to whatver you want the final frame size to be and the rest will be worked out.

bordcolor=4294967295

outx=720
outy=480

top=AVISource("F:\thatothergirl\finalrenderrgb.avi")
bottom=blankclip(Framecount(top),outx,outy,color=bordcolor).ConvertToYUY2()
layer(bottom,top,x=(Width(bottom)-Width(top))/2,y=(Height(bottom)-Height(top))/2)

This will work for any input type that is smaller than the desired final framesize (if it isnt it will crop :))

I'm not sure how to thread the script to match the input source, so you'll just have to change the converttoyuy2() at the end of the "bottom" line yourself.

matrix
23rd October 2002, 03:59
Is this "bordcolor=4294967295" for white? Or what do the numbers represent?
Doesn't seem to do it.

zettai
23rd October 2002, 04:06
yes bordcolor=4294967295 is white.

the avisynth docs say that color should be a hexedecimal rgb value but when I tried FFFFFF it didnt work.

4294967295 is FFFFFF in decimal.

I'm using avisynth 2.06+ so it may be that your version of avisynth requires you to use FFFFFF for white. Give that a try.

matrix
23rd October 2002, 04:14
No, I don't know why, it adds borders, but black. In both cases.

I'm using 2.03 because of some problems I have with 2.06

zettai
23rd October 2002, 04:17
in that case you're just going to have to do it the old fashioned way :)

Use the script I posted first but use the "layer" line from the most recent script.

That should do it.

matrix
23rd October 2002, 04:49
OK. I got it.
I used this:
bordcolor=4294967295

outx=720
outy=480

top=AVISource("F:\thatothergirl\finalrenderrgb.avi")
bottom=blankclip(Framecount(top),outx,outy,color=bordcolor).ConvertToYUY2()
layer(bottom,top,x=(Width(bottom)-Width(top))/2,y=(Height(bottom)-Height(top))/2)

First time I changed outx and outy to 480,480. And my clip is 480,480, so it cropped it and couldn't see the borders.
Now I got it right.

Thanx a lot for your help.

SansGrip
24th October 2002, 01:43
Just wondering if it might not be quicker to generate your borders with BlankClip and then use StackVertical.

zettai
24th October 2002, 01:46
Perhaps, but you'd also have to do stack horizontal for left and right borders too. This way is quite neat and flexible.

matrix
24th October 2002, 02:22
Or you can do it like this too:

clip=AviSource("whatever")
BlankClip(length=547, width=480, height=480, fps=29.97, color=$FFFFFF)
Layer(clip.BicubicResize(430,430),"add",255, 25,25)