Denoise Audio with FFmpeg arnndn Filter
This guide explains how to use the arnndn (Active
Recurrent Neural Network Denoise) filter in FFmpeg to remove background
noise from audio tracks. You will learn how the filter works, where to
obtain the required RNN model files, and the exact command-line syntax
needed to clean up your audio and video files effectively.
What is the arnndn Filter?
The arnndn filter is a powerful, neural-network-based
noise reduction tool built into FFmpeg. Based on the RNNoise project, it
uses recurrent neural networks to distinguish between human speech and
background noise (like wind, system hums, or computer fans). Unlike
traditional noise gates or spectral subtraction filters,
arnndn does not require you to select a “noise profile”
from a silent portion of your audio; instead, it recognizes and filters
out noise in real time.
Step 1: Obtain the RNN Model Files
To use the arnndn filter, you must provide it with a
trained RNN model file (typically ending in .rnn). FFmpeg
does not include these models by default.
You can download pre-trained models from public repositories hosting
RNNoise models (such as the official RNNoise GitHub repository or
community-shared configurations). Common model files include: *
bd.rnn (highly recommended for general speech and vocal
clarity) * cb.rnn * mp.rnn *
sh.rnn
Download your preferred model file and save it in your working directory or a known system path.
Step 2: Basic Command Syntax
Once you have the model file, you can apply the filter using the
-af (audio filter) flag in FFmpeg.
Use the following basic command to denoise an audio file:
ffmpeg -i input.wav -af "arnndn=model=bd.rnn" output.wavIn this command: * -i input.wav specifies your noisy
input file. * -af "arnndn=model=bd.rnn" applies the audio
filter and points to the location of your downloaded RNN model. *
output.wav is the resulting cleaned audio file.
Step 3: Denoising Audio in a Video File
If you want to remove background noise from a video’s audio track
without re-encoding the video stream, you can combine the
arnndn filter with video stream copying. This process saves
time and preserves the original video quality:
ffmpeg -i input.mp4 -c:v copy -af "arnndn=model=bd.rnn" output.mp4-c:v copyinstructs FFmpeg to copy the video stream directly without re-encoding.- The audio stream is extracted, processed through the
arnndnfilter using thebd.rnnmodel, re-encoded, and muxed back into the output MP4 container.
Best Practices for Optimal Results
- Model Selection: Different models yield different
results depending on the speaker’s voice and the type of background
noise. If your output sounds muffled or robotic, try switching to a
different model (such as
cb.rnn). - Sample Rate: The underlying RNNoise algorithm is designed to work at a sample rate of 48,000 Hz (48kHz). If your input audio is at a different sample rate (like 44.1kHz), FFmpeg will automatically resample it, which might slightly alter the tone. For the best quality, try to feed 48kHz audio into the filter.