Configure FFmpeg libx264 Deblocking Filter

This guide explains how to configure the deblocking filter (also known as the loop filter) in the libx264 encoder using FFmpeg. You will learn the correct command-line syntax and how to adjust the alpha and beta parameters to control video sharpness, retain fine details, or reduce blocking artifacts in your H.264 encodes.

To configure the deblocking filter in libx264, you use the -x264-params option in FFmpeg with the deblock parameter. The syntax requires two values separated by a colon: deblock=<alpha>:<beta>.

The Command Syntax

The basic FFmpeg command structure is as follows:

ffmpeg -i input.mp4 -c:v libx264 -x264-params deblock=alpha:beta output.mp4

Both parameters accept integer values ranging from -6 to 6. The default setting for x264 is 0:0.

Depending on your source material, you should adjust these values to optimize visual quality:

Example Commands

To encode a video with a mild sharpening effect suited for high-quality movie sources:

ffmpeg -i input.mp4 -c:v libx264 -crf 20 -x264-params deblock=-2:-1 output.mp4

To encode a cartoon or anime video with enhanced smoothing:

ffmpeg -i input.mp4 -c:v libx264 -crf 20 -x264-params deblock=1:1 output.mp4