View Full Version : AviSynth Newbie - Using FadeIn/IO/Out
kalorx
10th October 2019, 03:11
Hi all. As the subject says, I'm an AviSynth newbie, and no matter what I try and can't get Fade to work like I want it to. It's pointless to even attach a script here because I tried a whole bunch of things. What I'm trying to do is take 30+ clips, load them at the same time appended into a large sum clip (which I know how to do), but here's the trick that I can't figure out: each individual clip has a fade-in and a fade-out.
For the life of me nothing I've tried works. The clips either load in sequence but with no fades, or a fade-in on the first clip and and a fade-out on the last clip, or only the first clip loads, or I get a script error and nothing loads, etc.
Any help would be greatly appreciated!
manolito
10th October 2019, 05:26
Some more info please...
Do your source clips all have the same properties (like codec, fps, size, aspect ratio) ? Are the fades already present in the source clips, or do you use AviSynth to create the fades?
Here is what VCF2AVS does when splicing together parts of a bigger clip where the cuts were made in VirtualDub:
movie = "f:\download\test.flv"
ffmpegsource2(movie)
# Added by VCF2AVS
FPS=Round(Framerate)
Trim(379,1058).FadeOut2(FPS)+Trim(2850,3650).Reverse.FadeOut(FPS).Reverse.FadeOut2(FPS)+Trim(4628,5364).Reverse.FadeOut(FPS).Reverse.FadeOut2(FPS)
Reverse.FadeOut(2*FPS).Reverse.FadeOut2(2*FPS)
The "Reverse.Fadeout" part is a hack to make it compatible with older AVS versions:
For fade in I use the reverse.fadeout2(..).reverse command. This is a "hack" and not needed with newer versions of AVISynth because there is a FadeIn command. Iīve kept the reverse-stuff because itīs more compatible with older version of AVISynth.
If your clips already contain the fades then you should be able to concatenate them with the "+" command (or maybe with the "++" command for aligned splicing)
Cheers
manolito
StainlessS
10th October 2019, 16:19
Do your source clips all have the same properties (like codec, fps, size, aspect ratio) ?
Yep, and also what version avisynth, x86 or x64, what file types (avi, mp4, flv etc). Also codecs samplerates etc for audio too, are they all the same ?
EDIT: All progressive (or Interlaced, or mix) ?
kalorx
10th October 2019, 18:54
Please note I'm not an editing newbie, just an AviSynth newbie. :) All the videos are fully compatible with one another.
I'm using the latest version of AviSynth, 2.6.0.
The clips do not already contain fades.
kalorx
10th October 2019, 19:03
Probably the most expedient way to solve this problem is just giving me a working example of FadeIn, FadeIO (especially this one, I'm guessing), and FadeOut working with 30+ files. I'm sure I could easily adapt the script to my own needs. Thanks!
StainlessS
10th October 2019, 20:36
try this,
Function FadeFunc(String Name,int "Frames",Int "Color",Float "FPS") {
Frames=default(Frames,25) # Change to whatever Default you want
Color=Default(Color,$000000)
FPS=Default(FPS,24.0)
Avisource(Name) # Mod to your source filter
Trim(0,-100).ShowFrameNumber # testing Only, comment out
FadeIn( Frames,Color,FPS)
FadeOut(Frames,Color,FPS)
}
FN=".\Parade.avi"
FadeFunc(FN) ++ FadeFunc(FN) ++ FadeFunc(FN) ++ FadeFunc(FN) ++ FadeFunc(FN)
Avisnthesizer_Mod Template ( FadeSplice.avst )
#ASYNTHER FadeSplice
######################## Above Name FadeSplice used by Avisynthesizer_Mod in Dialog box
Global G_FILECOUNT=___FILECNT___ # Set by Avisynthesizer_Mod
[FadeFunc("___FILE___")] # fileNames inserted by Avisynthesizer_Mod
return Last
##############
Function FadeFunc(String Name,int "Frames",Int "Color",Float "FPS") {
Frames=default(Frames,25) # Change to whatever Default you want
Color=Default(Color,$000000)
FPS=Default(FPS,24.0)
Avisource(Name) # Mod to your source filter
Trim(0,-100).ShowFrameNumber # testing Only, comment out
FadeIn( Frames,Color,FPS)
FadeOut(Frames,Color,FPS)
}
Avisnthesizer_Mod:- https://forum.doom9.org/showthread.php?t=166820&highlight=Avisynthesizer_Mod
Right click select multiple sources, SendTo AvisyntheSizer, sort file order in presented dialog box,
creates script splicing sources together.
NOTE, Some source filters have a limit to how many files can be opened at once (some as little as about 28), due to system resources being exhausted.
EDIT: Above will create something like below
#ASYNTHER FadeSplice
######################## Above Name FadeSplice used by Avisynthesizer_Mod in Dialog box
Global G_FILECOUNT=3 # Set by Avisynthesizer_Mod
FadeFunc("D:\Parade.AVI") ++ \
FadeFunc("D:\Parade - Copy.AVI") ++ \
FadeFunc("D:\Parade - Copy (2).AVI") # fileNames inserted by Avisynthesizer_Mod
return Last
##############
Function FadeFunc(String Name,int "Frames",Int "Color",Float "FPS") {
Frames=default(Frames,25) # Change to whatever Default you want
Color=Default(Color,$000000)
FPS=Default(FPS,24.0)
Avisource(Name) # Mod to your source filter
Trim(0,-100).ShowFrameNumber # testing Only, comment out
FadeIn( Frames,Color,FPS)
FadeOut(Frames,Color,FPS)
}
EDIT: Tried to find a way to do Dissolve using AvisyntheSizer_Mod, but could not, but can use this kind of thing (if Dissolve required)
Function GetClip(String FN) {
AviSource(FN)
trim(1000,-100).ShowFrameNumber
return Last
}
C01=GetClip(".\Parade.avi")
C02=GetClip(".\Parade.avi")
C03=GetClip(".\Parade.avi")
C04=GetClip(".\Parade.avi")
C05=GetClip(".\Parade.avi")
OVERLAP=30
Dissolve(C01,C02,C03,C04,C05,OVERLAP)
kalorx
11th October 2019, 03:31
Wow, there's no way to do this without creating a new function? Well anyway, I do look forward to trying it out, but it'll be a while, as I'll be away from this PC for some weeks. Until then, thanks!
StainlessS
11th October 2019, 04:20
Wow, there's no way to do this without creating a new function?
Well of course there is a way, but is a lot easier and shorter to encapsulate all of the repetitive stuff in a function, so you can just do
FadeFunc(FN) instead of repeatedly typing in the contents of the function for every clip. [ or even rename eg FadeFunc to Q(fn) for less typing ]
I guess this could do to replace 1st code block
Frames=25
Color=$000000
FPS=24.0
FN1=".\Parade.avi"
FN2=".\Parade.avi"
FN3=".\Parade.avi"
FN4=".\Parade.avi"
FN5=".\Parade.avi"
Avisource(FN1).FadeIn(Frames,Color,FPS).FadeOut(Frames,Color,FPS) ++ \
Avisource(FN2).FadeIn(Frames,Color,FPS).FadeOut(Frames,Color,FPS) ++ \
Avisource(FN3).FadeIn(Frames,Color,FPS).FadeOut(Frames,Color,FPS) ++ \
Avisource(FN4).FadeIn(Frames,Color,FPS).FadeOut(Frames,Color,FPS) ++ \
Avisource(FN5).FadeIn(Frames,Color,FPS).FadeOut(Frames,Color,FPS)
or Avsiynthesizer_Mod template
#ASYNTHER FadeSplice
######################## Above Name FadeSplice used by Avisynthesizer_Mod in Dialog box
Frames=25
Color=$000000
FPS=24.0
[Avisource("___FILE___").FadeIn(Frames,Color,FPS).FadeOut(Frames,Color,FPS)] # fileNames inserted by Avisynthesizer_Mod
return Last
and result
#ASYNTHER FadeSplice
######################## Above Name FadeSplice used by Avisynthesizer_Mod in Dialog box
Frames=25
Color=$000000
FPS=24.0
Avisource("D:\Parade.AVI").FadeIn(Frames,Color,FPS).FadeOut(Frames,Color,FPS) ++ \
Avisource("D:\Parade - Copy.AVI").FadeIn(Frames,Color,FPS).FadeOut(Frames,Color,FPS) ++ \
Avisource("D:\Parade - Copy (2).AVI").FadeIn(Frames,Color,FPS).FadeOut(Frames,Color,FPS) # fileNames inserted by Avisynthesizer_Mod
return Last
I prefer the original, as you can easily add stuff to it and avoid lots of copy paste. [Easy add even after generating result of template]
EDIT: You may save a couple of milliseconds at filter graph creation when not having a function call, but while frameserving, no difference.
The additional couple of ms swallows a tiddly bit of time but only before the first frame is delivered to the client process.
EDIT: Dont Fadein first clip, or FadeOut last clip.
#ASYNTHER FF
######################## Above Name FF used by Avisynthesizer_Mod in Dialog box
# FF.avst
Global G_FILECOUNT=___FILECNT___ # Set by Avisynthesizer_Mod
Global G_Counter = 0 # Clip index
[FF("___FILE___")] # fileNames inserted by Avisynthesizer_Mod
return Last
############## SkipFirst = DONT FADEIN first clip, SkipLast = DONT FADEOUT last clip.
Function FF(String Fn,int "Frames",Int "Color",Float "FPS",Bool "SkipFirst",Bool "SkipLast",Bool "Subs") {
Avisource(Fn) # Mod to your source filter
Frames = Default(Frames,25) # Change to whatever Defaults you want
Color = Default(Color,$000000)
FPS = Default(FPS,FrameRate)
SkipFirst = Default(SkipFirst,True)
SkipLast = Default(SkipLast, True)
Subs = Default(Subs,True)
###
Trim(0,-100).ShowFrameNumber # testing Only, comment out
Global G_Counter = G_Counter + 1
(Subs) ? Subtitle(String(G_Counter,"%.0f] ")+Fn.RightStr(RevStr(Fn).FindStr("\")-1)) : Last # No path
(!SkipFirst || G_Counter != 1) ? FadeIn( Frames,Color,FPS) : Last
Return (!SkipLast || G_Counter != G_FILECOUNT) ? FadeOut(Frames,Color,FPS) : Last
}
Result
#ASYNTHER FF
######################## Above Name FF used by Avisynthesizer_Mod in Dialog box
# FF.avst
Global G_FILECOUNT=5 # Set by Avisynthesizer_Mod
Global G_Counter = 0 # Clip index
FF("D:\Parade.AVI") ++ \
FF("D:\Parade - Copy.AVI") ++ \
FF("D:\Parade - Copy (2).AVI") ++ \
FF("D:\Parade - Copy (3).AVI") ++ \
FF("D:\Parade - Copy (4).AVI") # fileNames inserted by Avisynthesizer_Mod
return Last
############## SkipFirst = DONT FADEIN first clip, SkipLast = DONT FADEOUT last clip.
Function FF(String Fn,int "Frames",Int "Color",Float "FPS",Bool "SkipFirst",Bool "SkipLast",Bool "Subs") {
Avisource(Fn) # Mod to your source filter
Frames = Default(Frames,25) # Change to whatever Defaults you want
Color = Default(Color,$000000)
FPS = Default(FPS,FrameRate)
SkipFirst = Default(SkipFirst,True)
SkipLast = Default(SkipLast, True)
Subs = Default(Subs,True)
###
Trim(0,-100).ShowFrameNumber # testing Only, comment out
Global G_Counter = G_Counter + 1
(Subs) ? Subtitle(String(G_Counter,"%.0f] ")+Fn.RightStr(RevStr(Fn).FindStr("\")-1)) : Last # No path
(!SkipFirst || G_Counter != 1) ? FadeIn( Frames,Color,FPS) : Last
Return (!SkipLast || G_Counter != G_FILECOUNT) ? FadeOut(Frames,Color,FPS) : Last
}
https://i.postimg.cc/8JtDp01W/Parade-FF-00.jpg (https://postimg.cc/8JtDp01W)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.