How to Isolate and Enhance Speech in FFmpeg
This article provides a quick guide on how to isolate, clean, and
enhance spoken-word audio using FFmpeg’s powerful audio filtering
engine. While FFmpeg does not feature a native filter literally named
“freespoken,” you can easily achieve the goal of freeing spoken vocals
from background noise by chaining together standard filters like
arnndn, afftdn, speechnorm, and
silenceremove. Below, you will find the exact commands and
configurations needed to optimize spoken audio files.
Suppressing
Background Noise with afftdn or arnndn
To isolate spoken voice, you must first eliminate background noise. FFmpeg offers two primary filters for this:
afftdn(Audio FFT De-noise): This is a native, highly effective filter that uses Fast Fourier Transforms to reduce broadband noise.ffmpeg -i input.mp3 -af "afftdn=noise_reduction=12" output.mp3arnndn(Recurrent Neural Network Noise Reduction): This filter uses neural networks to target and remove non-speech noise, making it highly effective for spoken-word isolation. It requires a downloaded.rnnnmodel file.ffmpeg -i input.mp3 -af "arnndn=model=cb.rnnn" output.mp3
Standardizing Volume with
speechnorm
Once the noise is reduced, the spoken vocals may still have uneven
volume levels. The speechnorm (Speech Normalizer) filter
dynamically adjusts the volume of speech to ensure that quiet words are
audible and loud words do not clip.
ffmpeg -i input.mp3 -af "speechnorm=e=4:r=0.05" output.mp3e(expansion factor): Sets the maximum gain target.r(range): Controls the threshold for speech detection.
Eliminating Dead Air
with silenceremove
To make spoken recordings sound more concise, you can automatically trim silence from the beginning, middle, or end of the track.
ffmpeg -i input.mp3 -af "silenceremove=start_threshold=-30dB:start_duration=0.5:stop_threshold=-30dB:stop_duration=0.5" output.mp3Chaining the Filters for Best Results
For the cleanest spoken-word output, combine these filters into a single command chain. This process first removes noise, normalizes the voice levels, and then trims the silent gaps.
ffmpeg -i input.mp3 -af "afftdn=noise_reduction=15,speechnorm=e=4,silenceremove=stop_threshold=-35dB:stop_duration=1" output.mp3