How to Denoise Audio with FFmpeg afftdn Filter

This article provides a practical guide on how to use the afftdn (Audio FFT De-noise) filter in FFmpeg to clean up noisy audio tracks. You will learn the basic command structure, the key parameters available for fine-tuning the noise reduction, and step-by-step examples of how to apply these settings to your audio and video files.

The afftdn filter in FFmpeg is a powerful audio denoiser that uses Fast Fourier Transform (FFT) to reduce constant background noise, such as hiss, hum, or computer fan noise, from an audio track.

Basic Usage

To apply the default noise reduction settings to an audio file, use the following basic command:

ffmpeg -i input.mp3 -af "afftdn" output.mp3

In this command, -af specifies that you are applying an audio filter, and "afftdn" invokes the denoiser with its default configuration.

Key Parameters for Fine-Tuning

While the default settings work well for general noise, you can customize the behavior of afftdn using specific parameters. The most commonly used options include:

Practical Examples

1. Moderate Noise Reduction
For a balanced output that reduces moderate background hiss without distorting human speech:

ffmpeg -i input.wav -af "afftdn=nr=15:nf=-45" output.wav

2. Removing Loud Background Hum from a Video
If you are dealing with a loud hum or fan noise in a video file, you can increase the reduction level while copying the video stream without re-encoding:

ffmpeg -i input.mp4 -c:v copy -af "afftdn=nr=20:nf=-35" output.mp4

3. Targeting Pink Noise
If the background noise is deeper and resembles pink noise rather than a high-pitched hiss:

ffmpeg -i input.mp3 -af "afftdn=nt=p:nr=12" output.mp3

By adjusting these three core parameters (nr, nf, and nt), you can clean up most constant background noises from your audio recordings using FFmpeg.