t_2
30th September 2005, 22:02
Here is a script for a blur effect and 2 blur transitions. IMHO for a rinky-dink script the effect really looks good, but see for yourself if you have an inkling.
"BoxBlur" is like VirtualDubs filter of the same name. It can give very high levels of blurring. Like the other transitions below the color space must be RGB.
"BlurIn" will start with a blurred image and gradually bring the first frames of a clip into focus over the number of frames designated by the variable "num_frames", which is 24 by default.
"BlurOut" does just the opposite. It gradually blurs the last frames of a clip over "num_frames". Default is 24.
"BlurAcross" is not implemented yet. It will blur clip a into clip b. You can do the same thing as follows:
a=AviSource("path/myclip_a.avi").ConvertToRGB24
b=AviSource("path/myclip_b.avi").ConvertToRGB24
v = a.BlurOut +b.BlurIn
Return v
"BlurInFromColor", "BlurOutFromColor", "BlurAcrossColor", are not implemented yet. They will work similarly except that the starting point, ending point, or center point of the transition respectively can be a color (black by default) which you determine.
OK, Here is the Script. Just copy it, save it as a text file under the name: "name.avsi" and put it in the AVISynth plugin folder to auto load it every time AVISynth is run. Remember all clips should be in RGB24 or RGB32 color space.
#######################################
function BoxBlur(clip c, float "radius", int "power", bool "diag")
{
power=default(power,1)
radius=default(radius,1.0)
diag=default(diag,false)
diag= (diag==false)?0:1
rmax_set=255.0
rwmax=c.width/10
rhmax=c.height/4
rmax= (rwmax <= rhmax) ? rwmax : rhmax
Assert(power>=1 && power<=3, """BoxBlur: "power" paramater must be between 0 and 3""")
Assert(radius>=1 && radius<=rmax_set, """BoxBlur: "radius" paramater must be between 1 and """+String(Int(rmax_set)))
Assert(diag>=0 && diag<=1, """BoxBlur: "diag" paramater must be "true" or "false"""")
radius=(((rmax-1)*(radius-1))/(rmax_set-1))+1
b=radius-1
b=b*b*b
b=b*1.57/rmax/rmax/rmax
width=Round(c.width/radius)
height=Round(c.height/radius)
Return(
\(power==1 && diag==0) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).BiCubicResize(c.width,c.height):
\(power==2 && diag==0) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).Blur(b).BiCubicResize(c.width,c.height):
\(power==3 && diag==0) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).Blur(b).Blur(b).BiCubicResize(c.width,c.height):
\(power==1 && diag==1) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).BiCubicResize(c.width,c.height).Subtitle( "w=" + String(width) + " h=" + String(height) + " blur=" + String(b) + " radius=" +String(radius)):
\(power==2 && diag==1) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).Blur(b).BiCubicResize(c.width,c.height).Subtitle( "w=" + String(width) + " h=" + String(height) + " blur=" + String(b))
\ : BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).Blur(b).Blur(b).BiCubicResize(c.width,c.height).Subtitle( "w=" + String(width) + " h=" + String(height) + " blur=" + String(b)))
}
function BlurOut(clip c, int "num_frames",bool "diag")
{
diag=default(diag,false)
num_frames=default(num_frames,24)
a=Trim(c,0,(c.framecount-num_frames-1))
b=Trim(c,(c.framecount-num_frames),0)
d=Animate(b,0,num_frames,"BoxBlur",1,3,diag,225,3,diag)
return a+d
}
function BlurIn(clip c, int "num_frames", bool "diag")
{
diag=default(diag,false)
num_frames=default(num_frames,24)
a=Trim(c,0,num_frames-1)
b=Trim(c,num_frames,0)
d=Animate(a,0,num_frames-1,"BoxBlur",225,3,diag,1,3,diag)
Return d+b
}
############################################
"BoxBlur" is like VirtualDubs filter of the same name. It can give very high levels of blurring. Like the other transitions below the color space must be RGB.
"BlurIn" will start with a blurred image and gradually bring the first frames of a clip into focus over the number of frames designated by the variable "num_frames", which is 24 by default.
"BlurOut" does just the opposite. It gradually blurs the last frames of a clip over "num_frames". Default is 24.
"BlurAcross" is not implemented yet. It will blur clip a into clip b. You can do the same thing as follows:
a=AviSource("path/myclip_a.avi").ConvertToRGB24
b=AviSource("path/myclip_b.avi").ConvertToRGB24
v = a.BlurOut +b.BlurIn
Return v
"BlurInFromColor", "BlurOutFromColor", "BlurAcrossColor", are not implemented yet. They will work similarly except that the starting point, ending point, or center point of the transition respectively can be a color (black by default) which you determine.
OK, Here is the Script. Just copy it, save it as a text file under the name: "name.avsi" and put it in the AVISynth plugin folder to auto load it every time AVISynth is run. Remember all clips should be in RGB24 or RGB32 color space.
#######################################
function BoxBlur(clip c, float "radius", int "power", bool "diag")
{
power=default(power,1)
radius=default(radius,1.0)
diag=default(diag,false)
diag= (diag==false)?0:1
rmax_set=255.0
rwmax=c.width/10
rhmax=c.height/4
rmax= (rwmax <= rhmax) ? rwmax : rhmax
Assert(power>=1 && power<=3, """BoxBlur: "power" paramater must be between 0 and 3""")
Assert(radius>=1 && radius<=rmax_set, """BoxBlur: "radius" paramater must be between 1 and """+String(Int(rmax_set)))
Assert(diag>=0 && diag<=1, """BoxBlur: "diag" paramater must be "true" or "false"""")
radius=(((rmax-1)*(radius-1))/(rmax_set-1))+1
b=radius-1
b=b*b*b
b=b*1.57/rmax/rmax/rmax
width=Round(c.width/radius)
height=Round(c.height/radius)
Return(
\(power==1 && diag==0) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).BiCubicResize(c.width,c.height):
\(power==2 && diag==0) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).Blur(b).BiCubicResize(c.width,c.height):
\(power==3 && diag==0) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).Blur(b).Blur(b).BiCubicResize(c.width,c.height):
\(power==1 && diag==1) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).BiCubicResize(c.width,c.height).Subtitle( "w=" + String(width) + " h=" + String(height) + " blur=" + String(b) + " radius=" +String(radius)):
\(power==2 && diag==1) ? BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).Blur(b).BiCubicResize(c.width,c.height).Subtitle( "w=" + String(width) + " h=" + String(height) + " blur=" + String(b))
\ : BiCubicResize(c,width,height).Blur(1.57).Crop(0,0,-2,0).Blur(b).Blur(b).BiCubicResize(c.width,c.height).Subtitle( "w=" + String(width) + " h=" + String(height) + " blur=" + String(b)))
}
function BlurOut(clip c, int "num_frames",bool "diag")
{
diag=default(diag,false)
num_frames=default(num_frames,24)
a=Trim(c,0,(c.framecount-num_frames-1))
b=Trim(c,(c.framecount-num_frames),0)
d=Animate(b,0,num_frames,"BoxBlur",1,3,diag,225,3,diag)
return a+d
}
function BlurIn(clip c, int "num_frames", bool "diag")
{
diag=default(diag,false)
num_frames=default(num_frames,24)
a=Trim(c,0,num_frames-1)
b=Trim(c,num_frames,0)
d=Animate(a,0,num_frames-1,"BoxBlur",225,3,diag,1,3,diag)
Return d+b
}
############################################