How to Use FFmpeg afftdn Filter for Noise Reduction
This guide explains how to use the FFmpeg afftdn (Audio
FFT Denoise) filter to remove background noise from audio tracks. You
will learn the basic command structure, understand key parameters like
noise reduction levels and noise types, and explore practical examples
to clean up your audio files effectively.
Basic Syntax
The afftdn filter uses Fast Fourier Transform (FFT)
mathematical algorithms to analyze and reduce noise. The simplest way to
apply the filter to an audio file is by using the following command:
ffmpeg -i input.mp4 -af "afftdn" output.mp4This command applies the default settings of the filter, which works well for general background hiss or white noise.
Key Parameters of the afftdn Filter
To fine-tune the noise reduction process, you can pass specific
parameters to the filter using the key-value syntax:
afftdn=parameter1=value1:parameter2=value2.
noise_reduction(ornr): Sets the noise reduction level in decibels (dB). The default value is 12. Higher values remove more noise but may introduce digital artifacts to the remaining audio. The range is 0.01 to 97.noise_floor(ornf): Sets the noise floor in decibels (dB). The default is -50. Adjust this if your background noise is exceptionally loud or quiet. The range is -120 to -20.noise_type(ornt): Specifies the profile of the noise you want to target. Options include:wfor White noise (default)pfor Pink noisebfor Brown noisevfor Vinyl noise
output_mode(orom): Defines what the filter outputs.ooutputs the cleaned, noise-reduced audio (default).noutputs only the noise that is being removed (useful for checking what you are losing).
Practical Examples
1. Moderate Noise Reduction (Standard Hiss)
If you have a standard recording with a mild background hiss, you can increase the noise reduction slightly:
ffmpeg -i input.wav -af "afftdn=nr=15:nf=-45" output.wav2. Targeted Pink Noise Reduction
If your background noise is lower-pitched (like a distant rumble or fan), pink noise profile targeting might yield better results:
ffmpeg -i input.mp3 -af "afftdn=nt=p:nr=18" output.mp33. Auditioning the Removed Noise
To ensure you are not accidentally cutting out vocal frequencies or important parts of your track, you can output only the noise that FFmpeg is removing:
ffmpeg -i input.wav -af "afftdn=nr=12:om=n" noise_only.wavListen to noise_only.wav. If you hear clear parts of the
actual audio or speech, reduce the nr (noise reduction)
value in your final command.