MP3GAIN(1) | General Commands Manual | MP3GAIN(1) |
mp3gain — lossless mp3 normalizer
mp3gain [options] [infile] [infile 2 ...]
This manual page documents briefly the mp3gain command.
This manual page was written for the Debian distribution because the original program does not have a manual page.
mp3gain can analyze and adjust mp3 files so that they have the same volume.
mp3gain does not just do peak normalization, as many normalizers do. Instead, it does some statistical analysis to determine how loud the file actually sounds to the human ear. Also, the changes mp3gain makes are completely lossless. There is no quality lost in the change because the program adjusts the mp3 file directly, without decoding and re-encoding.
mp3gain optionally writes gain adjustments directly into the encoded data. In this case, the adjustment works with all mp3 players, i.e. no support for a special tag is required. This mode is activated by any of the options -r, -a, -g, or -l.
If none of the above options are given, the recommended gain change is instead written to a special tag in the mp3 file. In this case, the adjustment only works with mp3 players that support this tag. Some mp3 players refer to this as ReplayGain. The tag is written either in APEv2 format (default) or in ID3v2 format (with -s i). If you only want to print the recommended gain change (and not modify the file at all) you may use the -s s (skip tag) option.
The method mp3gain uses to determine the desired volume is described at www.replaygain.org (link to URL http://www.replaygain.org/) . See also /usr/share/doc/mp3gain/README.method .
If you specify -r and -a, only the second one will work.
If you do not specify -c, the program will stop and ask before applying gain change to a file that might clip
Here's the problem: The "global gain" field that mp3gain adjusts is an 8-bit unsigned integer, so the possible values are 0 to 255.
MOST mp3 files (in fact, ALL the mp3 files I've examined so far) don't go over 230. So there's plenty of headroom on top-- you can increase the gain by 37dB (multiplying the amplitude by 76) without a problem.
The problem is at the bottom of the range. Some encoders create frames with 0 as the global gain for silent frames. What happens when you _lower_ the global gain by 1? Well, in the past, mp3gain always simply wrapped the result up to 255. That way, if you lowered the gain by any amount and then raised it by the same amount, the mp3 would always be _exactly_ the same.
There are a few encoders out there, unfortunately, that create 0-gain frames with other audio data in the frame. As long as the global gain is 0, you'll never hear the data. But if you lower the gain on such a file, the global gain is suddenly _huge_. If you play this modified file, there might be a brief, very loud blip.
So now the default behavior of mp3gain is to _not_ wrap gain changes. In other words,
If a frame's global gain field is already 0, it is not changed, even if the gain change is a positive number.
To use the original "wrapping" behavior, use the -w switch.
The homepage of mp3gain is located at http://mp3gain.sourceforge.net/ (link to URL http://mp3gain.sourceforge.net/) .
This manual page was written by Stefan Fritsch sf@sfritsch.de for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Lesser General Public License, Version 2.1 or any later version published by the Free Software Foundation.
On Debian systems, the complete text of the GNU Lesser General Public License can be found in /usr/share/common-licenses/LGPL.