| Version 1 (modified by , 9 years ago) ( diff ) |
|---|
Audio Volume Manipulation
Changing volume
To change the audio volume, you may use FFmpeg's volume audio filter.
If we want our volume to be half of the input volume:
ffmpeg -i input.wav -filter:a "volume=0.5" output.wav
150% of current volume:
ffmpeg -i input.wav -filter:a "volume=1.5" output.wav
You can also use decibel measures:
ffmpeg -i input.wav -filter:a "volume=10dB" output.wav
Peak and RMS Normalization
To normalize the volume to a given peak or RMS level, the file first has to be analyzed using the volumedetect filter:
ffmpeg -i input.wav -filter:a volumedetect -f null /dev/null
Read the output values from the command line log:
[Parsed_volumedetect_0 @ 0x7f8ba1c121a0] mean_volume: -16.0 dB [Parsed_volumedetect_0 @ 0x7f8ba1c121a0] max_volume: -5.0 dB ...
... then calculate the required offset, and use the volume filter as shown above.
To automate this process and run it on multiple files (including video), you can also use the ffmpeg-normalize Python script via pip install ffmpeg-normalize. For the supported options, see ffmpeg-normalize -h.
Loudness Normalization
If you want to normalize the (perceived) loudness of the file, use the loudnorm filter, which implements the EBU R128 algorithm:
ffmpeg -i input.wav -filter:a loudnorm output.wav
This is recommended for most applications, as it will lead to a more uniform loudness level compared to simple peak-based normalization.


