Reduce Video Blockiness with FFmpeg fspp Filter

This article explains how to use the fspp (Fast Simple Post Processing) filter in FFmpeg to eliminate blockiness and compression artifacts from low-bitrate videos. You will learn the basic command syntax, key parameters for fine-tuning the filter, and practical examples to improve your video playback quality.

Understanding the fspp Filter

The fspp filter is a fast post-processing filter designed to reduce compression artifacts, particularly "blocking" and "ringing" caused by heavy video compression. It works by applying a Discrete Cosine Transform (DCT) deblocking algorithm, smoothing out pixelated blocks and making low-quality videos look more natural.

Basic Syntax

To apply the fspp filter, use the -vf (video filter) flag in your FFmpeg command. The basic command structure is:

ffmpeg -i input.mp4 -vf fspp output.mp4

By default, this applies the filter with standard settings, which automatically detects the quantization parameters (QP) from the source video to determine how much smoothing to apply.

Fine-Tuning fspp Parameters

The fspp filter accepts several options to customize its behavior. The syntax for passing options is fspp=quality:qp:strength:strength_mul.

  • quality (Range: 0 to 5, Default: 4): Controls the quality of the filter. Higher values yield better visual results but require more processing power.
  • qp (Range: 0 to 63, Default: 0): Forces a specific Quantization Parameter. By default (0), FFmpeg uses the QP values embedded in the source video. Only manually set this if your source file lacks QP metadata or if you want consistent deblocking across the entire video.
  • strength (Range: -15 to 32, Default: 0): Adjusts the strength of the filter. Higher values increase the deblocking effect but may make the video look blurry.
  • strength_mul (Default: 1.0): A multiplier for the filter strength, allowing for finer adjustments.

Practical Examples

1. High-Quality Deblocking To maximize the deblocking quality on a system with decent processing power, set the quality parameter to its maximum value of 5:

ffmpeg -i input.mp4 -vf fspp=quality=5 output.mp4

2. Manually Forcing Deblocking Strength If the input video has severe blockiness but the automatic detection isn't smoothing it enough, you can manually force a QP value (e.g., 25) and increase the strength:

ffmpeg -i input.mp4 -vf fspp=quality=4:qp=25:strength=5 output.mp4

3. Combining with Other Filters If you need to scale the video and apply deblocking, combine the filters using a comma. It is best practice to apply fspp before scaling so the deblocking algorithm works directly on the original compression blocks:

ffmpeg -i input.mp4 -vf fspp,scale=1280:720 output.mp4