How to Use FFmpeg speechnormalizer for Clear Speech

This guide explains how to use the FFmpeg speechnormalizer filter to enhance speech clarity and reduce the impact of background noise in audio files. You will learn the core parameters of this filter, see practical command-line examples, and understand how to fine-tune the settings to achieve optimal voice intelligibility in challenging acoustic environments.

Understanding the speechnormalizer Filter

The speechnormalizer filter in FFmpeg is designed to improve speech intelligibility by dynamically adjusting the volume of an audio stream. Unlike standard volume normalizers that look at the peak volume of the entire file, the speech normalizer analyzes speech-specific characteristics. It boosts quiet speech, tames excessively loud passages, and avoids amplifying background noise during moments of silence.

Key Parameters for Controlling Noise and Clarity

To get the best results in a noisy environment, you must adjust the filter's key parameters:

  • peak (default: 0.95): Sets the maximum peak envelope level. This ensures the output audio does not clip or distort.
  • rms (default: 0.20): Sets the target Root Mean Square (RMS) level, which represents the average perceived loudness of the speech. Higher values make the speech louder overall.
  • compress (default: 1.0): Controls the compression factor. Higher values (e.g., 1.5 to 2.0) compress the dynamic range more aggressively, making faint speech louder and more uniform.
  • threshold (default: 0.05): Sets the noise gate threshold. This is crucial for noisy backgrounds. Any sound below this threshold is treated as noise and will not be amplified during pauses in speech.

Practical Examples

1. Basic Speech Normalization

If your background noise is minimal and you simply want to make the dialogue more consistent and audible, use the default settings:

ffmpeg -i input.mp3 -af "speechnormalizer" output.mp3

2. Enhancing Speech in a Noisy Background

When dealing with significant background noise, you must increase the threshold so the noise is ignored, and slightly increase the compress factor to pull the voice out of the background.

ffmpeg -i input.wav -af "speechnormalizer=peak=0.9:rms=0.25:compress=1.5:threshold=0.15" output.wav

In this command:

  • peak=0.9 prevents clipping while keeping the signal strong.
  • rms=0.25 targets a slightly louder average speech volume.
  • compress=1.5 moderately squeezes the dynamic range to make quiet words easier to hear.
  • threshold=0.15 ensures that background noise up to 15% of the maximum volume is not amplified during pauses.

3. Extreme Dialogue Boost for Heavy Noise

For audio with very quiet speech buried under steady background hiss or hum, use a higher compression factor and a stricter threshold:

ffmpeg -i input.m4a -af "speechnormalizer=peak=0.95:rms=0.3:compress=2.0:threshold=0.25" output.m4a

Note: If the background noise is still too loud during speech itself, you can combine speechnormalizer with FFmpeg's afftdn (FFT de-noise) filter for a cleaner result:

ffmpeg -i input.mp3 -af "afftdn,speechnormalizer=peak=0.9:rms=0.25:compress=1.5:threshold=0.15" output.mp3