How to Use the FFmpeg sab Filter

This article provides a quick guide on how to use the Shape Adaptive Blur (sab) filter in FFmpeg to apply smart blurring to your videos. You will learn the basic syntax of the filter, understand its key parameters for control over luma and chroma channels, and see practical command-line examples for preserving edges while reducing noise.

Understanding the sab Filter

The sab (Shape Adaptive Blur) filter in FFmpeg is designed to blur smooth areas of an image or video frame while preserving sharp edges. It is highly effective for noise reduction, smoothing skin tones, and creating a clean, stylized look without making the entire video look out of focus.

Filter Syntax and Parameters

The sab filter accepts parameters for both the luma (brightness) and chroma (color) channels. The basic syntax is:

-vf "sab=luma_radius:luma_pre_filter_radius:luma_strength:chroma_radius:chroma_pre_filter_radius:chroma_strength"

Alternatively, you can use named parameters for better readability:

Practical Examples

1. Basic Edge-Preserving Blur

To apply a mild, edge-preserving blur to the luma channel of a video, use the following command:

ffmpeg -i input.mp4 -vf "sab=lr=4.0:lpf=2.0:ls=5.0" -c:a copy output.mp4

2. Denoising and Smoothing Skin Tones

To reduce noise and smooth skin tones while keeping outlines sharp, you can increase the luma strength and apply a mild blur to both luma and chroma:

ffmpeg -i input.mp4 -vf "sab=lr=5:lpf=1:ls=10:cr=3:cpf=1:cs=5" -c:a copy output.mp4

3. Extreme Stylized Blur

For a heavy, painted-like effect where only the strongest borders are preserved, increase the radii and strength:

ffmpeg -i input.mp4 -vf "sab=lr=12.0:lpf=4.0:ls=25.0" -c:a copy output.mp4