How to Configure FFmpeg pp Filter Deblocking
This article explains how to configure and use the deblocking
parameters within FFmpeg’s postprocessing (pp) filter. You
will learn the syntax for horizontal and vertical deblocking, how to
target specific color planes, and how to apply automatic thresholding to
reduce blocky compression artifacts and improve overall video playback
quality.
Understanding the pp Filter Syntax
The FFmpeg pp (postprocessing) filter chain consists of
sub-filters separated by slashes (/). To configure
deblocking, you primarily use the horizontal deblocking
(hb) and vertical deblocking (vb) sub-filters,
or their automatic counterparts (ha and
va).
The basic syntax for applying the filter in an FFmpeg command is:
ffmpeg -i input.mp4 -vf "pp=subfilter1/subfilter2" output.mp4Basic Deblocking Configuration
To apply standard horizontal and vertical deblocking to your video,
use the hb and vb options:
ffmpeg -i input.mp4 -vf "pp=hb/vb" output.mp4This applies default deblocking to both the luminance (y) and chrominance (c) channels of the video.
Targeting Specific Color Planes (Luma and Chroma)
By default, the deblocking filters apply to all image components. You can prefix the deblocking filters to restrict them to specific planes:
y(Luminance/Brightness): Applies the filter only to the luma channel.c(Chrominance/Color): Applies the filter only to the chroma channels.
Examples:
To apply horizontal and vertical deblocking only to the luminance channel (which often contains the most noticeable blocking artifacts):
ffmpeg -i input.mp4 -vf "pp=yhb/yvb" output.mp4To apply deblocking only to the chrominance channels:
ffmpeg -i input.mp4 -vf "pp=chb/cvb" output.mp4Using Automatic Threshold Deblocking
Standard deblocking (hb/vb) uses fixed
thresholds. For videos with varying quality, automatic deblocking
filters (ha for horizontal, va for vertical)
are highly recommended. These filters automatically adjust the
deblocking strength based on the macroblock quantization parameter (QP)
of the source video.
ffmpeg -i input.mp4 -vf "pp=ha/va" output.mp4Combining Deblocking with Deringing
Deblocking is frequently paired with deringing (dr) to
eliminate “mosquito noise” and ringing artifacts around sharp edges. You
can chain these parameters together using the slash separator:
ffmpeg -i input.mp4 -vf "pp=hb/vb/dr" output.mp4Or, using the automatic threshold variations:
ffmpeg -i input.mp4 -vf "pp=ha/va/dr" output.mp4