Adjusting FFmpeg fspp Strength and Quantizer

The fspp (Fast Simple PostProcessing) filter in FFmpeg is designed to remove compression artifacts, such as macroblocking and ringing, by applying discrete cosine transform (DCT) operations. This guide explains how to properly configure the fspp filter's post-processing strength and quantization parameter (QP) settings in FFmpeg to effectively balance video smoothing with the preservation of fine edge details.

Understanding Key fspp Parameters

The fspp filter relies on three primary options to govern how aggressively it cleans video frames:

  • quality: Controls the precision and speed of the filter. It accepts values of 4 (standard/fast) or 5 (higher quality/slower). The default is 4.
  • qp: Forces a constant quantization parameter between 0 and 63. If left unset, the filter attempts to read the QP directly from the input video stream. Manually setting this value allows you to force a specific level of deblocking across the entire video.
  • strength: Adjusts the filter's intensity offset. It accepts values from -15 to 32, with 0 being the default. Higher positive values increase the smoothing effect, while negative values preserve more texture at the risk of leaving residual artifacts.

Basic Syntax

To use fspp, invoke it inside the video filter graph (-vf) using key-value pairs:

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

Adjusting Post-Processing Strength

The strength parameter modifies how thresholds are calculated relative to the quantization parameter:

  • Mild Smoothing (Low Strength): Useful for modern codecs or clean sources with faint compression banding.

    -vf "fspp=quality=5:strength=-5"
  • Aggressive Smoothing (High Strength): Useful for heavily compressed or older media (such as MPEG-2 or DivX) containing visible blocking.

    -vf "fspp=quality=5:strength=10"

Overriding the Quantizer Parameter (qp)

By default, fspp relies on the QP table embedded in the source video. However, decoded streams often drop QP data, or the source file might be an intra-only format that lacks macroblock-level quantization data. In these cases, manually providing a fixed qp is required:

  • Subtle Deblocking: A lower QP value (e.g., 8 to 16) assumes the video is high quality and limits filtering to minimal corrections.

    -vf "fspp=qp=12"
  • Strong Deblocking: A higher QP value (e.g., 24 to 36) treats the source as heavily quantized, smoothing broad flat areas aggressively.

    -vf "fspp=qp=30"

Combined Examples

Balanced cleanup for general video files:

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

Heavy deblocking for low-bitrate or legacy content:

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