How to Use FFmpeg DCT Filter for Denoising

This article explains how to use the FFmpeg dct video filter to reduce noise in video files using 2D discrete cosine transform block denoising. You will learn the core parameters of the filter, including threshold levels and block sizes, along with practical command-line examples to help you achieve clean, denoised video output.

Understanding the DCT Denoising Filter

The dct filter in FFmpeg works by dividing each video frame into small pixel blocks, converting them into the frequency domain using a 2D Discrete Cosine Transform, and then zeroing out high-frequency coefficients that fall below a specified threshold. Because noise typically manifests as low-amplitude high-frequency data, filtering out these weak coefficients effectively reduces noise before the blocks are transformed back into the spatial domain.

Filter Parameters

The dct filter accepts two primary parameters:

Practical FFmpeg Examples

To apply basic denoising with the default \(8 \times 8\) block size and a moderate threshold of 5.0, use the following command:

ffmpeg -i input.mp4 -vf "dct=threshold=5.0" output.mp4

If you want to use larger \(16 \times 16\) blocks for a smoother look on higher-resolution videos, set the n parameter to 4:

ffmpeg -i input.mp4 -vf "dct=threshold=8.0:n=4" output.mp4

Tips for Best Results