How to Apply Vignette Effect to Video with FFmpeg
This article provides a quick guide on how to use the FFmpeg
vignette filter to add a classic, darkened border effect to
your videos. You will learn the basic command structure, how to adjust
the intensity and size of the vignette, how to change its center point,
and how to customize its aspect ratio for different video
dimensions.
The Basic Vignette Command
To apply a standard vignette effect to a video using FFmpeg, use the
-vf (video filter) flag followed by the
vignette filter.
ffmpeg -i input.mp4 -vf "vignette" output.mp4This command applies the default vignette parameters, which gently darkens the corners of the video frame.
Customizing the Vignette Parameters
The vignette filter allows you to control several
parameters to get the exact look you want. The most commonly used
options are:
angle(ora): Controls the lens angle. This essentially adjusts the size and intensity of the vignette. The value is expressed in radians (default isPI/5). Smaller values create a larger, darker vignette that reaches closer to the center, while larger values push the vignette further to the edges.x0andy0: Sets the center coordinates of the vignette. By default, it is centered (w/2andh/2).aspect: Adjusts the aspect ratio of the vignette. By default, it matches the input video’s aspect ratio.
Adjusting Intensity and Size
To make the vignette more pronounced (smaller circle, darker edges),
decrease the angle parameter. For a subtle effect, increase
the angle.
Strong Vignette Effect:
ffmpeg -i input.mp4 -vf "vignette=angle=PI/6" output.mp4Subtle Vignette Effect:
ffmpeg -i input.mp4 -vf "vignette=angle=PI/3" output.mp4Changing the Center of the Vignette
If your subject is not in the center of the frame, you can move the
vignette center using the x0 and y0
parameters.
To shift the center of the vignette to the top-left quadrant of the video:
ffmpeg -i input.mp4 -vf "vignette=x0=w/4:y0=h/4" output.mp4Changing the Vignette Shape (Aspect Ratio)
By default, the vignette stretches to match your video shape. If you
want a perfectly circular vignette on a widescreen video, you can set
the aspect parameter to 1:
ffmpeg -i input.mp4 -vf "vignette=aspect=1" output.mp4Creating a Dynamic (Pulsing) Vignette
FFmpeg allows you to use mathematical expressions with the
eval=frame parameter to animate the vignette over time. The
following command uses the sine function (sin) and the time
variable (t) to make the vignette pulse:
ffmpeg -i input.mp4 -vf "vignette='angle=PI/4+sin(t)*0.1':eval=frame" output.mp4