Using FFmpeg SABR Filter for Shape Adaptive Blur
The sabr (Shape Adaptive Blur) filter in FFmpeg is an
edge-preserving smoothing filter designed to reduce noise and soften
textures without blurring distinct edges or borders. This guide explains
how the filter functions, details its core configuration parameters, and
provides straightforward command-line examples to help you integrate it
into your video processing workflows.
What is the SABR Filter?
The Shape Adaptive Bilateral (SABR) filter analyzes the local structure of a frame to adapt its blurring shape along edges rather than across them. This makes it ideal for cartoon or anime processing, noise reduction, skin smoothing, and pre-processing tasks where retaining sharp boundaries is critical.
Key Parameters
The sabr filter accepts parameters to independently
control processing for luma (brightness) and chroma (color) planes:
luma_radius(lr): Sets the radius for the shape adaptive blur on the luma plane. Higher values produce stronger blurring over larger areas. The default value is4.luma_pre_filter_radius(lpfr): The radius for the pre-filter used to determine shape boundaries. A smaller value keeps edge detection sharp. The default value is1.luma_strength(ls): The intensity of the blur applied to the luma channel. The default value is1.0.chroma_radius(cr): Sets the radius for the chroma planes. The default value is4.chroma_pre_filter_radius(cpfr): Sets the pre-filter radius for color edge detection. The default value is1.chroma_strength(cs): The intensity of the blur applied to the chroma channels. The default value is1.0.
Basic Usage
To apply the default shape adaptive blur settings to a video, use the following command:
ffmpeg -i input.mp4 -vf "sabr" -c:a copy output.mp4Customizing Luma and Chroma Strength
In most video denoising scenarios, applying stronger smoothing to the luma channel while leaving color boundaries intact is preferred. To increase the luma blur radius and strength while reducing chroma processing:
ffmpeg -i input.mp4 -vf "sabr=lr=8:ls=1.5:cr=2:cs=0.5" -c:v libx264 -crf 18 -c:a copy output.mp4Adjusting Edge Sensitivity
If fine details are being unintentionally blurred, reduce the pre-filter radius to make the filter more sensitive to micro-edges:
ffmpeg -i input.mp4 -vf "sabr=lr=5:lpfr=1:ls=1.2" -c:v libx264 -crf 18 -c:a copy output.mp4Conversely, if the input video contains heavy compression artifacts
that are falsely detected as edges, increasing lpfr will
smooth over the artifacts before edge calculation:
ffmpeg -i input.mp4 -vf "sabr=lr=6:lpfr=2:ls=1.0" -c:v libx264 -crf 18 -c:a copy output.mp4Combining with Other Filters
The sabr filter is computationally intensive. When
processing high-resolution video, it can be combined with format
conversion filters to optimize throughput:
ffmpeg -i input.mp4 -vf "format=yuv420p,sabr=lr=4:ls=1.0" -c:v libx264 -preset medium -crf 20 -c:a copy output.mp4