Adjust and Normalize Your Music Files with FFMPEG

Not all audio files are created equal. Sometimes, they’re too quiet, too loud, or just off. When you find yourself with a problematic audio file, you aren’t stuck just dealing with it. FFmpeg, a powerful open-source audio utility can help. It can adjust the volume of your files and normalize them to get rid of unpleasant fluctuations in volume. What’s even better, it’s fully scriptable and even baked into Python scripts that streamline the whole thing.

Installing FFmpeg

If you don’t already have it, FFmpeg is really easy to get. Linux users can almost always find it in their distribution repositories. For Windows and Mac, you can find it on the project’s download page.

Basic Loudness

Everything here’s going to be done through the terminal. FFmpeg does have graphical front ends, but the command line is the simplest and most direct way to work with it. Go ahead and open a terminal to work in.

Increase Volume With FFMPEG

Change directories into one that has files you would like to work with. FFmpeg supports just about every audio format you can think of, so don’t worry about that. When you have files to work with, run FFmpeg. Use the -i flag to specify an input file. Then, the -filter:a flag lets you specify a filter, in this case adjusting the volume. FFmpeg uses 1 as the original volume of the file. To decrease the volume by half, set “volume” equal to 0.5. Then, end with the output file name. Altogether, it should look like the example below.

ffmpeg -i input.flac -filter:a "volume=0.5" output.flac

Running that command will cause FFmpeg to create a copy of your input file with half the volume and output it to the specified file name. Of course, you can also increase the volume by providing a number greater than 1. In the case of the example below, the volume will increase by 50%.

ffmpeg -i input.flac -filter:a "volume=1.5" output.fac

FFmpeg is also fully capable of converting your files. Specify a different output extension, and FFmpeg will take care of the rest.

ffmpeg -i input.flac -filter:a "volume=1.25" output.mp3

Some people are more comfortable working with decibels for more technical control of their files. FFmpeg supports that too. Instead of using the base one system from before, specify the amount of decibels that you would like to increase the volume by followed by “dB.”

ffmpeg -i input.flac -filter:a "volume=5dB" output.flac

Supply a negative number to decrease the volume in decibels.

ffmpeg -i input.flac -filter:a "volume=-5dB" output.flac

Loudness Normalization

FFMPEG Loudnorm function

If your file’s volume is inconsistent, you can always use FFmpeg’s built-in normalization function to try to get things under control. Set up your command just like you were changing the volume, but use “loudnorm” instead of volume as the filter. FFMpeg will attempt to lower and raise the peaks and valleys in the sound to make it more pleasant to listen to.

ffmpeg -i input.flac -filter:a loudnorm output.flac

Automated with Python

There’s actually more available when normalizing audio with FFmpeg, but it requires some knowledge of how audio works and some math. Rather than do it yourself, there’s a convenient Python script that automates the whole thing. Plus, it can handle entire folders at once.

Install ffmpeg-normalize

If you have Python installed on your computer with the Pip package manager, you can use it to install ffmpeg-normalize. Linux and Mac users will probably need to use “sudo,” unless they’ve configured things differently.

sudo pip3 install ffmpeg-normalize

Using ffmpeg-normalize

FFmpeg-normalize single file

FFmpeg-normalize is very simple to use. Provide an input file followed by an output file after the -o flag, and the script will automatically normalize your file. You will need to specify a codec for it to work, though.

ffmpeg-normalize input.flac -c:a flac -o output.flac

It also allows you to specify multiple input and output files at once.

ffmpeg-normalize input.flac input2.flac input3.flac -c:a flac -o output1.flac -o output2.flac -o output3.flac

You can use it to convert files as well. You’ll still need to specify a codec and bitrate, but it does work well. The flags are the same ones you’d use for plain FFmpeg.

ffmpeg-normalize input.flac -c:a libmp3lame -b:a 320k -o output.mp3

Using ffmpeg-normalize on Whole Folders

FFmpeg-normalize Entire Folder

You can also use the wildcard character(*) to normalize entire folders with or without converting them. The outputs will automatically by placed in their own folder. The command looks a bit different on Windows than it does on Linux and Mac, but the result is the same. As an added note, you’ll need to specify the output extension of each file with the -ext flag, otherwise you’ll get .mkv files.

Mac and Linux

ffmpeg-normalize *.flac -c:a libmp3lame -b:a 320k -ext mp3


for %%f in ("*.flac") do ffmpeg-normalize "%%f" -c:a libmp3lame -b:a 320k -ext mp3

Whichever method you choose, there’s no reason do deal with poor quality audio. You can easily use FFmpeg to adjust and normalize the volume to get something much more evenly balanced that fits in better with the rest of your collection.

Nick Congleton
Nick Congleton

Nick is a freelance tech. journalist, Linux enthusiast, and a long time PC gamer.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox