How to Use the spp Filter in FFmpeg

This article provides a straightforward guide on how to use the spp (Simple Postprocessing) filter in FFmpeg to reduce compression artifacts and improve video quality. You will learn the basic syntax of the filter, understand its key parameters, and see practical examples of how to apply it to your video processing workflows.

Understanding the spp Filter

The spp (Simple Postprocessing) filter in FFmpeg is designed to reduce compression artifacts, such as blockiness and ringing, which often occur in highly compressed MPEG-like videos. It works by applying a deblocking and deringing algorithm to the video frames, making the output look smoother and more visually appealing.

Filter Syntax and Parameters

The basic syntax for applying the filter in an FFmpeg command is:

-vf "spp=parameter1=value1:parameter2=value2"

The filter accepts several optional parameters to customize its behavior:

Practical Examples

Here are the most common ways to use the spp filter in your FFmpeg commands.

1. Basic Usage (Default Settings)

To apply the filter with its default settings (quality level 3), use the following command:

ffmpeg -i input.mp4 -vf "spp" output.mp4

2. Enhancing Quality

To get the best possible artifact reduction, increase the quality parameter to 6. Note that this will require more processing power and take longer to encode:

ffmpeg -i input.mp4 -vf "spp=quality=6" output.mp4

3. Setting a Custom Quantization Parameter (QP)

If you are working with a video that has lost its original QP metadata, you can manually force a QP value (for example, 20) to control the strength of the deblocking effect:

ffmpeg -i input.mp4 -vf "spp=quality=4:qp=20" output.mp4

4. Using Soft Thresholding

For a smoother, less aggressive filtering effect, you can change the mode to soft thresholding (1):

ffmpeg -i input.mp4 -vf "spp=mode=1" output.mp4