How to Use the FFmpeg gblur Filter
This guide provides a straightforward explanation of how to use the
gblur (Gaussian blur) filter in FFmpeg to apply a smooth
blur effect to your videos. You will learn the basic syntax of the
filter, understand its key parameters like sigma and steps, and view
practical command-line examples for achieving different levels of blur
intensity.
Understanding the gblur Filter
The gblur filter applies a Gaussian blur to an input
video. It is highly effective for softening images, obscuring sensitive
details, or creating artistic background effects. The filter is
controlled primarily by three parameters:
- sigma (or s): Determines the horizontal blur
strength (standard deviation of the Gaussian formula). A higher value
results in a stronger blur. The default value is
0. - steps: Defines the number of steps used to
approximate the Gaussian blur. More steps result in a smoother,
higher-quality blur but require more processing power. The default is
1. - sigmaV: Determines the vertical blur strength. If
this is not specified, it defaults to the same value as
sigma.
Basic Syntax
To apply a basic Gaussian blur to a video, use the -vf
(video filter) flag followed by gblur and your desired
parameters.
ffmpeg -i input.mp4 -vf "gblur=sigma=10" output.mp4In this command, sigma=10 applies a moderate, uniform
blur across both the horizontal and vertical axes of the video.
Practical Examples
1. Applying a Light Blur
For a subtle softening effect, keep the sigma value low.
ffmpeg -i input.mp4 -vf "gblur=sigma=3:steps=1" output.mp42. Applying a Heavy Blur
For a strong blur where details are completely obscured, increase the sigma value.
ffmpeg -i input.mp4 -vf "gblur=sigma=30:steps=3" output.mp4Note: Increasing the steps to 3 ensures the heavy
blur remains smooth without looking pixelated, though rendering will
take longer.
3. Asymmetric Blur (Horizontal Only)
If you want to blur the video horizontally while keeping the vertical
axis sharp, set sigma for horizontal strength and
sigmaV to 0.
ffmpeg -i input.mp4 -vf "gblur=sigma=20:sigmaV=0" output.mp44. Blurring a Specific Portion of the Video (Timeline Editing)
You can use FFmpeg’s timeline editing capability to apply the blur
filter only during a specific timeframe of the video using the
enable option.
ffmpeg -i input.mp4 -vf "gblur=sigma=15:enable='between(t,5,10)'" output.mp4This command applies a blur with a sigma of 15 only between the 5-second and 10-second marks of the video.