How to Use the FFmpeg Smartblur Filter
The FFmpeg smartblur filter is a powerful video
processing tool used to reduce noise and smooth out details in a video
while preserving sharp edges. This guide explains how the
smartblur filter works, details its customizable parameters
(including radius, strength, and threshold for both luma and chroma
channels), and provides practical command-line examples to help you
integrate it into your video editing workflow.
Understanding the Smartblur Parameters
The smartblur filter applies a selective blur. It
calculates the difference between pixels, and if the difference is below
a specified threshold, it applies the blur. If the difference is above
the threshold, it assumes the pixel is part of an edge and leaves it
sharp.
The filter uses the following syntax:
smartblur=luma_radius:luma_strength:luma_threshold:chroma_radius:chroma_strength:chroma_threshold
You can also use the shorthand named parameters: *
luma_radius (lr) / chroma_radius
(cr): Allowed range is 0.1 to
5.0. This defines the size of the blur variance. A higher
radius results in a wider blur area. * luma_strength
(ls) / chroma_strength
(cs): Allowed range is -1.0 to
1.0. Positive values blur the image, while negative values
act as a sharpener. * luma_threshold (lt)
/ chroma_threshold (ct): Allowed range is
-30 to 30. This determines how different a
pixel must be from its neighbors to be considered an edge. A higher
value means more pixels are blurred; a lower (or negative) value
preserves more edges.
If chroma parameters are not specified, they default to the values set for the luma parameters.
Practical Command Examples
Here are three common ways to use the smartblur filter
in your terminal.
1. Basic Noise Reduction (Smoothing)
To apply a moderate blur that smooths out skin tones or background noise while keeping the main outlines sharp, use:
ffmpeg -i input.mp4 -vf "smartblur=lr=1.5:ls=0.5:lt=-3" output.mp4In this command: * lr=1.5 sets a moderate blur radius. *
ls=0.5 applies a half-strength blur. * lt=-3
ensures that even subtle edges are protected from being blurred.
2. Advanced Independent Chroma and Luma Control
If you want to blur the color (chroma) channels more aggressively than the brightness (luma) channel to fix color bleeding:
ffmpeg -i input.mp4 -vf "smartblur=lr=1.0:ls=0.3:lt=-2:cr=3.0:cs=0.8:ct=-5" output.mp4This applies a light, edge-preserving blur to the luma channel, but a much wider and stronger blur to the chroma channel to blend colors smoothly.
3. Image Sharpening
Because the strength parameter accepts negative values, you can use
smartblur to sharpen an image without amplifying
high-frequency noise:
ffmpeg -i input.mp4 -vf "smartblur=lr=1.0:ls=-0.8:lt=-5" output.mp4By setting ls=-0.8 (negative strength) and a low
threshold of -5, FFmpeg sharpens the existing edges in the
video while leaving flat areas untouched, avoiding the introduction of
unwanted grain.