FFmpeg Smartblur Filter for Edge Preserving Smoothing
This guide explains how to use the smartblur filter in
FFmpeg to smooth video frames while preserving sharp edges. You will
learn the core parameters of this filter—including radius, strength, and
threshold—and how to apply them using practical command-line examples to
reduce noise without degrading overall image detail.
The smartblur filter works by applying a blur effect
only to pixels that do not form part of an edge. By defining what
constitutes an “edge,” you can smooth out flat areas (like skin, walls,
or skies) while keeping lines and boundaries sharp.
The Smartblur Syntax and Parameters
The basic syntax for the smartblur filter in FFmpeg
is:
-vf "smartblur=luma_radius:luma_strength:luma_threshold:chroma_radius:chroma_strength:chroma_threshold"You can also use named parameters for better readability:
-vf "smartblur=lr=value:ls=value:lt=value:cr=value:cs=value:ct=value"Parameter Breakdown
- Luma Radius (
lr) / Chroma Radius (cr): Controls the size of the blur variance. It accepts a float value from0.1to5.0. A larger radius results in a wider blur area. - Luma Strength (
ls) / Chroma Strength (cs): Controls how heavily the blur is applied. It accepts a float value from-1.0to1.0. Positive values blur the image, while negative values actually sharpen it. - Luma Threshold (
lt) / Chroma Threshold (ct): This is the key to edge preservation. It accepts an integer value from-30to30. It determines the difference in pixel values required to identify an edge.- A lower threshold (e.g.,
2to5) preserves more edges, meaning only very flat areas get blurred. - A higher threshold (e.g.,
10to20) treats fewer transitions as edges, resulting in a heavier, more uniform blur.
- A lower threshold (e.g.,
Note: If you do not specify chroma parameters, they default to the values set for the luma parameters.
Practical Examples
1. Mild Noise Reduction with Strict Edge Preservation
To apply a subtle smoothing effect that strictly preserves edges, use a small radius and a low threshold:
ffmpeg -i input.mp4 -vf "smartblur=lr=1.5:ls=0.5:lt=5" -c:a copy output.mp42. Strong Smoothing for a “Soft-Focus” Look
If you want to smooth out a highly textured background while maintaining the main outlines of your subjects, increase the radius and threshold:
ffmpeg -i input.mp4 -vf "smartblur=lr=3.0:ls=1.0:lt=10" -c:a copy output.mp43. Independent Luma and Chroma Control
To smooth out color noise (chroma) more aggressively than brightness detail (luma), configure the parameters independently:
ffmpeg -i input.mp4 -vf "smartblur=lr=1.0:ls=0.5:lt=5:cr=3.0:cs=1.0:ct=10" -c:a copy output.mp4Tips for Tuning
- Start with Luma: Begin by adjusting only the luma
parameters (
lr,ls,lt). Once the grayscale detail looks correct, adjust the chroma parameters if you notice color bleeding or color noise. - Fine-tune the Threshold First: If your output looks
too blurry and loses detail, lower the threshold (
lt). If the image remains too noisy, gradually increase the threshold until the noise in flat areas disappears.