
What codec you want for audio depends on the original format, of course. Note that applying the filter means we will have to re-encode the audio stream. Now we apply the volume filter to an audio file. If you get a value of 0 dB, then you don't need to normalize the audio. histogram_0db: 87861Īs you can see, our maximum volume is -5.0 dB, so we can apply 5 dB gain. This will output something like the following: mean_volume: -16.0 dB The -vn, -sn, and -dn arguments instruct ffmpeg to ignore non-audio streams during this analysis.

Find out the gain to applyįirst you need to analyze the audio stream for the maximum volume to see if normalizing would even pay off: ffmpeg -i video.avi -af "volumedetect" -vn -sn -dn -f null /dev/null To do that, do not try to push the maximum volume to 0 dB, but the mean volume to the dB level of choice (e.g. There is also RMS-based normalization which tries to make the average loudness the same across multiple files. This guide is for peak normalization, meaning that it will make the loudest part in the file sit at 0 dB instead of something lower.
#Equalize mp3 volume download#
Make sure you download a recent version of the program.

In ffmpeg you can use the volume filter to change the volume of a track. Option 3: Manually normalizing audio with ffmpeg Have a look at ffmpeg-normalize -h for more options and check the README for some examples.Īlso, it supports re-encoding with other encoders (e.g., AAC or MP3), or automatic merging of the audio back into the video. The tool supports EBU R128 (default), RMS and peak. Or, to simply batch-normalize a number of audio files and write them as uncompressed WAV to an output folder: ffmpeg-normalize *.m4a -of /path/to/outputFolder -ext wav put the ffmpeg executable in your $PATH by either adding it in, for example, /usr/local/bin, or adding its directory to $PATHįor example: ffmpeg-normalize input.mp4 -o output.mp4 -c:a aac -b:a 192k.download ffmpeg (choose a static build, version 3.1 or higher).Since you should use the loudnorm filter with two passes, and that might be a bit complicated to wrap in a script, I created a Python program to normalize media files, available on PyPi as well. See the Audio Volume Manipulation wiki entry for more. See the examples here.Īlso, the volume filter can be used to perform simple volume adjustments. Speechnorm: specifically made for speech normalization. Example for medium-level compression: ffmpeg -i input.wav -filter:a "dynaudnorm=p=0.9:s=5" output.wav This may change the characteristics of the sound, so it should be applied with caution. You should use this filter in a two-pass mode, so I recommend my wrapper script ffmpeg-normalizefor it (for more info see below).ĭynaudnorm: “intelligent” loudness normalization without clipping, which applies normalization dynamically over windowed portions of the file. This is recommended for publishing audio and video and it is used by broadcasters all over the world. You can set an integrated loudness target, a loudness range target, or maximum true peak. Loudnorm: loudness normalization according to EBU R128. Here are the three more advanced filters: If you want a “simple” RMS-based or peak normalization to 0 dBFS (or any other target), go to the last section of this answer.

Current ffmpeg has three filters that can be directly used for normalization – although they are already quite advanced, so they do not simply apply gain to reach a peak level.
