FFmpeg PP Filter: Legacy Deblocking and Deringing
The FFmpeg pp (postprocessing) video filter provides
access to the legacy libpostproc routines originally
developed for MPlayer. This guide demonstrates how to apply horizontal
deblocking, vertical deblocking, and deringing to clean up compression
artifacts—such as macroblocking and mosquito noise—common in older
codecs like MPEG-2, MPEG-4 Visual (DivX/Xvid), and Sorenson Spark.
Prerequisites
To use this filter, your FFmpeg build must be compiled with
libpostproc support enabled (--enable-gpl and
--enable-postproc). You can verify availability by
running:
ffmpeg -filters | grep " pp "If present, the output will list the pp filter
description:
pp V->V Filter video using libpostproc.
Understanding the Filter Syntax
The pp filter accepts a string of subfilter tokens
separated by slashes (/). The key tokens for deblocking and
deringing are:
hb: Horizontal deblocking filter.vb: Vertical deblocking filter.ha: Horizontal deblocking filter with automatic quality control.va: Vertical deblocking filter with automatic quality control.h1: Alternative horizontal deblocking filter (linear blend mode).v1: Alternative vertical deblocking filter (linear blend mode).dr: Deringing filter to eliminate halo artifacts around high-contrast edges.al: Automatic luminance/chrominance adjustment (often paired with deblocking).
Basic Deblocking and Deringing
To apply standard horizontal and vertical deblocking alongside the
deringing filter, combine hb, vb, and
dr:
ffmpeg -i input.mp4 -vf "pp=hb/vb/dr" -c:v libx264 -crf 18 -c:a copy output.mp4Automatic Quality-Controlled Deblocking
If the video source contains varying compression levels, you can use
the dynamic quality-switched deblockers (ha and
va). These subfilters rely on quantizer (QP) information
embedded within the stream to decide when and how aggressively to smooth
frames:
ffmpeg -i input.avi -vf "pp=ha/va/dr" -c:v libx264 -crf 18 -c:a copy output.mp4Aggressive Linear Deblocking
For severely degraded or low-bitrate video where standard deblocking
fails to eliminate hard macroblock boundaries, replace hb
and vb with h1 and v1. This
enables stronger linear interpolation across block edges:
ffmpeg -i input.avi -vf "pp=h1/v1/dr" -c:v libx264 -crf 18 -c:a copy output.mp4Customizing Filter Intensity
The pp filter accepts an optional second parameter to
control overall postprocessing intensity, ranging from 0 to
6:
ffmpeg -i input.mp4 -vf "pp=hb/vb/dr:6" -c:v libx264 -crf 18 -c:a copy output.mp4A level of 6 ensures maximum smoothing across all active
subfilter routines.