Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: Mar 2006
Posts: 184
|
Fade/Dissolve (like Womble MPEG Wizard)
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 - this was made by WMVW. I want such things in with AviSynth. |
![]() |
![]() |
![]() |
#2 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Avisynth provides FadeIn, FadeOut, FadeIO and Disolve native filters.
Many other effects can be created using Animate with layer or overlay. Code:
... 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 } |
![]() |
![]() |
![]() |
#3 | Link | |
Registered User
Join Date: Mar 2006
Posts: 184
|
Quote:
I want filter for such transition ![]() |
|
![]() |
![]() |
![]() |
#4 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
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. Code:
___ white / / ___/ black | | -> slide I'll knock up a suitable script when I get home if you like the sound of this. |
![]() |
![]() |
![]() |
#5 | Link | |
Registered User
Join Date: Mar 2006
Posts: 184
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#6 | Link |
Moderator
![]() Join Date: Nov 2001
Location: Netherlands
Posts: 6,354
|
For example:
Code:
# 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) Nice example for the docs, thx very much! Last edited by Wilbert; 9th November 2006 at 16:31. |
![]() |
![]() |
![]() |
#7 | Link | |
Registered User
Join Date: Mar 2006
Posts: 184
|
Quote:
![]() 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 ![]() |
|
![]() |
![]() |
![]() |
#8 | Link |
ангел смерти
![]() Join Date: Nov 2004
Location: Lost
Posts: 9,555
|
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.
|
![]() |
![]() |
![]() |
#9 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
@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 :-
Code:
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) |
![]() |
![]() |
![]() |
#10 | Link |
Registered User
Join Date: Mar 2006
Posts: 184
|
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. |
![]() |
![]() |
![]() |
#11 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
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. |
![]() |
![]() |
![]() |
#12 | Link | |
Registered User
Join Date: Mar 2006
Posts: 184
|
Quote:
|
|
![]() |
![]() |
![]() |
#13 | Link | |
Registered User
Join Date: Sep 2006
Location: Madrid (Spain)
Posts: 20
|
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: Quote:
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. |
|
![]() |
![]() |
![]() |
#14 | Link | |
Registered User
Join Date: Mar 2006
Posts: 184
|
Quote:
![]() ![]() ![]() ![]() 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 ![]() ![]() Code:
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)) } } |
|
![]() |
![]() |
![]() |
#17 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
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.e Code:
AA=BlankClip(clip=A, length=TFrames+1, width=4, pixel_type="RGB32", color=$000000) |
![]() |
![]() |
![]() |
#18 | Link | |
Registered User
Join Date: Sep 2006
Location: Madrid (Spain)
Posts: 20
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#19 | Link |
Resize Abuser
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
|
Updated the DissolveAGG function, it's now one function with no globals. Changed TFrames to Duration
Code:
# 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: Code:
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?
__________________
Mine: KenBurnsEffect/ZoomBox CutFrames Helped: DissolveAGG ColorBalance LQ Animation Fixer Last edited by mikeytown2; 25th June 2008 at 10:36. |
![]() |
![]() |
![]() |
#20 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,423
|
@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: Code:
... Overlay(Trim(ClipLeft, LeftStart, -Duration), Trim(ClipRight, RightStart, -Duration), ...) - your actual duration is Duration+1 - maybe add check for Duration against clip lengths? - why do you use pc_range=true? Last edited by Gavino; 25th June 2008 at 17:01. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|