Apply Bilateral Filter in FFmpeg for Noise Reduction
This article explains how to use the bilateral filter in FFmpeg to
reduce image and video noise while preserving sharp edges. You will
learn the syntax of the bilateral video filter, understand
its key parameters (spatial and luma/chroma sigma), and see practical
command-line examples to achieve clean, high-quality denoising
results.
Understanding the Bilateral Filter
Unlike a standard Gaussian blur that smooths everything indiscriminately, a bilateral filter considers both spatial distance and pixel intensity differences. It only blurs pixels that are physically close and similar in color or brightness. This allows the filter to smooth out flat, noisy areas while leaving sharp borders and edges intact.
FFmpeg Bilateral Filter Syntax
The bilateral filter in FFmpeg is applied using the -vf
(video filter) flag with the bilateral filter name. The
basic syntax is:
ffmpeg -i input.mp4 -vf "bilateral=spatial_sigma=3.0:range_sigma=0.1" output.mp4
Key Parameters
To fine-tune the noise reduction, you can adjust three primary parameters:
spatial_sigma(ors): Sets the spatial standard deviation. This determines the size of the neighborhood used for blurring. Higher values smooth larger areas but increase processing time. The default is3.0(range: 0.1 to 10.0).range_sigma(orr): Sets the luma range standard deviation. This controls how much pixel intensity variance is allowed before the filter stops blurring across an edge. Lower values preserve edges better, while higher values blur more aggressively. The default is0.1(range: 0.01 to 1.0).chroma_sigma(orc): Sets the chroma range standard deviation. If not specified, it defaults to the same value asrange_sigma. Adjust this separately if you want to target color noise differently than brightness noise.
Practical Command Examples
For mild, everyday noise reduction that retains fine details:
ffmpeg -i input.mp4 -vf "bilateral=spatial_sigma=2.0:range_sigma=0.05" output.mp4
For heavy noise reduction on highly pixelated or grainy footage:
ffmpeg -i input.mp4 -vf "bilateral=spatial_sigma=5.0:range_sigma=0.15" output.mp4
If you want to target only luma noise and leave color information untouched, you can reduce the chroma parameter:
ffmpeg -i input.mp4 -vf "bilateral=spatial_sigma=3.0:range_sigma=0.1:chroma_sigma=0.01" output.mp4