Use FFmpeg arnndn Filter to Remove Voice Noise
Background noise can easily ruin an otherwise perfect audio or video
recording. FFmpeg offers a highly effective, AI-powered solution through
its arnndn (Active Recurrent Neural Network Denoiser) audio
filter, which utilizes Recurrent Neural Networks (RNN) to isolate and
eliminate background noise from voice recordings. This guide will show
you how to acquire the necessary RNN model files and construct the exact
FFmpeg commands needed to clean your audio.
Step 1: Obtain an RNN Model File
The arnndn filter does not have a built-in neural
network model; it requires an external .rnn model file to
understand what constitutes noise versus voice.
These model files are typically derived from Mozilla’s open-source
RNNoise project. You can download pre-trained models (such as
bd.rnn, cb.rnn, or mp.rnn) from
community repositories on GitHub (such as the official RNNoise
repository or secondary archives hosting compiled .rnn
files). Once downloaded, place the model file in your working
directory.
Step 2: Run the Basic FFmpeg Command
To apply the noise reduction filter to an audio file, use the
-af (audio filter) flag followed by arnndn and
the path to your model file.
Here is the basic command structure:
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, pointing to your downloaded model (e.g., bd.rnn). *
output.wav is the newly created, denoised audio file.
Step 3: Denoise Audio inside a Video File
If you are working with a video file (like an MP4) and want to remove
background noise from the audio track without re-encoding the video, you
can pair the arnndn filter with the video copy stream. This
keeps the video quality identical and saves processing time.
Use the following command:
ffmpeg -i input.mp4 -c:v copy -af "arnndn=model=bd.rnn" output.mp4In this command: * -c:v copy copies the video stream
directly without re-encoding it. *
-af "arnndn=model=bd.rnn" processes only the audio stream
to filter out the noise.
Step 4: Troubleshooting Model Paths
If FFmpeg cannot find your model file, it will throw an error. To
prevent this, ensure that you provide the absolute path to the
.rnn file if it is not in the same folder where you are
running the terminal command:
ffmpeg -i input.wav -af "arnndn=model='/path/to/your/models/bd.rnn'" output.wav