Vapoursynth Fade (in/out)

From wiki.selur.net
Jump to navigation Jump to search

Fade (in/out) fades the picture up from black at the start of the clip and/or down to black at the end. It needs no extra plugins.

Filtering → Vapoursynth → Other

Fade (in/out) controls in Hybrid
Fade (in/out) controls in Hybrid

What it does

The first or last frames are blended with a black frame; the weight goes linearly from full black to the unchanged picture. The clip keeps its length, and audio is not touched.

  • Fade-in over N frames: frame 0 is black, the following frames get lighter, frame N is the original.
  • Fade-out over N frames: the last N frames get darker, the very last frame is black.

Requirements

  • None; works on all platforms.

Settings

Control Parameter Range / values Hybrid default Meaning
in fadein 0 – 100000 0 Frames faded up from black; 0 = no fade-in.
out fadeout 0 – 100000 0 Frames faded down to black; 0 = no fade-out.

Example

Fade in 25 and fade out 25 frames (both are 0 by default, which writes nothing), on a 10-bit YUV 4:2:0 source (640x356, 25 fps):

# adding fade-in
clip = fade.fadein(clip, 25, limited=True)
# adding fade-out
clip = fade.fadeout(clip, 25, limited=True)

How Hybrid calls it

  • Fade-in and fade-out are separate steps, each only when its value is above 0; with both at 0 the filter is skipped.
  • Works in any color format and on interlaced material without conversion.
  • Black is the clip's black level: video black (16 at 8 bit) on limited-range integer YUV and gray clips, 0 otherwise.
  • Every frame of the clip is handled separately when the script is built, so very long clips make script loading slow.
  • A value larger than the clip length is accepted; the fade then does not complete within the clip.
  • Fade (in/out) also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

Fade in Hybrid's scripts

The fade comes from Hybrid's script collection and is based on a doom9 forum post: a one-frame black clip is merged with each frame at a weight that grows or shrinks per frame, and the frames are spliced back together. AviSynth's FadeIn/FadeOut also fade audio and, in their default variants, add extra solid frames; this fade adds none.

Sources