How to Animate Vignette Color in FFmpeg
This article provides a quick overview and step-by-step guide on how
to create a color-animated vignette effect in FFmpeg. Because FFmpeg’s
native vignette filter only darkens frame edges, achieving
an animated color vignette requires combining a color source, the
hue filter for color shifting, the vignette
filter for shape and movement, and the blend filter to
merge the effect onto your video.
The Challenge with the Vignette Filter
The default vignette filter in FFmpeg is designed to
reduce luminance towards the edges of an image, resulting in a black or
dark shadow. It does not have built-in parameters to change the
vignette’s color. To create a colored, moving vignette, you must
generate a solid color canvas, apply the vignette filter to it to act as
a mask, animate the color and vignette properties over time, and blend
it back onto your original video.
The FFmpeg Command
Use the following command to apply a pulsing, color-changing vignette to your video:
ffmpeg -i input.mp4 -filter_complex "color=color=red[c];[c][0:v]scale2ref[col][vid];[col]hue=h='t*40'[animated_color];[animated_color]vignette='angle=PI/4+sin(t)*PI/12':eval=frame[vig];[vid][vig]blend=all_mode=multiply" -c:a copy output.mp4How the Command Works
The -filter_complex flag handles the creation and
blending of the animated layers using several chained filters:
color=color=red[c]: This generates a solid red color canvas source, labeled as[c].scale2ref: Matches the size of the generated color canvas to the resolution of your input video ([0:v]). This prevents resolution mismatches and outputs the scaled color layer[col]and the video stream[vid].hue=h='t*40': Animates the hue of the color layer over time (trepresents time in seconds). Multiplyingtby40continuously shifts the color across the spectrum, creating a rainbow cycle effect.vignette='angle=PI/4+sin(t)*PI/12':eval=frame: Applies the vignette effect to the animated color layer.eval=frameforces FFmpeg to recalculate the expressions for every frame.anglecontrols the size of the vignette. By using the sine wave functionsin(t), the vignette radius pulses larger and smaller over time.
blend=all_mode=multiply: Blends the animated color vignette layer[vig]with the original video stream[vid]using themultiplyblend mode. This keeps the center of your video clear while applying the animated color effect to the outer edges.