How to Use the FFmpeg Vignette Filter
This article provides a practical guide on how to use the
vignette video filter in FFmpeg to create a classic
vignette effect. You will learn the basic syntax, understand the key
parameters such as angle, aspect ratio, and center coordinates, and
explore real-world command-line examples to customize the shading
intensity and position on your videos.
The vignette filter in FFmpeg points focus toward the
center of the frame by gradually darkening the outer edges of the video.
It is commonly used for artistic styling, simulating vintage camera
lenses, or reducing distractions at the borders of a shot.
Basic Syntax
To apply the default vignette effect to a video, use the
-vf (video filter) flag followed by
vignette:
ffmpeg -i input.mp4 -vf "vignette" output.mp4Key Parameters
You can customize the vignette by passing specific parameters in a
key=value format, separated by colons.
angle(ora): Sets the lens angle in radians. This determines the size and falloff of the vignette. The default isPI/5(approx. 0.62). Lowering this value (e.g.,0.3) increases the dark border size, while raising it makes the vignette smaller and subtler.x0andy0: Set the center coordinates of the vignette. By default, these are set to the center of the video (w/2andh/2).aspect: Sets the aspect ratio of the vignette. The default is the input video’s aspect ratio, which creates an elliptical vignette. Setting this to1creates a perfect circle.eval: Specifies when to evaluate the expressions. Set toinit(default) to calculate once at startup, orframeto recalculate for every frame (useful for animations).
Practical Examples
1. Creating a Stronger Vignette
To make the darkened borders more prominent, decrease the
angle value.
ffmpeg -i input.mp4 -vf "vignette=angle=0.3" output.mp42. Creating a Circular Vignette
By default, the vignette stretches to match the widescreen aspect
ratio. To force a circular shape, set the aspect parameter
to 1:
ffmpeg -i input.mp4 -vf "vignette=aspect=1" output.mp43. Shifting the Vignette Center
If your subject is not in the middle of the frame, you can move the
center of the vignette using x0 and y0
coordinates:
ffmpeg -i input.mp4 -vf "vignette=x0=w/4:y0=h/3" output.mp44. Creating an Animated “Pulsing” Vignette
By setting eval=frame, you can use the time variable
t to make the vignette animate over time. This command
creates a pulsing heartbeat effect:
ffmpeg -i input.mp4 -vf "vignette='angle=0.4+0.15*sin(2*PI*t)':eval=frame" output.mp4