Video transitions

Crossfade

This transition effect smoothly merges two input videos. Video A gradually becomes more transparent while video B's transparency decreases. Only video A is visible at the beginning of crossfade and only B at the end; both are at varying stage of semitransparency in between these extremes, combined into single video.

Table 4.72. Original images and their crossfade


GUI dialog description

The dialog allows to set the rate of crossfade transition.

Network parameters

The following table lists the filter's parameters in network file format.

Table 4.73. Crossfade parameters

ParameterValuesDescriptionRequiredDefault value
transitionCrossfadetransition nameyes 
ratereal > 0rate of crossfadeno1 (uniform)

Fade

Fades the outfading clip (the source) out to a single-colored canvas which is then faded into the infading clip (the destination of transition). The end of fade out as well as the beginning of fade in may be set so the two clip may even crossfade. Also, the rates of these fades can be modified. It is possible to vary the color of canvas, thus creating dynamic background. Fade is a common transition used almost everywhere.

Table 4.74. [1] image A, [2] image B, [3]image faded from A and B


GUI dialog description

The dialog allows to set the end of fade out and the beginning of the fade in (in percentage of the clip's length), as well as the rate of both fades. There's a color button in order to pick the color of background. If 'dynamic' box is checked, corresponding button appears so that the background color at the end of the clip could be set; the rate slider affects the rate of variation of these color from the beginning to the end. If 'autoscale' is checked, the contributions of the infading clip and the outfading clip are scaled so that the result brightness doesn't overflow.

Network parameters

The following table lists the filter's parameters in network file format.

Table 4.75. Fade parameters

ParameterValuesDescriptionRequiredDefault value
videotransitionFadefilter nameyes 
fade_outreal (0, 1)the end of fade out relative to the length of clipno0.5 (middle of the clip)
fade_inreal (0, 1)the start of fade in relative to the length of clipno0.5 (middle of the clip)
color_Rreal (0, 255)value of the red channel (RGB) in the background colorno0 (black)
color_R_2real (0, 255)value of the red channel (RGB) in the background color at the endnocolor_R (constant channel value)
color_Greal (0, 255)value of the green channel (RGB) in the background colorno0 (black)
color_G_2real (0, 255)value of the green channel (RGB) in the background color at the endnocolor_G (constant channel value)
color_Breal (0, 255)value of the blue channel (RGB) in the background colorno0 (black)
color_B_2real (0, 255)value of the blue channel (RGB) in the background color at the endnocolor_B (constant channel value)
autoscaleboolean (0 or 1)scale the composed brigthness against overflowno1
rate_outreal > 0rate of fade outno1 (uniform)
rate_inreal > 0rate of fade inno1 (uniform)
rate_colorreal > 0rate of interpolation of background colorno1 (linear interpolation)

Implementation notes

The YUV or RGB mode is required, hence the YV12, RGB24, RGBA32 and RGB32 formats are supported. The YV12 format, however, supports only frames with even dimensions so when either the width or the height of the frame are of odd dimensions, the frame is converted to the RGB24 format. If the YUV mode is used, the color_*(_2) parameters are converted to their corespondents in YUV.

The algorithm is easy, but has a lot of parameters. For every output frame the ratio between background color at the beginning and at the end of the clip as well as the contribution of frames from the outfading and the infading clip are figured out, according to the rate_* parameters and the relative position of the frame. The frames from both tracks are opened in one of supported formats. The algorithm just runs through the image and for every pixel counts its intensity as a weighted sum of the intensities of the outfading frame, the infading frame and the background color.

For example, format_out = 0.25, format_in = 0.5, rate_in = 0.5 settings mean that during the first quarter of the clip the outfading clip is fading out to black, during the second quarter black background is viewed and during the last half the infading clip is fading in from black, slowly at first, then quicker and quicker. It's more than one would expect from a fade, isn't it?

Sweep

This is a transition between two video streams; the outgoing clip sweeps the ingoing clip in the selected direction (to the right, to the left, downwards, upwards).

Table 4.76. Original images and their sweep


GUI dialog description

The dialog allows you to set the sweep direction and rate. The default rate in the middle of the slider corresponds to a linear sweep; the lower and higher values make the sweep slower or faster, respectively.

Network parameters

The following table lists the transition's parameters in network file format.

Table 4.77. Sweep parameters

ParameterValuesDescriptionRequiredDefault value
transitionSweeptransition nameyes 
directionleft, right, up, downsweep directionnoright
ratepositive realsweep rateno1 (=linear)