How to Remove Audio Hiss with FFmpeg anlmdn Filter

Background hiss can ruin an otherwise perfect audio recording, but FFmpeg offers a powerful, built-in solution called the anlmdn (Audio Non-Local Means Denoising) filter. This guide provides a straightforward tutorial on how to use the anlmdn filter to clean up your audio tracks, explaining the essential parameters and providing practical command-line examples to achieve professional, noise-free results.

Understanding the anlmdn Filter

The anlmdn filter uses a non-local means algorithm to reduce broadband noise, making it highly effective at removing constant background hiss, computer fan noise, and system buzz from audio tracks. Unlike simple noise gates, it analyzes the audio over time to distinguish between actual content (like speech or music) and background noise, preserving the original audio quality.

Basic Usage

To apply the default denoising settings to an audio file, use the following basic FFmpeg command:

ffmpeg -i input.mp3 -af anlmdn output.mp3

This command takes your source file (input.mp3), applies the anlmdn audio filter (-af), and outputs a cleaner version (output.mp3).

Tuning the Filter Parameters

For optimal results, you will often need to adjust the filter’s parameters. The anlmdn filter accepts several key options:

Practical Examples

1. Removing Moderate Background Hiss

For standard background hiss in a voice recording, a slightly higher strength value is usually required. Try this command:

ffmpeg -i input.wav -af "anlmdn=s=0.0005" output.wav

2. Aggressive Denoising for Loud Hiss

If you are dealing with a very noisy recording, you can increase the strength further. Be sure to listen closely for any metallic or robotic digital artifacts in the output:

ffmpeg -i input.wav -af "anlmdn=s=0.002:p=0.004:r=0.02" output.wav

3. Monitoring the Removed Noise

To verify that you are only removing hiss and not clipping your actual audio, output only the noise profile using the om parameter:

ffmpeg -i input.wav -af "anlmdn=s=0.0005:om=n" noise_only.wav

Listen to noise_only.wav. If you can clearly hear speech or music in this file, your strength (s) parameter is set too high, and you should lower it to avoid distorting your final output.