FFmpeg BM3D Denoising Filter Configuration Guide
This article explains the function of the bm3d
(Block-Matching and 3D filtering) denoising filter in FFmpeg and
provides a practical guide on how to configure its parameters. You will
learn how this advanced algorithm reduces video noise and how to
implement it in your FFmpeg command-line workflows for high-quality
video processing.
What is the BM3D Denoising Filter?
The bm3d filter in FFmpeg is an implementation of the
Block-Matching and 3D filtering algorithm. It is highly regarded as one
of the most effective denoising algorithms for both spatial and temporal
noise.
The filter works in three main steps: 1. Grouping (Block-Matching): It searches the video frame for similar blocks (patches of pixels) and groups them into 3D data arrays. 2. Collaborative Filtering: It applies a 3D transform (such as a Wavelet or DCT transform) to the grouped blocks, filters out the noise in the transform domain, and then performs an inverse transform. 3. Aggregation: It returns the filtered blocks to their original positions, averaging overlapping pixels to reconstruct a clean, denoised image.
Because of this intensive mathematical process, the bm3d
filter provides exceptionally clean output while preserving fine details
and edges, though it is computationally expensive and slow compared to
simpler filters like hqdn3d or nlmeans.
How to Configure the BM3D Filter in FFmpeg
To use the bm3d filter, you must pass it to the video
filter (-vf) flag in FFmpeg. The filter accepts several
parameters that allow you to balance processing speed and denoising
quality.
Key Parameters
sigma: Sets the noise standard deviation (the strength of the filter). Higher values result in stronger denoising but may blur fine details. The default is1.0. For visible noise, values between5.0and15.0are common.block: Size of the local blocks used for matching (e.g.,8for 8x8 pixels). Smaller blocks preserve more detail but increase processing time. Default is8.step: The sliding step of the blocks. A smaller step size (e.g.,4or2) improves quality by analyzing more overlapping blocks, but significantly slows down processing. Default is4.group: The maximum number of similar blocks to group together in a 3D array. Higher values can improve denoising in repetitive patterns. Default is16.range: The search range (in pixels) for finding similar blocks. A larger range helps find matches in fast-moving or complex scenes but increases computation time. Default is9.estim: Enables a two-pass estimation process. Setting this tobasicperforms only the first step (faster but lower quality), whilefinal(default) performs the full collaborative filtering for maximum quality.
Command Examples
1. Basic Denoising (Fastest Settings) If you want to apply light denoising without completely halting your CPU, use a larger step size and a moderate sigma:
ffmpeg -i input.mp4 -vf "bm3d=sigma=5:block=8:step=6:group=8:range=7" output.mp42. High-Quality Denoising (Recommended) For standard high-quality denoising where processing speed is not the primary concern:
ffmpeg -i input.mp4 -vf "bm3d=sigma=10:block=8:step=4:group=16:range=9" output.mp43. Maximum Quality Denoising (Very Slow) To extract the maximum possible detail out of a very noisy video, reduce the step size and increase the search range:
ffmpeg -i input.mp4 -vf "bm3d=sigma=15:block=8:step=2:group=32:range=15" output.mp4