Fade

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (added category)
(formatting, links, phrasing)
Line 1: Line 1:
{{Template:Func3Def|FadeIn(clip ''clip'', int ''num_frames'' [, int ''color''] [, float ''fps''])|FadeIO(clip ''clip'', int ''num_frames'' [, int ''color''] [, float ''fps''])|FadeOut(clip ''clip'', int ''num_frames'' [, int ''color''] [, float ''fps''])}}
+
{| border="0"
 +
|-
 +
|'''FadeIn'''
 +
|blends progressively ''from'' {{FuncArg|color}} at the beginning.
 +
|-
 +
|'''FadeOut'''
 +
|blends progressively ''to'' {{FuncArg|color}} at the end.
 +
|-
 +
|'''FadeIO'''
 +
|blends progressively from/to {{FuncArg|color}} at ''both'' ends.
 +
|}
 +
 
 +
<div style="max-width:68em" >
 +
*The sound track (if present) also fades linearly to and/or from silence. 
 +
 
 +
*The fading affects only the first/last {{FuncArg|num_frames}} frames of the video.
 +
{{HalfBreak}}
 +
*The first/last frame of the video becomes almost-but-not-quite {{FuncArg|color}}.
 +
<div {{ListItemContinue}}>
 +
An additional {{FuncArg|color}} frame is added at the start/end, thus increasing the total frame count by one (or for '''FadeIO''', by two).
 +
</div>
 +
{{HalfBreak}}
 +
*'''FadeIn'''{{BoldColor|blue|100|0}} / '''FadeOut'''{{BoldColor|blue|100|0}} / '''FadeIO'''{{BoldColor|blue|100|0}} do not add the extra {{FuncArg|color}} frames, leaving the end(s) almost-but-not-quite {{FuncArg|color}}.
 +
 
 +
*'''FadeIn'''{{BoldColor|blue|100|2}} / '''FadeOut'''{{BoldColor|blue|100|2}} / '''FadeIO'''{{BoldColor|blue|100|2}} add ''two'' extra {{FuncArg|color}} frames at the start/end instead of one.
 +
</div>
 +
__NOTOC__
 +
 
 +
== Syntax and Parameters ==
 +
<div style="max-width:68em" >
 +
{{Func3Def
 +
|FadeIn(clip ''clip'', int ''num_frames'' [, int ''color'' , float ''fps'' ] )
 +
|FadeOut(clip ''clip'', int ''num_frames'' [, int ''color'' , float ''fps'' ] )
 +
|FadeIO(clip ''clip'', int ''num_frames'' [, int ''color'' , float ''fps'' ] )
 +
}}
 +
 
 +
 
 +
{{Func3Def
 +
|FadeIn0(clip ''clip'', int ''num_frames'' [, int ''color'' , float ''fps'' ] )
 +
|FadeOut0(clip ''clip'', int ''num_frames'' [, int ''color'' , float ''fps'' ] )
 +
|FadeIO0(clip ''clip'', int ''num_frames'' [, int ''color'' , float ''fps'' ] )
 +
}}
 +
 
 +
 
 +
{{Func3Def
 +
|FadeIn2(clip ''clip'', int ''num_frames'' [, int ''color'' , float ''fps'' ] )
 +
|FadeOut2(clip ''clip'', int ''num_frames'' [, int ''color'' , float ''fps'' ] )
 +
|FadeIO2(clip ''clip'', int ''num_frames'' [, int ''color'' , float ''fps'' ] )
 +
}}
 +
 
  
{{Template:Func3Def|FadeIn0(clip ''clip'', int ''num_frames'' [, int ''color''] [, float ''fps''])|FadeIO0(clip ''clip'', int ''num_frames'' [, int ''color''] [, float ''fps''])|FadeOut0(clip ''clip'', int ''num_frames'' [, int ''color''] [, float ''fps''])}}
+
:{{Par2|clip|clip|}}
 +
::Source clip; all AviSynth [[Convert|color formats]] accepted.
  
{{Template:Func3Def|FadeIn2(clip ''clip'', int ''num_frames'' [, int ''color''] [, float ''fps''])|FadeIO2(clip ''clip'', int ''num_frames'' [, int ''color''] [, float ''fps''])|FadeOut2(clip ''clip'', int ''num_frames'' [, int ''color''] [, float ''fps''])}}
+
:{{Par2|num_frames|int|}}
 +
::Fade duration.
  
FadeOut and FadeOut2 cause the video stream to fade linearly to black or the specified RGB color at the end. Similarly FadeIn and FadeIn2 cause the video stream to fade linearly to black or the specified RGB color at the start when watching the clip backwards. FadeIO and FadeIO2 are a combination of their respective FadeIn and FadeOut functions. The sound track (if present) also fades linearly to or from silence. The fading affects only the last ''num_frames'' frames of the video. The last frame of the video becomes almost-but-not-quite black (or the specified color). An additional perfectly black (or the specified color) frame is added at the end, thus increasing the total frame count by one.  
+
:{{Par2|color|int|$000000}}
 +
