FFmpeg fspp Filter: Reduce Compression Blockiness

This article provides a direct guide on how to eliminate macroblocking, banding, and ringing artifacts in low-bitrate videos using the fspp (Fast Simple Post Processing) filter in FFmpeg. You will learn the filter's core syntax, key parameter configurations, and practical command-line examples to clean up compressed footage efficiently.


What is the fspp Filter?

The fspp filter is a faster variant of the spp (Simple Post Processing) filter, originally ported from MPlayer. It works by applying an 8x8 Discrete Cosine Transform (DCT) across shifting blocks, adjusting frequency coefficients to smooth out blocking boundaries while retaining genuine edge details. It is particularly effective for legacy MPEG-4, H.264, or heavily compressed web video.

Core Parameters

The filter accepts several options to control processing depth and strength:

  • quality (default: 4): Sets the quality level. Accepted values are 4 or 5. Level 4 processes fewer block shifts for faster execution, while level 5 samples more positions for superior artifact suppression at a slight performance cost.
  • qp (default: 0): The quantization parameter. By default (0), fspp attempts to read the QP directly from the input video bitstream. If your source video has no accessible QP data (common with modern MP4/MKV containers), you must manually set a value between 1 and 63. Higher values produce stronger smoothing.
  • strength (default: 0): Fine-tunes the deblocking intensity. Accepted range is -15 to 32. Positive values increase blurriness to wipe out strong blocks; negative values retain more sharpness.
  • use_bframe (default: 0): Set to 1 to force the filter to use the QP of the previous non-B-frame for B-frames, preventing over-smoothing on highly compressed frames.

Practical Usage Examples

1. Basic Automatic Deblocking

If your video format preserves original macroblock QP information (such as raw MPEG-2 or certain AVI files), run the filter with default settings:

ffmpeg -i input.mp4 -vf "fspp" -c:a copy output.mp4

2. Manual Strength for Stripped Metadata

Most modern H.264/H.265 files do not pass QP tables to the filter graph. To force deblocking on these files, specify the qp manually. A value between 12 and 20 typically removes compression blocks without destroying fine textures:

ffmpeg -i input.mp4 -vf "fspp=quality=5:qp=16" -c:v libx264 -crf 18 -c:a copy output.mp4

3. Aggressive Filtering for Severe Compression

For very low-bitrate video exhibiting heavy pixelation, increase both qp and strength:

ffmpeg -i input.mp4 -vf "fspp=quality=5:qp=24:strength=8" -c:v libx264 -crf 18 -c:a copy output.mp4

4. Combining with Sharpening

Because strong deblocking can soften the entire image, pair fspp with an unsharp filter to recover edge definition:

ffmpeg -i input.mp4 -vf "fspp=quality=5:qp=15,unsharp=5:5:0.8:5:5:0.0" -c:v libx264 -crf 18 -c:a copy output.mp4

Recommendation

Begin testing with quality=5:qp=12 on a short segment of your video (using -ss and -t). Gradually increase the qp value in increments of 2 or 3 until block edges disappear without creating an overly smoothed, plastic look.