Configure FFmpeg Speechnormalizer Compression

This article provides a comprehensive guide on how to configure the compression parameters of the speechnormalizer filter in FFmpeg. You will learn about the key options—including peak, RMS, compress, threshold, raise, and fall—and how to adjust them using practical command-line examples to optimize the dynamic range and clarity of spoken-word audio.

The speechnormalizer filter in FFmpeg is designed to improve speech intelligibility by adjusting the volume envelope of an audio stream. It acts as a feedback compressor, reducing the volume of loud parts while boosting quieter sections.

Key Compression Parameters

To fine-tune the compression behavior, you can adjust the following parameters:

  • peak (or p): Sets the target peak amplitude. The default value is 0.95. This ensures the loudest peaks do not clip and remain within a safe margin of the maximum digital limit (1.0).
  • rms (or r): Sets the target Root Mean Square (RMS) amplitude, which represents the average perceived loudness. The default is 0.25. Increasing this value will make the quiet sections louder, resulting in heavier compression.
  • compress (or c): Sets the compression factor. It ranges from 0.0 (no compression) to 1.0 (maximum compression). The default is 0.5. A higher value reduces the dynamic range more aggressively, making the speech volume highly uniform.
  • threshold (or t): Sets the noise gate threshold to prevent the filter from amplifying background noise during silent intervals. It ranges from 0.0 to 1.0, with a default of 0.0. If you have audible background hiss or hum, increase this value slightly (e.g., 0.1 to 0.2).
  • raise (or g): Sets the maximum expansion factor, which determines how much the volume of quiet sections can be boosted. The default is 1.0.
  • fall (or f): Sets the maximum compression factor, which determines how much the volume of loud sections can be reduced. The default is 0.0.

Configuration Syntax and Example

To configure these parameters, use the -af (audio filter) flag in your FFmpeg command, followed by speechnormalizer and its arguments separated by colons.

Here is a practical command that applies strong compression to normalize speech while keeping background noise low:

ffmpeg -i input.mp3 -af "speechnormalizer=peak=0.9:rms=0.3:compress=0.7:threshold=0.15" output.mp3

In this configuration:

  • peak=0.9 prevents any audio peak from exceeding -1 dB (90% maximum amplitude).
  • rms=0.3 targets a slightly louder average volume than the default.
  • compress=0.7 applies stronger compression to narrow the gap between quiet and loud words.
  • threshold=0.15 ensures that background noise below the threshold is not boosted during pauses in speech.