How to Use the FFmpeg sabr Filter
This guide demonstrates how to apply the Shape Adaptive Bilateral
(sabr) filter in FFmpeg to achieve high-quality video
denoising and smoothing. You will learn the filter’s syntax, its core
parameters for controlling luma and chroma, and practical command-line
examples to enhance your video processing pipelines while preserving
sharp image edges.
What is the sabr Filter?
The sabr filter is a Shape Adaptive Bilateral
Filter used for image and video denoising. Unlike standard
bilateral filters, which use fixed-size circular or square windows to
blur noise while preserving edges, the shape-adaptive bilateral filter
adapts its shape to the local features of the image. This prevents the
“halo” artifacts commonly associated with aggressive bilateral
filtering, making it highly effective for smoothing flat areas while
keeping outlines and fine details incredibly sharp.
Syntax and Key Parameters
To use the sabr filter, you apply it to the video filter
(-vf) graph. The filter accepts four primary parameters to
control the spatial and range (color intensity) sensitivity for both the
luma (brightness) and chroma (color) channels:
luma_spatial/lsp: Controls the spatial sigma for the luma channel. A higher value increases the blur radius on the brightness channel. (Range:1.0to10.0, Default:1.0)luma_range/lr: Controls the range sigma for the luma channel. It determines how similar a pixel’s brightness must be to the center pixel to be smoothed. Higher values blur more distinct edges. (Range:0.01to1.0, Default:0.08)chroma_spatial/csp: Controls the spatial sigma for the chroma channels. (Range:1.0to10.0, Default:1.0)chroma_range/cr: Controls the range sigma for the chroma channels. (Range:0.01to1.0, Default:0.08)
Practical FFmpeg Examples
1. Basic Application (Default Settings)
If you want to apply the filter using its default settings, run the following command:
ffmpeg -i input.mp4 -vf "sabr" output.mp4This applies a mild, edge-preserving denoise to your video using the
default spatial sigma of 1.0 and range sigma of
0.08 for both luma and chroma.
2. Strong Denoising for Flat Areas
To remove heavy noise or compression artifacts from a video with large, flat color areas (such as animation or sky backdrops), you can increase both the spatial and range parameters:
ffmpeg -i input.mp4 -vf "sabr=lsp=3.0:lr=0.15:csp=2.0:cr=0.1" output.mp4lsp=3.0increases the luma blur radius for stronger smoothing.lr=0.15allows pixels with slightly higher brightness differences to be blended, smoothing out heavier noise.
3. Preserving Fine Details (Conservative Denoising)
To clean up low-light noise in high-detail footage without making the video look plastic or overly smoothed, lower the range sigmas:
ffmpeg -i input.mp4 -vf "sabr=lsp=1.5:lr=0.04:csp=1.5:cr=0.04" output.mp4- Keeping the range sigmas (
lrandcr) low at0.04ensures that only very similar pixels are smoothed, leaving sharp edges and fine textures completely untouched.