FFmpeg Smartblur Edge-Preserving Smoothing Guide
The smartblur filter in FFmpeg is an edge-preserving
smoothing filter designed to reduce visual noise, compress flat
textures, or soften skin without degrading the sharp lines and
boundaries in a video. This guide explains how the filter functions,
details each of its parameters, and provides practical command-line
examples for video processing.
Understanding the Parameters
The smartblur filter works by calculating local
variance: regions with low contrast are blurred, while areas with high
contrast are recognized as edges and retained. The filter accepts six
primary parameters:
luma_radius(lr): Controls the size of the blur footprint on luminance. Allowed values range from0.1to5.0. A larger radius smooths wider areas. (Default:1.0)luma_strength(ls): Determines the intensity of the blur. Allowed values range from-1.0to1.0. Positive values blur flat regions, while negative values invert the effect to produce edge sharpening. (Default:1.0)luma_threshold(lt): The edge detection sensitivity threshold. Allowed values range from-30to30. Pixels with differences smaller than this threshold are smoothed, while differences exceeding it are treated as edges and left untouched. (Default:0)chroma_radius(cr): Sets the blur radius for the color channels (0.1 to 5.0).chroma_strength(cs): Sets the blur strength for the color channels (-1.0 to 1.0).chroma_threshold(ct): Sets the edge threshold for color channels (-30 to 30).
If chroma parameters are omitted, they automatically inherit the values defined for luma.
Basic Syntax
To use smartblur, pass it through FFmpeg's video filter
flag (-vf):
ffmpeg -i input.mp4 -vf "smartblur=lr=1.5:ls=0.8:lt=-5" -c:a copy output.mp4Practical Use Cases
1. Subtle Denoising and Skin Softening
For light noise removal or skin smoothing, use a moderate radius, a positive strength, and a negative threshold. A negative threshold prevents the filter from smoothing over subtle gradient shifts that define facial features or texture boundaries.
ffmpeg -i input.mp4 -vf "smartblur=lr=2.0:ls=0.6:lt=-8" -c:v libx264 -crf 18 -c:a copy output.mp42. Stylized Painterly Effect
Increasing both the radius and the threshold causes the filter to treat broader tonal variations as flat areas, producing a flat, painterly aesthetic while keeping distinct outlines intact.
ffmpeg -i input.mp4 -vf "smartblur=lr=5.0:ls=1.0:lt=15" -c:v libx264 -crf 18 -c:a copy output.mp43. Edge-Preserving Sharpening
By setting luma_strength to a negative value, the filter
sharpens details that cross the defined threshold instead of smoothing
them.
ffmpeg -i input.mp4 -vf "smartblur=lr=1.5:ls=-0.7:lt=-10" -c:v libx264 -crf 18 -c:a copy output.mp4Best Practices for Tuning
- Adjust
ltfirst: Keeplraround1.5andlsat1.0, then adjustltbetween-15and10until only the intended flat regions blur. - Preview short clips: Use
-ssand-t(e.g.,-ss 00:00:10 -t 5) to render short test segments to fine-tune the parameters before processing long files.