How to Use FFmpeg Deblock Filter to Fix Blocky Video

This article explains how to use the FFmpeg deblock filter to reduce blockiness and compression artifacts in old or low-bitrate videos. You will learn the essential parameters of the filter, the correct command syntax, and practical examples to help you restore visual quality to your digital archives.

Understanding the FFmpeg Deblock Filter

Highly compressed or older digital videos often suffer from “blocking”—visible square patterns caused by block-based compression algorithms (like MPEG-2 or early H.264). The FFmpeg deblock filter smooths out these block boundaries to make the video appear cleaner and more continuous.

The basic syntax for applying the filter is:

ffmpeg -i input.mp4 -vf "deblock" output.mp4

Key Parameters of the Deblock Filter

To get the best results, you can fine-tune the filter using three main parameters: blocksize, alpha, and beta.

Practical Examples

1. Default Deblocking

For minor compression issues, the default settings are often sufficient. This command applies the default deblock filter and re-encodes the video using the H.264 codec:

ffmpeg -i input.mp4 -vf "deblock" -c:v libx264 -crf 18 -c:a copy output.mp4

2. Strong Deblocking for Highly Compressed Video

For older, highly pixelated videos (such as low-resolution 240p or 360p clips), you should increase the alpha and beta values to apply a stronger smoothing effect:

ffmpeg -i input.mp4 -vf "deblock=blocksize=8:alpha=0.2:beta=0.15" -c:v libx264 -crf 18 -c:a copy output.mp4

3. Combining Deblock with Denosing and Sharpening

Deblocking can sometimes make a video look slightly blurry. To counteract this, you can combine the deblock filter with a denoiser (hqdn3d) and a subtle sharpening filter (unsharp) in a single filterchain:

ffmpeg -i input.mp4 -vf "deblock=blocksize=8:alpha=0.12:beta=0.08,hqdn3d,unsharp=3:3:0.5:3:3:0.5" -c:v libx264 -crf 18 -c:a copy output.mp4

Using these configurations will help you significantly reduce block artifacts and improve the overall viewing experience of legacy video files.