View Full Version : Fade/Dissolve (like Womble MPEG Wizard)
Livesms
8th November 2006, 15:25
Is there any plugins for makeing transitions like in Womble MPEG Video Wizard.
Simple Dissolve if not so good as Womble's Fade (Left to Right / Right to Left)
For example (http://dump.ru/files/3/3128580425/fade.mpg) - this was made by WMVW.
I want such things in with AviSynth.
IanB
9th November 2006, 02:20
Avisynth provides FadeIn, FadeOut, FadeIO and Disolve native filters.
Many other effects can be created using Animate with layer or overlay....
Global GlobClip=Last
...
Animate(1000, 1100, "DoIt", 0, 100)
...
# Slide GlobClip in from bottom right corner
Function DoIt(Clip clip, Int I) {
clip
Fx=Round(Width() * (100-I)/100.0)
Fy=Round(Height() * (100-I)/100.0)
Layer(GlobClip, "Add", X=Fx, Y=Fy)
Return Last
}
Livesms
9th November 2006, 07:12
Avisynth provides FadeIn, FadeOut, FadeIO and Disolve native filters.
Many other effects can be created using Animate with layer or overlay....
Global GlobClip=Last
...
Animate(1000, 1100, "DoIt", 0, 100)
...
# Slide GlobClip in from bottom right corner
Function DoIt(Clip clip, Int I) {
clip
Fx=Round(Width() * (100-I)/100.0)
Fy=Round(Height() * (100-I)/100.0)
Layer(GlobClip, "Add", X=Fx, Y=Fy)
Return Last
}
Thank you, but it is not really what I want
I want filter for such transition
http://dump.ru/files/2/2401844729/Left2Right1.gif
IanB
9th November 2006, 08:05
Okay, so effectivly you want to slide an alpha channel mask across the images, but the images don't move. They slide blend across.
1st you need a mask image 3 times wider than your image, left is all black (full transparent), center ramps from black to white, right is all white (full opaque). Starting with a 5 pixel wide image (2 black, 1 grey, 2 white) BilinearResize it up to the right size should give the right effect. Use a variant of the Animate code above to make a clip that has the slide effect. ___ white
/
/
___/ black
| | -> slideUsing the 3 clip form of Overlay should then be a no brainer.
I'll knock up a suitable script when I get home if you like the sound of this.
Livesms
9th November 2006, 08:08
Okay, so effectivly you want to slide an alpha channel mask across the images, but the images don't move. They slide blend across.
1st you need a mask image 3 times wider than your image, left is all black (full transparent), center ramps from black to white, right is all white (full opaque). Starting with a 5 pixel wide image (2 black, 1 grey, 2 white) BilinearResize it up to the right size should give the right effect. Use a variant of the Animate code above to make a clip that has the slide effect. ___ white
/
/
___/ black
| | -> slideUsing the 3 clip form of Overlay should then be a no brainer.
I'll knock up a suitable script when I get home if you like the sound of this.
I'm not a good avs script writer - so I'll be waiting for your script :)
Wilbert
9th November 2006, 16:28
For example:
# move mask from left to right and use it for c1/c2
Function DoIt(clip clip1, clip clip2, clip maskc, int I) {
# I runs from 0 to 2*384
maskc2 = maskc.Crop(I, 0, 384, 288)
Overlay(clip1, clip2, mask=maskc2, X=0, Y=0, mode="blend", opacity=1)
}
c1 = ImageSource("D:\Captures\Slider\DanielaPestova.jpg").Loop(0, 400) # 384x288
c2 = ImageSource("D:\Captures\Slider\AngelicaBridges.jpg").BicubicResize(384, 288).Loop(0, 400)
b1 = BlankClip(width=2, height=288, color=$000000)
b2 = BlankClip(width=1, height=288, color=$808080)
b3 = BlankClip(width=2, height=288, color=$FFFFFF)
#maskc = StackHorizontal(b1, b2, b3).BicubicResize(384, 288)
maskc = StackHorizontal(b1, b2, b3).BicubicResize(3*384, 288)
# I runs from 0 to 2*384
# I = 384
# DoIt(c1, c2, maskc, I)
Animate(100, 300, "DoIt", c1, c2, maskc, 0, c1, c2, maskc, 2*c1.width)
Make sure that c1 and c2 are of the same size, and maskc should be of the same height as c1 and c2.
Nice example for the docs, thx very much!
Livesms
9th November 2006, 20:09
For example:
# move mask from left to right and use it for c1/c2
Function DoIt(clip clip1, clip clip2, clip maskc, int I) {
# I runs from 0 to 2*384
maskc2 = maskc.Crop(I, 0, 384, 288)
Overlay(clip1, clip2, mask=maskc2, X=0, Y=0, mode="blend", opacity=1)
}
c1 = ImageSource("D:\Captures\Slider\DanielaPestova.jpg").Loop(0, 400) # 384x288
c2 = ImageSource("D:\Captures\Slider\AngelicaBridges.jpg").BicubicResize(384, 288).Loop(0, 400)
b1 = BlankClip(width=2, height=288, color=$000000)
b2 = BlankClip(width=1, height=288, color=$808080)
b3 = BlankClip(width=2, height=288, color=$FFFFFF)
#maskc = StackHorizontal(b1, b2, b3).BicubicResize(384, 288)
maskc = StackHorizontal(b1, b2, b3).BicubicResize(3*384, 288)
# I runs from 0 to 2*384
# I = 384
# DoIt(c1, c2, maskc, I)
Animate(100, 300, "DoIt", c1, c2, maskc, 0, c1, c2, maskc, 2*c1.width)
Make sure that c1 and c2 are of the same size, and maskc should be of the same height as c1 and c2.
Nice example for the docs, thx very much!
Ok! It is much closer to what I want :)
Is it possible to make script more general - it has srtaight width/height (384/288).
Is it possible to make the only function with 2 input clips and maybe overlap and get result of 2 clip crossfaded.
PS: And what about audio :) - Is it possible to use simple Dissolve to crassfade audio only?
foxyshadis
9th November 2006, 23:04
Replace all references to 384 by width(), and all to 288 be height(), and you're pretty much there. (You may need to qualify it if you have no implicit last.) Then replace the 100 and 300 in animate by startframe and endframe, make them parameters to a function, and you're done.
IanB
10th November 2006, 00:07
@Livesms, Learning AVS script is easy, just start with some rough house script thats does something a bit like what you want and start changing it. Start by changing the numbers that effect shape and size, then as confidence grows change the structure. After a while you realise hard code numbers are gross and you parameterise your scripts for quick adaption next time.
And yes dissolve will do the audio crossfade very nicely. Just do an AudioDub(Dissolve(.....)) to graft in the tweaked audio track.
@Wilbert, nice throw together from a very rough idea. ;)
@All, Here's my rendering from half an hours tinkering.
Points of interest :-
Using crop to slide the mask was not granular enough, so I used the subpixel element of the resizers.
I needed some extra width for the higher order resizers. So I upped it to an 8 pixel prototype, then used a 2 pixel scan window. (Gunna have to fix up this for 2.6 Grrr)
I dropped the center grey pixel, it causes an unpleasant ledge in the middle of the slope.
I tried all the resizers. As an aside it is interesting to see the various ringing and artifacts with such a hugh upscale when you stack them together for relative viewing.
Changing the 2.0 scan window on the resizers has some interesting effects.
I found the Gauss resizer gave the nicest ramp for the effect. Adjusting P together with the scan window (2.0) gives many nice variations to the apperance of the effect.
For some reason the bilinear resizer generated mask sometimes gots a bright bump in the trailing plataue. :confused:
Global Hi=480
Global Wi=720
Global T=25
A=BlankClip(T+1, 4, Hi, pixel_type="RGB32", color=$000000)
C=BlankClip(T+1, 4, Hi, pixel_type="RGB32", color=$ffffff)
StackHorizontal(A, C)
Animate(0, T, "TryIt", 1.5, 4.5) # Dodge the edge conditions
Function TryIt(clip C, Float X) {
# A = C.PointResize(Wi, Hi, X, 0, 2.0, 0)
# B = C.BiLinearResize(Wi, Hi, X, 0, 1.0, 0)
# D = C.BiCubicResize(Wi, Hi, 1./3, 1./3, X, 0, 2.0, 0)
# E = C.Spline16Resize(Wi, Hi, X, 0, 2.0, 0)
# F = C.LanczosResize(Wi, Hi, X, 0, 2.0, 0)
# G = C.Spline36Resize(Wi, Hi, X, 0, 2.0, 0)
# H = C.Lanczos4Resize(Wi, Hi, X, 0, 2.0, 0)
# I = C.GaussResize(Wi, Hi, X, 0, 2.0, 0, P=10)
# J = C.GaussResize(Wi, Hi, X, 0, 2.0, 0, P=30)
K = C.GaussResize(Wi, Hi, X, 0, 2.0, 0, P=50)
Return K
# Return StackVertical(A, B, D, E, F, G, H, I, J, K)
}
X=BlankClip(300, Wi, Hi, pixel_type="RGB32", color=$E02020).\
Subtitle("< < < Red. > > >", align=5, size=90, text_color=$00DF00)
Y=BlankClip(300, Wi, Hi, pixel_type="RGB32", color=$2020E0).\
Subtitle("< < < Blue > > >", align=5, size=90, text_color=$DF00DF)
Fx=FrameCount(X)
Fy=FrameCount(Y)
Trim(X, 0, Fx-T-2) + \
Overlay(Trim(X, Fx-T-1, 0), Trim(Y, 0, T), mask=last, pc_range=True)
\ + Trim(Y, T+1, 0)
Livesms
13th November 2006, 18:31
Global Hi=480
Global Wi=720
....
And what about left to right one?
Is it possible to combine all code to one compact function without global width/height and other stuff. Input clips and time for transition will be declared for function and 2 clips merged with transition will be returned.
IanB
14th November 2006, 01:31
Left to right, easy swap the black and white prototype clips (A & C) and animate the other way i.e. 4.5 -> 1.5! Up and down is just as easy, use a StackVertical and buzz the vertical crop parameters of the resizer instead of the horizontal .
Compact function, with parameters, very do-able. The structure of the script reflects how I wrote it. I first threw together the sliding mask clip without any reference to a supplied clip, hence the Hi and Wi. In a practicle script I would have used Height(clip) and Width(clip) and the X and Y would have been real loaded from real files not coloured BlankClips with text.
As I said hack the rough scripts Wilbert and I composed and build them into something more flexible and polished. You can't break anything, worst that happens is you get a script that doesn't quite do what you want. So you modify it some more.
If you make a genuine effort to put together and polish a general script I will help you.
Livesms
14th November 2006, 07:22
Left to right, easy swap the black and white prototype clips (A & C) and animate the other way i.e. 4.5 -> 1.5! Up and down is just as easy, use a StackVertical and buzz the vertical crop parameters of the resizer instead of the horizontal .
Compact function, with parameters, very do-able. The structure of the script reflects how I wrote it. I first threw together the sliding mask clip without any reference to a supplied clip, hence the Hi and Wi. In a practicle script I would have used Height(clip) and Width(clip) and the X and Y would have been real loaded from real files not coloured BlankClips with text.
As I said hack the rough scripts Wilbert and I composed and build them into something more flexible and polished. You can't break anything, worst that happens is you get a script that doesn't quite do what you want. So you modify it some more.
If you make a genuine effort to put together and polish a general script I will help you.
OK - I'll try
zemog
15th November 2006, 16:48
Livesms
I use AviSynth from some time ago to edit and improve my domestic videos but I never made any function (I am only a software advanced user). Reading this threat and thinking these kind of dissolves would be also useful for me , I guessed it’d be a good exercise to make my first function trying to do something as IamB suggests you.
From the IamB code in his post of 10th November 2006 and using the fantastic qwerpoi AviSynth editor AvsP and after working for some hours, here is the result:
# DissolveAGG(clip A, clip B, Int "TFrames", String "Mode")
# Tframes define the number of overlapped frames
# Four modes are possible: LeftToRight, RightToLeft, TopToBotoom and
# BotoomToTop depending where the overlapping stars and ends.
Function DissolveAGG(clip A, clip B, Int "TFrames", String "Mode") {
Global Hi = Height(A)
Global Wi = Width(A)
Global FS = Framerate(A)
Global Fa=FrameCount(A)
Global Fb=FrameCount(B)
Global TFrames = Default(TFrames, 25)
Mode = Default(Mode, "LeftToRight")
(Mode=="LeftToRight") ? LToR(A, B) :\
(Mode=="RightToLeft") ? RToL(A, B) :\
(Mode=="TopToBottom") ? TToB(A, B) :\
BToT(A, B)
Function H(clip C, Float X) {
K = C.GaussResize(Wi, Hi, X, 0, 2.0, 0, P=50)
Return K
}
Function V(clip C, Float X) {
K = C.GaussResize(Wi, Hi, 0, X, 0, 2.0, P=40)
Return K
}
Function LToR(clip A, clip B) {
AA=BlankClip(TFrames+1, 4, Hi, pixel_type="RGB32", fps=FS, color=$000000)
BB=BlankClip(TFrames+1, 4, Hi, pixel_type="RGB32", fps=FS, color=$ffffff)
D=StackHorizontal(AA, BB)
Xi=4.5
Xf=1.5
E=D.Animate(0, TFrames, "H", Xi, Xf)
Return Trim(A, 0, Fa-TFrames-2) + Overlay( Trim(B, 0, TFrames), Trim(A, Fa-TFrames-1, \
0),mask=E, pc_range=True) + Trim(B, TFrames+1, 0)
}
Function RToL(clip A, clip B) {
AA=BlankClip(TFrames+1, 4, Hi, pixel_type="RGB32", fps=FS, color=$000000)
BB=BlankClip(TFrames+1, 4, Hi, pixel_type="RGB32", fps=FS, color=$ffffff)
D=StackHorizontal(AA, BB)
Xi=1.5
Xf=4.5
E=D.Animate(0, TFrames, "H", Xi, Xf)
Return Trim(A, 0, Fa-TFrames-2) + Overlay(Trim(A, Fa-TFrames-1, 0), Trim(B, 0, TFrames), \
mask=E, pc_range=True) + Trim(B, TFrames+1, 0)
}
Function TToB(clip A, clip B) {
AA=BlankClip(TFrames+1, Wi, 6, pixel_type="RGB32", fps=FS, color=$000000)
BB=BlankClip(TFrames+1, Wi, 6, pixel_type="RGB32", fps=FS, color=$ffffff)
D=StackVertical(AA, BB)
Xi=6.5
Xf=3.5
E=D.Animate(0, TFrames, "V", Xi, Xf)
Return Trim(A, 0, Fa-TFrames-2) + Overlay( Trim(B, 0, TFrames), Trim(A, Fa-TFrames-1, \
0),mask=E, pc_range=True) + Trim(B, TFrames+1, 0)
}
Function BToT(clip A, clip B) {
AA=BlankClip(TFrames+1, Wi, 6, pixel_type="RGB32", fps=FS, color=$000000)
BB=BlankClip(TFrames+1, Wi, 6, pixel_type="RGB32", fps=FS, color=$ffffff)
D=StackVertical(AA, BB)
Xi=3.5
Xf=6.5
E=D.Animate(0, TFrames, "V", Xi, Xf)
Return Trim(A, 0, Fa-TFrames-2) + Overlay(Trim(A, Fa-TFrames-1, 0), Trim(B, 0, TFrames), \
mask=E, pc_range=True) + Trim(B, TFrames+1, 0)
}
}
It works fine for me except I didn’t be capable to validate Mode parameter. Try it and let me know your opinion or your alternative if you have done one.
At any rate I am sure the syntax of my function could be improve a lot. So perhaps somebody here can post constructive criticism or some suggestion that can help us to do these better.
Livesms
15th November 2006, 17:05
It works fine for me except I didn’t be capable to validate Mode parameter. Try it and let me know your opinion or your alternative if you have done one.
At any rate I am sure the syntax of my function could be improve a lot. So perhaps somebody here can post constructive criticism or some suggestion that can help us to do these better.
:) You have done a great job :):):)
FrSp, I have no time to do this....
Now I have no willing to do the same job myself :)
I just add audio processing - Dissolve for each of function (lToR, RToL, BToT, TToB) and left LToR by default even when I set " " for method :), cause you leave BToT as default for error input string :) I prefer LToR
Function DissolveAGG(clip A, clip B, Int "TFrames", String "Mode") {
Global Aaudio = A
Global Baudio = B
Global Hi = Height(A)
Global Wi = Width(A)
Global FS = Framerate(A)
Global Fa=FrameCount(A)
Global Fb=FrameCount(B)
Global TFrames = Default(TFrames, 25)
Mode = Default(Mode, "LeftToRight")
(Mode=="LeftToRight") ? LToR(A, B) :\
(Mode=="RightToLeft") ? RToL(A, B) :\
(Mode=="TopToBottom") ? TToB(A, B) :\
(Mode=="BottomToTop") ? BToT(A, B) :\
LToR(A, B)
Function H(clip C, Float X) {
K = C.GaussResize(Wi, Hi, X, 0, 2.0, 0, P=50)
Return K
}
Function V(clip C, Float X) {
K = C.GaussResize(Wi, Hi, 0, X, 0, 2.0, P=40)
Return K
}
Function LToR(clip A, clip B) {
AA=BlankClip(TFrames+1, 4, Hi, pixel_type="RGB32", fps=FS, color=$000000)
BB=BlankClip(TFrames+1, 4, Hi, pixel_type="RGB32", fps=FS, color=$ffffff)
D=StackHorizontal(AA, BB)
Xi=4.5
Xf=1.5
E=D.Animate(0, TFrames, "H", Xi, Xf)
Return AudioDub(Trim(A, 0, Fa-TFrames-2) + Overlay( Trim(B, 0, TFrames), Trim(A, Fa-TFrames-1, \
0),mask=E, pc_range=True) + Trim(B, TFrames+1, 0), Dissolve(Aaudio, Baudio, TFrames))
}
Function RToL(clip A, clip B) {
AA=BlankClip(TFrames+1, 4, Hi, pixel_type="RGB32", fps=FS, color=$000000)
BB=BlankClip(TFrames+1, 4, Hi, pixel_type="RGB32", fps=FS, color=$ffffff)
D=StackHorizontal(AA, BB)
Xi=1.5
Xf=4.5
E=D.Animate(0, TFrames, "H", Xi, Xf)
Return AudioDub(Trim(A, 0, Fa-TFrames-2) + Overlay(Trim(A, Fa-TFrames-1, 0), Trim(B, 0, TFrames), \
mask=E, pc_range=True) + Trim(B, TFrames+1, 0), Dissolve(Aaudio, Baudio, TFrames))
}
Function TToB(clip A, clip B) {
AA=BlankClip(TFrames+1, Wi, 6, pixel_type="RGB32", fps=FS, color=$000000)
BB=BlankClip(TFrames+1, Wi, 6, pixel_type="RGB32", fps=FS, color=$ffffff)
D=StackVertical(AA, BB)
Xi=6.5
Xf=3.5
E=D.Animate(0, TFrames, "V", Xi, Xf)
Return AudioDub(Trim(A, 0, Fa-TFrames-2) + Overlay( Trim(B, 0, TFrames), Trim(A, Fa-TFrames-1, \
0),mask=E, pc_range=True) + Trim(B, TFrames+1, 0), Dissolve(Aaudio, Baudio, TFrames))
}
Function BToT(clip A, clip B) {
AA=BlankClip(TFrames+1, Wi, 6, pixel_type="RGB32", fps=FS, color=$000000)
BB=BlankClip(TFrames+1, Wi, 6, pixel_type="RGB32", fps=FS, color=$ffffff)
D=StackVertical(AA, BB)
Xi=3.5
Xf=6.5
E=D.Animate(0, TFrames, "V", Xi, Xf)
Return AudioDub(Trim(A, 0, Fa-TFrames-2) + Overlay(Trim(A, Fa-TFrames-1, 0), Trim(B, 0, TFrames), \
mask=E, pc_range=True) + Trim(B, TFrames+1, 0), Dissolve(Aaudio, Baudio, TFrames))
}
}
Fizick
15th November 2006, 21:18
zemog,
IamB is really IanB :)
zemog
15th November 2006, 22:15
:confused: zemog,
IamB is really IanB :)
Thanks Fizick
IanB, I'm sorry and... ::confused: ::confused:
IanB
16th November 2006, 03:00
Pretty good implementation. ;)
Hint : When making a BlankClip that mostly needs to match an existing clip, explicitly provide that template clip as the 1st argument (this is currently the only filter that doesn't auto inherit Last as its input clip). Then just override the parameter that you want to be different. i.eAA=BlankClip(clip=A, length=TFrames+1, width=4, pixel_type="RGB32", color=$000000)
Also using globals can bite when you want to use more than one instance of the function. Pass them down as arguments.
zemog
16th November 2006, 21:23
Hint : When making a BlankClip that mostly needs to match an existing clip, explicitly provide that template clip as the 1st argument (this is currently the only filter that doesn't auto inherit Last as its input clip). Then just override the parameter that you want to be different. i.eAA=BlankClip(clip=A, length=TFrames+1, width=4, pixel_type="RGB32", color=$000000)
Also using globals can bite when you want to use more than one instance of the function. Pass them down as arguments.
Thanks a lot. I’ll follow your tips. :thanks:
mikeytown2
25th June 2008, 06:38
Updated the DissolveAGG function, it's now one function with no globals. Changed TFrames to Duration
# DissolveAGG() June 25th, 2008
# Dissolve with a Wipe. Wipe has alpha channel mask for nice effect.
#
# Inputs
# clip a - starting clip
# clip b - ending clip
# int "Duration" - Number of overlapped frames
# string "Mode" - Four modes are possible: LeftToRight, RightToLeft, TopToBottom, BottomToTop.
# float "WindowSize" - 2.0 is default. larger: more sharp.
# float "MaskSharpnessStart" - 1: Big Blur; 100: Sharpest. Default 50.
# float "MaskSharpnessEnd" - 1: Big Blur; 100: Sharpest. Default 50.
Function DissolveAGG(clip a, clip b, int "Duration", string "Mode", float "WindowSize", float "MaskSharpnessStart", float "MaskSharpnessEnd")
{
#Set Defaults
Duration=Default(Duration,30)
width=a.width()
height=a.height()
Mode=Default(Mode, "LeftToRight")
MaskSharpnessStart=Default(MaskSharpnessStart, 50.0)
MaskSharpnessEnd=Default(MaskSharpnessEnd, 50.0)
WindowSize=Default(WindowSize, 2.0)
AudioMix=Dissolve(a, b, Duration).KillVideo()
a = a.KillAudio()
b = b.KillAudio()
#Duration=Int(Duration/2.0*((2.0-WindowSize)*0.1+2.0))
#Check Input
Assert(Mode=="LeftToRight" || Mode=="RightToLeft" || Mode=="TopToBottom" || Mode=="BottomToTop",
\"DissolveAGG: Only Four Modes are possible: LeftToRight, RightToLeft, TopToBotoom BottomToTop. Mode=" + Mode)
#Set Parameters
EvalString = Mode=="LeftToRight"? "BlankWidth=Int(4/2*WindowSize)
BlankHeight=height
startX1=BlankWidth + 0.5
endX1=1.5
startY1=0
endY1=0
x2=WindowSize*2-2
y2=0
ClipLeft=b
ClipRight=a" : Mode=="RightToLeft"? "BlankWidth=Int(4/2*WindowSize)
BlankHeight=height
startX1=1.5
endX1=BlankWidth + 0.5
startY1=0
endY1=0
x2=WindowSize*2-2
y2=0
ClipLeft=a
ClipRight=b" : Mode=="TopToBottom"? "BlankWidth=height
BlankHeight=Int(6/2*WindowSize)
startX1=0
endX1=0
startY1=BlankHeight + 0.5
endY1=3.5
x2=0
y2=WindowSize*2-2
ClipLeft=b
ClipRight=a" : Mode=="BottomToTop"? "BlankWidth=height
BlankHeight=Int(6/2*WindowSize)
startX1=0
endX1=0
startY1=3.5
endY1=BlankHeight + 0.5
x2=0
y2=WindowSize*3-4
ClipLeft=a
ClipRight=b" : ""
Eval(EvalString)
#Make Mask
BlackBar = BlankClip(a, length=Duration+1, width=BlankWidth, height=BlankHeight, pixel_type="RGB32", fps=a.Framerate())
WhiteBar = BlankClip(BlackBar, color=$FFFFFF)
BWmask = Mode=="LeftToRight" || Mode=="RightToLeft" ? StackHorizontal(BlackBar,WhiteBar) : StackVertical(BlackBar,WhiteBar)
BWmask = BWmask.Animate(0,Duration,"GaussResize",
\ width, height, startX1, startY1, x2, y2, MaskSharpnessStart,
\ width, height, endX1, endY1, x2, y2, MaskSharpnessEnd)
#Glue it together
Trim(a, 0, FrameCount(a)-Duration-2)
last + Overlay(Trim(ClipLeft, 0, Duration), Trim(ClipRight, FrameCount(ClipRight)-Duration-1, 0), mask=BWmask, pc_range=True)
last + Trim(b, Duration+1, 0)
AudioDub(last,AudioMix)
}
Example:
a = ColorBars().Trim(0,29)
b = a.invert()
DissolveAGG(a,b, 20, "LeftToRight", 2.0)
last + DissolveAGG(a,b, 20, "RightToLeft", 3.0)
last + DissolveAGG(a,b, 20, "TopToBottom", 4.0)
last + DissolveAGG(a,b, 20, "BottomToTop", 5.0)
last + DissolveAGG(a.Loop(2),b.Loop(2), 50, "BottomToTop", 10.0,100.0, 50.0)
BTW what does AGG stand for?
Gavino
25th June 2008, 14:26
@mikeytown2: I like the way you've done this, but the R2L and B2T modes are broken because the wrong frames are used during the transition in these cases (ie when ClipLeft is 'a').
[EDIT: I bet you tested it with static clips, eg ColorBars :( ]
I think you need to set a LeftStart and RightStart in the parameter setup for each mode and do something like:
... Overlay(Trim(ClipLeft, LeftStart, -Duration), Trim(ClipRight, RightStart, -Duration), ...)
Also:
- your actual duration is Duration+1
- maybe add check for Duration against clip lengths?
- why do you use pc_range=true?
zemog
25th June 2008, 23:06
BTW what does AGG stand for?
Nothing important, just an identifier, based in my family name, that I used to add to the functions written by my for my own use.
If you add some improvement or new feature, you can change it at your preference.
mikeytown2
25th June 2008, 23:13
[EDIT: I bet you tested it with static clips, eg ColorBars :( ]
how did u know?!?! :)
Thanks for the input, I think all the problems fixed now. As for pc_range=true, it probably has something to do with the mask. IanB used it in post #9 (http://forum.doom9.org/showthread.php?p=898535#post898535) above. I also added an audio check.
# DissolveAGG() June 25th, 2008
# Dissolve with a Wipe. Wipe has alpha channel mask for nice effect.
#
# Inputs
# clip a - starting clip
# clip b - ending clip
# int "Duration" - Number of overlapped frames
# string "Mode" - Four modes are possible: LeftToRight, RightToLeft, TopToBottom, BottomToTop.
# float "WindowSize" - 2.0 is default. larger: more sharp.
# float "MaskSharpnessStart" - 1: Big Blur; 100: Sharpest. Default 50.
# float "MaskSharpnessEnd" - 1: Big Blur; 100: Sharpest. Default 50.
Function DissolveAGG(clip a, clip b, int "Duration", string "Mode", float "WindowSize", float "MaskSharpnessStart", float "MaskSharpnessEnd")
{
#Set Defaults
Duration=Default(Duration,30)
width=a.width()
height=a.height()
Mode=Default(Mode, "LeftToRight")
MaskSharpnessStart=Default(MaskSharpnessStart, 50.0)
MaskSharpnessEnd=Default(MaskSharpnessEnd, 50.0)
WindowSize=Default(WindowSize, 2.0)
AudioMix=Dissolve(a, b, Duration).KillVideo()
a = a.KillAudio()
b = b.KillAudio()
#Check Input
Assert(Mode=="LeftToRight" || Mode=="RightToLeft" || Mode=="TopToBottom" || Mode=="BottomToTop",
\"DissolveAGG: Only Four Modes are possible: LeftToRight, RightToLeft, TopToBotoom BottomToTop. Mode=" + Mode)
Assert(Duration >= 0, "DissolveAGG: Duration [" + String(Duration) + "] must be a positive value")
Assert(Duration <= a.Framecount()-1, "DissolveAGG: Duration[" + String(Duration) + "] is greater then " + Chr(10) + "clip A length[" + String(a.Framecount()-1) + "]")
Assert(Duration <= b.Framecount()-1, "DissolveAGG: Duration[" + String(Duration) + "] is greater then " + Chr(10) + "clip B length[" + String(b.Framecount()-1) + "]")
#Set Parameters
EvalString = Mode=="LeftToRight"? "BlankWidth=Int(4/2*WindowSize)
BlankHeight=height
startX1=BlankWidth + 0.5
endX1=1.5
startY1=0
endY1=0
x2=WindowSize*2-2
y2=0
ClipLeft=b
ClipLeftStart=0
ClipLeftEnd=Duration
ClipRight=a
ClipRightStart=FrameCount(a)-Duration-1
ClipRightEnd=0" : Mode=="RightToLeft"? "BlankWidth=Int(4/2*WindowSize)
BlankHeight=height
startX1=1.5
endX1=BlankWidth + 0.5
startY1=0
endY1=0
x2=WindowSize*2-2
y2=0
ClipLeft=a
ClipLeftStart=FrameCount(a)-Duration-1
ClipLeftEnd=0
ClipRight=b
ClipRightStart=0
ClipRightEnd=Duration" : Mode=="TopToBottom"? "BlankWidth=height
BlankHeight=Int(6/2*WindowSize)
startX1=0
endX1=0
startY1=BlankHeight + 0.5
endY1=3.5
x2=0
y2=WindowSize*2-2
ClipLeft=b
ClipLeftStart=0
ClipLeftEnd=Duration
ClipRight=a
ClipRightStart=FrameCount(a)-Duration-1
ClipRightEnd=0" : Mode=="BottomToTop"? "BlankWidth=height
BlankHeight=Int(6/2*WindowSize)
startX1=0
endX1=0
startY1=3.5
endY1=BlankHeight + 0.5
x2=0
y2=WindowSize*3-4
ClipLeft=a
ClipLeftStart=FrameCount(a)-Duration-1
ClipLeftEnd=0
ClipRight=b
ClipRightStart=0
ClipRightEnd=Duration" : ""
Eval(EvalString)
#Make Mask
BlackBar = BlankClip(a, length=Duration+1, width=BlankWidth, height=BlankHeight, pixel_type="RGB32")
WhiteBar = BlankClip(BlackBar, color=$FFFFFF)
BWmask = Mode=="LeftToRight" || Mode=="RightToLeft" ? StackHorizontal(BlackBar,WhiteBar) : StackVertical(BlackBar,WhiteBar)
BWmask = BWmask.Animate(0,Duration,"GaussResize",
\ width, height, startX1, startY1, x2, y2, MaskSharpnessStart,
\ width, height, endX1, endY1, x2, y2, MaskSharpnessEnd)
#Glue it together
Trim(a, 0, FrameCount(a)-Duration-1)
last + Overlay(Trim(ClipLeft, ClipLeftStart, ClipLeftEnd), Trim(ClipRight, ClipRightStart, ClipRightEnd), mask=BWmask, pc_range=True)
last + Trim(b, Duration+1, 0)
HasAudio(AudioMix) ? AudioDub(last,AudioMix) : last
}
Gavino
26th June 2008, 01:44
It's more or less there, but I think it's still not quite right.
Frame Framecount(a)-Duration-1 of a is repeated.
(ShowFrameNumber can be useful for testing these sort of things.)
I'm not sure about this bit, but the way I see it, the mask should be of length Duration.
Clip a's part in the transition should run from Framecount(a)-Duration to the end, and clip b's part from 0 to Duration-1.
Then the final part of the total should be b.Trim(Duration, 0).
Or is it just that the mask is extended by one frame at the end to cover the first full frame of b, and it all works out? (If so, why don't you need to do the same at the beginning of the mask, making it Duration+2?)
In the validation checks, Duration needs to be strictly > 0 (perhaps even > 1 in the light of the above), otherwise Animate will fail (and you have 2 typos ("then") in the error msgs).
(Funny how it's always easier to spot errors in someone else's code. :))
As for pc_range, I imagine IanB had a good reason. but I'd like to understand it as pc_range does not affect the mask in Overlay (http://avisynth.org/mediawiki/Overlay).
EDIT: I'm now wondering if in fact you need to append a blank frame to a, prepend a blank frame to b, and use a mask of length Duration+2 ??
Gavino
26th June 2008, 16:04
Here's an update which I think gets the transition boundaries exactly right. It even handles a Duration of 0, which effectively reduces to a splice.
I've also made MaskSharpnessEnd default to MaskSharpnessStart so you only have to specify the latter one if you want them to be the same. Also did some minor fixes and tidying up.
# DissolveAGG() June 27th, 2008
# Dissolve with a Wipe. Wipe has alpha channel mask for nice effect.
#
# Inputs
# clip a - starting clip
# clip b - ending clip
# int "Duration" - Number of overlapped frames
# string "Mode" - Four modes are possible: LeftToRight, RightToLeft, TopToBottom, BottomToTop.
# float "WindowSize" - 2.0 is default. larger: more sharp.
# float "MaskSharpnessStart" - 1: Big Blur; 100: Sharpest. Default 50.
# float "MaskSharpnessEnd" - 1: Big Blur; 100: Sharpest. Default 50.
Function DissolveAGG(clip a, clip b, int "Duration", string "Mode", float "WindowSize", float "MaskSharpnessStart", float "MaskSharpnessEnd")
{
#Set Defaults
Duration=Default(Duration,30)
width=a.width()
height=a.height()
Mode=Default(Mode, "LeftToRight")
MaskSharpnessStart=Default(MaskSharpnessStart, 50.0)
MaskSharpnessEnd=Default(MaskSharpnessEnd, MaskSharpnessStart)
WindowSize=Default(WindowSize, 2.0)
AudioMix=Dissolve(a, b, Duration).KillVideo()
a = a.KillAudio()
b = b.KillAudio()
#Check Input
Assert(Mode=="LeftToRight" || Mode=="RightToLeft" || Mode=="TopToBottom" || Mode=="BottomToTop",
\"DissolveAGG: Only Four Modes are possible: LeftToRight, RightToLeft, TopToBottom, BottomToTop. Mode=" + Mode)
Assert(Duration >= 0, "DissolveAGG: Duration [" + String(Duration) + "] must not be a negative value")
Assert(Duration < a.Framecount(), "DissolveAGG: Duration[" + String(Duration) + "] must be less than " + Chr(10) + "clip A length[" + String(a.Framecount()) + "]")
Assert(Duration < b.Framecount(), "DissolveAGG: Duration[" + String(Duration) + "] must be less than " + Chr(10) + "clip B length[" + String(b.Framecount()) + "]")
#Set Parameters
aMid = Trim(a, FrameCount(a)-Duration, 0)
bMid = Trim(b, 0, -Duration)
EvalString = Mode=="LeftToRight"? "BlankWidth=Int(4/2*WindowSize)
BlankHeight=height
startX1=BlankWidth + 0.5
endX1=1.5
startY1=0
endY1=0
x2=WindowSize*2-2
y2=0
ClipLeft=bMid
ClipRight=aMid" : Mode=="RightToLeft"? "BlankWidth=Int(4/2*WindowSize)
BlankHeight=height
startX1=1.5
endX1=BlankWidth + 0.5
startY1=0
endY1=0
x2=WindowSize*2-2
y2=0
ClipLeft=aMid
ClipRight=bMid" : Mode=="TopToBottom"? "BlankWidth=width
BlankHeight=Int(6/2*WindowSize)
startX1=0
endX1=0
startY1=BlankHeight + 0.5
endY1=3.5
x2=0
y2=WindowSize*3-4
ClipLeft=bMid
ClipRight=aMid" : Mode=="BottomToTop"? "BlankWidth=width
BlankHeight=Int(6/2*WindowSize)
startX1=0
endX1=0
startY1=3.5
endY1=BlankHeight + 0.5
x2=0
y2=WindowSize*3-4
ClipLeft=aMid
ClipRight=bMid" : ""
Eval(EvalString)
#Make Mask
BlackBar = BlankClip(a, length=Duration+2, width=BlankWidth, height=BlankHeight, pixel_type="RGB32")
WhiteBar = BlankClip(BlackBar, color=$FFFFFF)
BWmask = Mode=="LeftToRight" || Mode=="RightToLeft" ? StackHorizontal(BlackBar,WhiteBar) : StackVertical(BlackBar,WhiteBar)
BWmask = BWmask.Animate(0,Duration+1,"GaussResize",
\ width, height, startX1, startY1, x2, y2, MaskSharpnessStart,
\ width, height, endX1, endY1, x2, y2, MaskSharpnessEnd)
\ .Trim(1, Duration)
#Glue it together
Trim(a, 0, FrameCount(a)-Duration-1)
last = (Duration > 0 ? last + Overlay(ClipLeft, ClipRight, mask=BWmask, pc_range=True) : last)
last + Trim(b, Duration, 0)
HasAudio(AudioMix) ? AudioDub(last,AudioMix) : last
}
Gavino
27th June 2008, 12:29
Another bug fixed (mask handling in TopToBottom mode with non-default Window). Edited previous post rather than posting it all again.
Thanks to mikeytown2 for doing most of the hard work on this version, gracias a zemog for original version and credit to IanB for outline idea.
Chainmax
27th June 2008, 23:08
I have a problem with FadeIn0 and FadeOut0. I am using the following simple script:
video=Mpeg2source("X:\wherever\clip.d2v")
audio=NicAC3Source("X:\wherever\clip.ac3")
AudioDub(Video,Audio)
SeparateFields()
Spline36Resize(656,224)
AddBorders(32,8,32,8)
FadeIn0(30)
FadeOut0(60)
Weave()
But it seems like the fade-out only lasts 30 frames and the fade-in isn't even considered at all. Am I missing something?
Gavino
28th June 2008, 00:01
You need to put the fades after the Weave (which halves the framerate). The fade-in probably was there, but would have been only 15 frames and so easily missed, especially if your clip starts off dark.
BTW I'm not sure if this really belongs in this thread, although I suppose it's in the same general area.
mikeytown2
28th June 2008, 09:13
Gavino, thanks for polishing up the function! Been busy for the last couple of days.
Chainmax you could try adding the fades (http://avisynth.org/mediawiki/Fade) before SeparateFields() as well. Other then that, I have no idea on the fade in.
foxyshadis
2nd July 2008, 00:18
....or just double the framecount, so that it actually fades every field (as you'd want for interlaced material), instead of screwing up the temporal fade.
mikeytown2
8th July 2008, 07:03
Starting to get somewhere... I'm using Fizick's Rotation Plugin (1.31) (http://forum.doom9.org/showthread.php?t=131307) to rotate the mask.
http://avisynth.org.ru/rotate/rotate.html
# DissolveAGG() July 7th, 2008
# Dissolve with a Wipe. Wipe has alpha channel mask and selectable angle for nice effect.
#
# Inputs
# clip a - starting clip
# clip b - ending clip
# int "Duration" - Number of overlapped frames
# float "Angle" - Angle of the wipe
# string "Mode" - Four modes are possible: LeftToRight, RightToLeft, TopToBottom, BottomToTop.
# float "WindowSize" - 2.0 is default. larger: more sharp.
# float "MaskSharpnessStart" - 1: Big Blur; 100: Sharpest. Default 50.
# float "MaskSharpnessEnd" - 1: Big Blur; 100: Sharpest. Default 50.
Function DissolveAGG(clip a, clip b, int "Duration", float "Angle", float "EndAngle", string "Mode", float "WindowSize", float "MaskSharpnessStart", float "MaskSharpnessEnd")
{
#Set Defaults
Duration=Default(Duration,Round(Framerate(a)))
Angle=Default(Angle,0)
EndAngle=Default(EndAngle,Angle)
width=a.width()
height=a.height()
Diagonal = Ceil(sqrt(pow(width(a),2)+pow(height(a),2)))
Mode=Default(Mode, "LeftToRight")
MaskSharpnessStart=Default(MaskSharpnessStart, 50.0)
MaskSharpnessEnd=Default(MaskSharpnessEnd, MaskSharpnessStart)
WindowSize=Default(WindowSize, 2.0)
AudioMix=Dissolve(a, b, Duration).KillVideo()
a = a.KillAudio()
b = b.KillAudio()
#Check Input
Assert(Mode=="LeftToRight" || Mode=="RightToLeft" || Mode=="TopToBottom" || Mode=="BottomToTop",
\"DissolveAGG: Only Four Modes are possible: LeftToRight, RightToLeft, TopToBottom, BottomToTop. Mode=" + Mode)
Assert(Duration >= 0, "DissolveAGG: Duration [" + String(Duration) + "] must not be a negative value")
Assert(Duration < a.Framecount(), "DissolveAGG: Duration[" + String(Duration) + "] must be less than " + Chr(10) + "clip A length[" + String(a.Framecount()) + "]")
Assert(Duration < b.Framecount(), "DissolveAGG: Duration[" + String(Duration) + "] must be less than " + Chr(10) + "clip B length[" + String(b.Framecount()) + "]")
#Set Parameters
aMid = Trim(a, FrameCount(a)-Duration, 0)
bMid = Trim(b, 0, -Duration)
EvalString = Mode=="LeftToRight"? "BlankWidth=Int(4/2*WindowSize)
BlankHeight=Diagonal
startX1=BlankWidth + 0.5
endX1=1.5
startY1=0
endY1=0
x2=WindowSize*2-2
y2=0
ClipLeft=bMid
ClipRight=aMid" : Mode=="RightToLeft"? "BlankWidth=Int(4/2*WindowSize)
BlankHeight=Diagonal
startX1=1.5
endX1=BlankWidth + 0.5
startY1=0
endY1=0
x2=WindowSize*2-2
y2=0
ClipLeft=aMid
ClipRight=bMid" : Mode=="TopToBottom"? "BlankWidth=Diagonal
BlankHeight=Int(6/2*WindowSize)
startX1=0
endX1=0
startY1=BlankHeight + 0.5
endY1=3.5
x2=0
y2=WindowSize*3-4
ClipLeft=bMid
ClipRight=aMid" : Mode=="BottomToTop"? "BlankWidth=Diagonal
BlankHeight=Int(6/2*WindowSize)
startX1=0
endX1=0
startY1=3.5
endY1=BlankHeight + 0.5
x2=0
y2=WindowSize*3-4
ClipLeft=aMid
ClipRight=bMid" : ""
Eval(EvalString)
#Make Mask
BlackBar = BlankClip(a, length=Duration+2, width=BlankWidth, height=BlankHeight, pixel_type="RGB32")
WhiteBar = BlankClip(BlackBar, color=$FFFFFF)
BWmask = Mode=="LeftToRight" || Mode=="RightToLeft" ? StackHorizontal(BlackBar,WhiteBar) : StackVertical(BlackBar,WhiteBar)
BWmask = BWmask.Animate(0,Duration+1,"GaussResize",
\ Diagonal, Diagonal, startX1, startY1, x2, y2, MaskSharpnessStart,
\ Diagonal, Diagonal, endX1, endY1, x2, y2, MaskSharpnessEnd)
BWmask = BWmask.Trim(1, Duration).Animate(0, framecount(BWmask)-1, "Rotate", Angle, $000000, 0, -1, Angle, width, height, EndAngle, $000000, 0, -1, EndAngle, width, height)
#Glue it together
Trim(a, 0, FrameCount(a)-Duration-1)
last = (Duration > 0 ? last + Overlay(ClipLeft, ClipRight, mask=BWmask, pc_range=True) : last)
last + Trim(b, Duration, 0)
HasAudio(AudioMix) ? AudioDub(last,AudioMix) : last
}
Example
a = ColorBars(320,320).Trim(0,99)
b = a.invert()
DissolveAGG(a,b, 80, angle=-15.0, endangle=105.0, WindowSize=10)
It's not "perfect" because it uses the clip's Diagonal to calc the mask, thus the start and end is a little off. thats what the -15 and 105 is for. Ideally it would be 0 and 90. It falls apart if its not square like it is for the example.
Edit: I think if i where to use EffectRotation (http://avisynth.org/vcmohan/EffectsMany/EffectRotation.html) i could make this behave better, because i can select the center of rotation. I could do it with zoom as well now that i think about it. Doing that i should be able to keep the arc in the corner, and that should get rid of the -15 and 105 oddness. it will be hard to make this a smart function...
NerdWithNoLife
9th July 2008, 15:16
I don't know if this is what you want, but you can do a slide-in with KenBurnsEffect. Let's assume you have a 640x480 video:
a=AviSource("clipA.avi")
b=AviSource("clipB.avi")
StackHorizontal(a,b)
KenBurnsEffect(startFrame=0, endFrame=29, endPanX=0, startPanX=-640).crop(0,0,640,480)
I think it has to be RGB32, so you may have to add ConvertToRGB32()
tin3tin
10th July 2008, 08:38
The link at the first post seems to be down, so I can't see what transition you're after. These (http://download.videohelp.com/tin2tin/Transitions_Preview.html) are the avs transitions included in DVD slideshow GUI. They are just avisynth scripts located in the DVD slideshow GUI\Transitions folder.
A lot of them are done with vcmohan's great transall plugin.
mikeytown2
10th July 2008, 10:40
Here's an UGLY hack of the above working with 0 and 90. Requires KenBurnsEffect (http://forum.doom9.org/showthread.php?t=135776)
Function DissolveAGG_test(clip a, clip b, int "Duration", float "Angle", float "EndAngle", string "Mode", float "WindowSize", float "MaskSharpnessStart", float "MaskSharpnessEnd")
{
#Set Defaults
Duration=Default(Duration,Round(Framerate(a)))
Angle=Default(Angle,0)
EndAngle=Default(EndAngle,Angle)
width=a.width()
height=a.height()
Diagonal = Ceil(sqrt(pow(width(a),2)+pow(height(a),2)))
Mode=Default(Mode, "LeftToRight")
MaskSharpnessStart=Default(MaskSharpnessStart, 50.0)
MaskSharpnessEnd=Default(MaskSharpnessEnd, MaskSharpnessStart)
WindowSize=Default(WindowSize, 2.0)
AudioMix=Dissolve(a, b, Duration).KillVideo()
a = a.KillAudio()
b = b.KillAudio()
#Check Input
Assert(Mode=="LeftToRight" || Mode=="RightToLeft" || Mode=="TopToBottom" || Mode=="BottomToTop",
\"DissolveAGG: Only Four Modes are possible: LeftToRight, RightToLeft, TopToBottom, BottomToTop. Mode=" + Mode)
Assert(Duration >= 0, "DissolveAGG: Duration [" + String(Duration) + "] must not be a negative value")
Assert(Duration < a.Framecount(), "DissolveAGG: Duration[" + String(Duration) + "] must be less than " + Chr(10) + "clip A length[" + String(a.Framecount()) + "]")
Assert(Duration < b.Framecount(), "DissolveAGG: Duration[" + String(Duration) + "] must be less than " + Chr(10) + "clip B length[" + String(b.Framecount()) + "]")
#Set Parameters
aMid = Trim(a, FrameCount(a)-Duration, 0)
bMid = Trim(b, 0, -Duration)
EvalString = "BlankWidth=Int(4/2*WindowSize)
BlankHeight=Diagonal
ClipLeft=bMid
ClipRight=aMid"
Eval(EvalString)
#Make Mask
BlackBar = BlankClip(a, length=Duration+2, width=BlankWidth, height=BlankHeight, pixel_type="RGB32")
WhiteBar = BlankClip(BlackBar, color=$FFFFFF)
BWmask = StackHorizontal(BlackBar,WhiteBar)
BWmask = BWmask.GaussResize(width, Diagonal)
BWmask = BWmask.AddBorders(Diagonal-width/2,0,0,0).AddBorders(0,0,Diagonal-width/2,0,$FFFFFF)
BWmask = BWmask.Trim(1, Duration)
BWmask = StackVertical(BWmask, BlankClip(BWmask))
BWmask = BWmask.Animate(0, framecount(BWmask)-1, "Rotate", Angle, $000000, 0, -1, Angle, BWmask.width(), BWmask.height(), EndAngle, $000000, 0, -1, EndAngle, BWmask.width(), BWmask.height())
BWmaskA = BWmask.Trim(0,-Duration/4).KenBurnsEffect(width=Round(width*1.0),height=Round(height*1.0),startzoomfactor=-100,endzoomfactor=-100, startalign=5, endalign=5, startpanX=-Diagonal-BlankWidth/8, endpanX=-Diagonal, startpanY=Diagonal/(float(width)/height), endpanY=Diagonal/(float(width)/height))
BWmaskB = BWmask.Trim(Duration/4,(Duration*3)/4-1).ZoomBox(Round(width*1.0),Round(height*1.0),zoomfactor=-100, align=5, panX=-Diagonal, panY=Diagonal/(float(width)/height))
BWmaskC = BWmask.Trim((Duration*3)/4,0).KenBurnsEffect(width=Round(width*1.0),height=Round(height*1.0),startzoomfactor=-100,endzoomfactor=-100, startalign=5, endalign=5, startpanX=-Diagonal, endpanX=-Diagonal, startpanY=Diagonal/(float(width)/height), endpanY=Diagonal/(float(width)/height)+BlankWidth/8)
BWmask = BWmaskA+BWmaskB+BWmaskC
#Glue it together
Trim(a, 0, FrameCount(a)-Duration-1)
last = (Duration > 0 ? last + Overlay(ClipLeft, ClipRight, mask=BWmask, pc_range=True) : last)
last + Trim(b, Duration, 0)
HasAudio(AudioMix) ? AudioDub(last,AudioMix) : last
#BWmask
}
a = ColorBars().Trim(0,99)
b = a.invert()
DissolveAGG_test(a,b, 80, 0.0, 90.0, WindowSize=20)
The main advantage of this function over transall is the blurred mask. The transition line is softer and adjustable with DissolveAGG
Gavino
10th July 2008, 12:02
BWmaskA = BWmask.Trim(0,-Duration/4). etc
BWmaskB = BWmask.Trim(Duration/4,(Duration*3)/4-1). etc
BWmaskC = BWmask.Trim((Duration*3)/4,0). etc
BWmask = BWmaskA+BWmaskB+BWmaskC
I haven't tried it out or anything, but I can see that this part won't work with Duration < 4.
Bit messy to fix, perhaps easiest just to replace the last of these lines with
BWmask = Duration < 4 ? BWmask : BWmaskA+BWmaskB+BWmaskC
Extreme cases are the acid test of whether an algorithm is correct. A good test case is Duration=1 which should show a single frame with 50% of both clips.
BTW You've left a stray ShowFrameNumber on the line previous to these.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.