( Diese Seite in
Deutsch )
As the names imply, FadeIn and FadeOut perform a fade-in and fade-out; FadeIO does both. They are more or less equivalent to Dissolve()-ing the clip with a BlankClip of the proper length and specified color. They also fade the audio; if your clip is only audio, you will need to specify the fps parameter so AviSynth knows how long each frame is.
Each fade filter has three variations: 0, 1, and 2. (The '1' variation is the one without a suffix, e.g. FadeIn). Variation N adds N black frames for each fade operation. To recap:
FadeIO(clip, frames, color, fps) is equivalent to FadeIn(FadeOut(clip, frames, color, fps), fames, colors, fps). As a result, FadeIO adds 2 frames and FadeIO2 adds 4 frames.
The fade operation is linear, to/from black (or whatever you specify for the color parameter). The fading affects only the last num_frames frames of the video, and the corresponding portion of the audio.
The algorithm used by Dissolve() results in the first/last frame being almost, but not quite, the final color. To correct this, the "default" forms (FadeIn and FadeOut) each add a single blank frame, so that things start/end clean.
The 0 variations don't add a blank frame, so the last frame is "dirty".
Variation 2 exists to work around a bug in Windows Media Player, where the very last frame in an MPEG files is not rendered, leaving an ugly not-entirely-black frame on the screen. FadeOut2 adds two blank frames to counteract this; FadeIn2 and FadeIO2 are there for completeness and consistency.
The color parameter is optional, default=0 (black), and is specified as an RGB value regardless of whether the clip format is RGB or YUV based. See Colors for more information on specifying colors.
The fps parameter is optional, default=24.0, and provides a reference for num_frames in audio only clips. It is ignore if a video stream is present. Set fps=AudioRate() if sample exact audio positioning is required.
FadeOut(clip, n) is just a shorthand for Dissolve(clip, Blackness(clip, n+1,color=color), n) (or n+2 instead of n+1 for FadeOut2 and n for FadeOut0).
The following functions will fade a clip in/out completely, like FadeOut, but without affecting the length of the clip. I'm unsure of their influence on audio sync.
function FadeOutX(clip c, int frames)
{
return c.DeleteFrame(c.FrameCount-1).FadeOut(frames);
}
function FadeInX(clip c, int frames)
{
return c.DeleteFrame(0).FadeIn(frames);
}
The following script creates a 30-second clip demonstrating the 9 different Fade functions performed on ColorBars.
# Get three seconds of colorbars at exactly 30fps
# Trim() REALLY should be [start, end), not [start, end]
cb = ColorBars.AssumeFPS(30).Trim(0, 89)
# configure to be what you will.
global n=25
function Apply(clip c, string op) {
op = op=="" ? "Original" : op+"("+string(n)+")"
c = op=="Original" ? c : Eval("c."+op)
return c.Info.Subtitle(op, text_color=color_white, size=24, align=2)
}
cb.Apply("") \
+ cb.Apply("FadeIn0") \
+ cb.Apply("FadeIn") \
+ cb.Apply("FadeIn2") \
+ cb.Apply("FadeOut0") \
+ cb.Apply("FadeOut") \
+ cb.Apply("FadeOut2") \
+ cb.Apply("FadeIO0") \
+ cb.Apply("FadeIO") \
+ cb.Apply("FadeIO2")
# that buzzing sound is ANNOYING
KillAudio
| v2.06 | Till v2.06 the FadeIn/FadeIn2 commands do not exist, but you can get the same effect by reversing the arguments to Dissolve: Dissolve(Blackness(clip, n+1, color=color), clip, n). |
| v2.07 | Added FadeIO/FadeIO2 commands. Added color parameter to all fade functions. |
| v2.56 | FadeIn0 / FadeIO0 / FadeOut0 commands are added and the fps parameter is added to all fade functions. |