Using FFmpeg speechnormalizer for Clear Speech

The speechnormalizer filter in FFmpeg balances speech volume levels and compresses dynamic range, making dialogue clearer and more intelligible against background noise. This article explains how the filter works, its most critical parameters for noise management, and the exact commands needed to process noisy audio effectively.

What is the speechnormalizer Filter?

The speechnormalizer filter acts as an automatic, speech-oriented dynamic range compressor and leveler. It listens to dialogue, bringing quiet words up to an audible level while restraining louder sections. In noisy environments, unconfigured normalization can accidentally amplify background hums during pauses; tuning speechnormalizer prevents this issue by restricting gain adjustments to voice frequencies.

Basic Syntax

To run the filter with its default settings:

ffmpeg -i input.mp4 -af "speechnormalizer" -c:v copy output.mp4

This applies default leveling to the audio stream while copying the video stream without re-encoding.

Key Parameters for Controlling Background Noise

When dealing with ambient noise (such as room reverb, air conditioning, or traffic), adjusting the default parameters is necessary to keep noise from surging when the speaker pauses.

  • p (peak): Sets the target peak volume level, from 0.0 to 1.0. The default is 0.95. Lowering this slightly (e.g., 0.90) gives headroom to prevent clipping.
  • m (max_gain): Sets the maximum amplification factor. The default is 10.0. In noisy audio, reduce this to 3.0–5.0 to avoid boosting background noise during silent gaps.
  • t (threshold): Sets the detection threshold to differentiate between intended speech and low-level room noise. Raising this prevents the filter from treating steady background noise as quiet speech.
  • r (raise): Controls how quickly the filter increases gain when speech volume drops (speed in seconds). A slower raise time prevents sudden noise swells.
  • f (fall): Controls how quickly the filter reduces gain when volume spikes.

For clear dialogue over steady background sound, limit the maximum gain and set an appropriate threshold:

ffmpeg -i input.mp3 -af "speechnormalizer=p=0.9:m=4.0:t=0.2:r=0.001" -c:a aac -b:a 192k output.mp3

In this command:

  • p=0.9 maintains peak output safely below the maximum digital threshold.
  • m=4.0 limits amplification so ambient room noise is not over-amplified.
  • t=0.2 ignores low-level background sounds below the 20% detection threshold.

Combining with Frequency Filtering

To further isolate speech before normalization, place band-limiting filters ahead of speechnormalizer in the filterchain to cut low rumble and high-frequency hiss:

ffmpeg -i input.wav -af "highpass=f=80,lowpass=f=8000,speechnormalizer=p=0.9:m=4.0" output.wav

This pipeline cuts frequencies below 80 Hz and above 8000 Hz where human speech rarely carries meaningful information, allowing speechnormalizer to focus entirely on leveling the vocal track.