Configure DCT Decimate in FFmpeg libx264

This article explains how to configure the dct-decimate option in the libx264 encoder using FFmpeg. You will learn what DCT decimation does, how it impacts video compression and visual quality, and the exact command-line parameters needed to enable or disable this feature in your encoding workflows.

What is DCT Decimation?

Discrete Cosine Transform (DCT) decimation is a compression optimization technique used by the libx264 encoder. When enabled, the encoder identifies and drops (decimates) DCT blocks that contain coefficient values so small they are deemed visually insignificant.

While this technique successfully reduces file size and saves bitrate, it can sometimes discard fine details. This is especially noticeable in dark, flat, or low-contrast areas of a video (like a dark night sky), where it can lead to blockiness or color banding.

How to Configure dct-decimate in FFmpeg

By default, libx264 has DCT decimation enabled to maximize compression efficiency. You can control this behavior using the -x264-params flag in FFmpeg.

Disabling DCT Decimation (For Higher Quality)

If you are encoding high-fidelity content, anime, or videos with dark scenes and want to preserve maximum detail, you should disable DCT decimation. Use the following command:

ffmpeg -i input.mp4 -c:v libx264 -x264-params dct-decimate=0 output.mp4

Enabling DCT Decimation (For Smaller File Size)

To explicitly enable DCT decimation (which is the default behavior), set the value to 1:

ffmpeg -i input.mp4 -c:v libx264 -x264-params dct-decimate=1 output.mp4

Alternative Syntax Using -x264opts

FFmpeg also supports the older -x264opts syntax to achieve the same result.

To disable DCT decimation:

ffmpeg -i input.mp4 -c:v libx264 -x264opts no-dct-decimate output.mp4

To enable DCT decimation:

ffmpeg -i input.mp4 -c:v libx264 -x264opts dct-decimate output.mp4

When to Disable DCT Decimation

You should consider disabling this option (dct-decimate=0) in the following scenarios: * Archival Encoding: When file size is secondary to preserving the original master quality. * Anime and Cartoons: Flat color surfaces are highly susceptible to banding artifacts when decimated. * Low-Light Videography: Dark scenes with fine film grain or subtle gradients require decimation to be turned off to prevent blocky artifacts.