::Specifies the start/end color; black by default.  
 +
::*See [[Color_presets|Color presets]] for preset (named) colors.  
 +
::*See [[Colors]] for more information on specifying colors numerically.
  
FadeOut2 works similarly, except that two black (or color) frames are added at the end instead of one. The only purpose of this is to work around a bug in Windows Media Player. All the WMP versions that I've tested fail to play the last frame of an MPEG file--instead, they stop on the next-to-last frame when playback ends. This leaves an unsightly almost-but-not-quite-black frame showing on the screen when the movie ends if you use FadeOut. FadeOut2 avoids this problem.  
+
:{{Par2|fps|float|24.0}}
 +
::Provides a reference for {{FuncArg|num_frames}} in audio only clips. It is ignored if a video stream is present.
 +
::*Set {{FuncArg|fps}}=[[Clip_properties|AudioRate]] if sample exact audio positioning is required.
 +
</div>
  
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 ignored if a video stream is present. Set fps=AudioRate() if sample exact audio positioning is required.
+
== Notes ==
 +
<div {{BoxWidthIndent|48|0}} >
 +
FadeOut(clip, {{FuncArg|num_frames}})
 +
</div>
 +
is just a shorthand for
 +
<div {{BoxWidthIndent|48|0}} >
 +
[[Dissolve]](clip, [[BlankClip]](clip, {{FuncArg|num_frames}}+1, color={{FuncArg|color}}), {{FuncArg|num_frames}})
 +
</div>
 +
(with num_frames+'''2''' instead of num_frames+'''1''' for <tt>FadeOut2</tt>, and num_frames+'''0''' for <tt>FadeOut0</tt>).
  
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).
 
  
'''Changes:'''
+
== Changes ==
 +
<div style="max-width:56em" >
 
{| border="1"
 
{| border="1"
 
|-  
 
|-  
Line 27: Line 91:
 
| 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'').
 
| 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'').
 
|}
 
|}
 +
</div>
  
  
 
[[Category:Internal filters]]
 
[[Category:Internal filters]]
 
[[Category:Timeline_editing_filters]]
 
[[Category:Timeline_editing_filters]]

Revision as of 00:33, 15 February 2016

FadeIn blends progressively from color at the beginning.
FadeOut blends progressively to color at the end.
FadeIO blends progressively from/to color at both ends.
  • The sound track (if present) also fades linearly to and/or from silence.
  • The fading affects only the first/last num_frames frames of the video.
 
  • The first/last frame of the video becomes almost-but-not-quite color.

An additional color frame is added at the start/end, thus increasing the total frame count by one (or for FadeIO, by two).

 
  • FadeIn0 / FadeOut0 / FadeIO0 do not add the extra color frames, leaving the end(s) almost-but-not-quite color.
  • FadeIn2 / FadeOut2 / FadeIO2 add two extra color frames at the start/end instead of one.


Syntax and Parameters

FadeIn(clip clip, int num_frames [, int color , float fps ] )
FadeOut(clip clip, int num_frames [, int color , float fps ] )
FadeIO(clip clip, int num_frames [, int color , float fps ] )


FadeIn0(clip clip, int num_frames [, int color , float fps ] )
FadeOut0(clip clip, int num_frames [, int color , float fps ] )
FadeIO0(clip clip, int num_frames [, int color , float fps ] )


FadeIn2(clip clip, int num_frames [, int color , float fps ] )
FadeOut2(clip clip, int num_frames [, int color , float fps ] )
FadeIO2(clip clip, int num_frames [, int color , float fps ] )


clip  clip =
Source clip; all AviSynth color formats accepted.
int  num_frames =
Fade duration.
int  color = $000000
Specifies the start/end color; black by default.
  • See Color presets for preset (named) colors.
  • See Colors for more information on specifying colors numerically.
float  fps = 24.0
Provides a reference for num_frames in audio only clips. It is ignored if a video stream is present.
  • Set fps=AudioRate if sample exact audio positioning is required.


Notes

FadeOut(clip, num_frames)

is just a shorthand for

Dissolve(clip, BlankClip(clip, num_frames+1, color=color), num_frames)

(with num_frames+2 instead of num_frames+1 for FadeOut2, and num_frames+0 for FadeOut0).


Changes

v2.56 FadeIn0/FadeIO0 /FadeOut0 commands are added and the fps parameter is added to all fade functions.
v2.07 Added FadeIO/FadeIO2 commands. Added color parameter to all fade functions.
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).
Personal tools