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(orp): Sets the target peak amplitude. The default value is0.95. This ensures the loudest peaks do not clip and remain within a safe margin of the maximum digital limit (1.0).rms(orr): Sets the target Root Mean Square (RMS) amplitude, which represents the average perceived loudness. The default is0.25. Increasing this value will make the quiet sections louder, resulting in heavier compression.compress(orc): Sets the compression factor. It ranges from0.0(no compression) to1.0(maximum compression). The default is0.5. A higher value reduces the dynamic range more aggressively, making the speech volume highly uniform.threshold(ort): Sets the noise gate threshold to prevent the filter from amplifying background noise during silent intervals. It ranges from0.0to1.0, with a default of0.0. If you have audible background hiss or hum, increase this value slightly (e.g.,0.1to0.2).raise(org): Sets the maximum expansion factor, which determines how much the volume of quiet sections can be boosted. The default is1.0.fall(orf): Sets the maximum compression factor, which determines how much the volume of loud sections can be reduced. The default is0.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.mp3In 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.