How to Use the FFmpeg fspp Filter
This article provides a practical guide on how to use the
fspp (Fast Simple Postprocessing) filter in FFmpeg to
improve video quality. You will learn what the fspp filter
is, how it works to reduce compression artifacts, and how to apply it to
your video processing workflows using clear, real-world command-line
examples.
What is the FFmpeg fspp Filter?
The fspp filter is a fast post-processing filter in
FFmpeg designed to reduce compression artifacts—such as blocking,
mosquito noise, and banding—commonly found in highly compressed videos
(like MPEG-based formats). It is a faster, highly optimized version of
the older spp (Simple Postprocessing) filter, making it
ideal for real-time playback or faster encoding pipelines.
It works by applying a Discrete Cosine Transform (DCT) and Inverse Discrete Cosine Transform (IDCT) thresholding process to smooth out blocky edges while preserving the actual details of the video.
Syntax and Key Parameters
The basic syntax for applying the filter in a video filtergraph is:
-vf "fspp=parameter1=value1:parameter2=value2"The filter accepts several optional parameters to customize its behavior:
quality: Sets the post-processing quality. It accepts integer values from1to6(or0to5depending on the FFmpeg build, with higher numbers yielding better quality but slower processing). The default is typically4.qp: Forces a specific Quantization Parameter (QP). If not set, the filter automatically uses the QP values from the input video stream.strength: Adjusts the filter strength. The range is-15to32. The default is0. Higher values increase the smoothing effect, which can help with heavy blocking but may blur fine details.use_bframe_qp: Enables or disables the use of B-frame QP values (0 for disable, 1 for enable). The default is0.
Practical Command Examples
1. Basic Usage (Default Settings)
To apply the filter with its default settings to clean up a blocky video, use the following command:
ffmpeg -i input.mp4 -vf "fspp" output.mp42. Increasing the Quality and Strength
If you are dealing with a highly compressed, low-quality video, you can increase both the quality and the strength of the filter to aggressively smooth out artifacts:
ffmpeg -i input.mp4 -vf "fspp=quality=5:strength=10" output.mp43. Forcing a Constant Quantization Parameter
If your source video does not store QP information (which is common in some modern codecs or container formats), you can force the filter to use a specific QP value to control the intensity of the deblocking:
ffmpeg -i input.mp4 -vf "fspp=qp=25" output.mp4Note: A higher QP value forces stronger deblocking, while a lower QP value keeps the filtering mild.
When Should You Use fspp?
- Restoring Legacy Video: It is highly effective for improving the visual quality of old, low-resolution AVI, DivX, or early MP4 files.
- Pre-processing for Re-encoding: Applying
fsppbefore re-encoding a noisy video can improve compression efficiency, resulting in a smaller file size for the new output. - Speed-Critical Workflows: Use
fsppinstead ofsppwhen you need a deblocking filter but require faster rendering times or lower CPU usage.