[gst-devel] Re: volume normalizing with mpeg2enc

ChristianHJW christian at matroska.org
Tue Apr 29 13:59:03 CEST 2003


Kang Jeong-Hee wrote:
> http://www.geocities.com/mp3gain/ normalize dB of mp3 files.
> I suppose that mpeg2enc or something another can make this happen.
> $ gst-launch filesrc location="file.mp3" ! mp3dec ! mp3enc db="89.5" ! filesink
> Is this already implemented?

mp3gain is NOT a normalizer.

To normalize, in a technical sense, means to amplify a digital PCM audio
file ( = multiply every sample with a fixed factor, relative to digital
zero ) such that the loudest part of the audio file does reach max.
amplitude. Normally this can only be done in a sensible way by making a
2 pass process. In first pass the file is analyzed to find the loudest
sample in the file, the max. multiplication factor is calculated, and in
2nd pass all samples are multiplied with this factor.

mp3gain, on the other hand, makes something completely different :

It analyzes every MP3 compressed song with respect to its average
loudness and then alters the loudness tags of every MP3 frame such that
the average loudness of the song equals a predefined value. This is to
ensure that different songs from different albums, when compressed to
MP3 and put on one CD, have similar average loudness to avoid big volume
jumps between the songs when listening to this CD ( song collection ).

Normalizing means amplifying a song such that the dynamic range of the
medium is fully used, mp3gain is more like 'standardizing' the average
loudness of many songs relative to each other.

Another thing : dont swob mp3gain with replaygain ( or Vorbisgain, for
Ogg Vorbis ) ! While both serve the same purpose in principal, its done
completely different on a technical level :

mp3gain changes the loudness tags in every single MP3 frame of a song.
Replaygain on the other hand adds a tag to the header of an audio file,
telling the player what amplification factor to use when playing the
file, such that the average loudness is similar to the other songs. In
first case the MP3 itself gets altered, so that the files will also play
fine on MP3 players that dont support reading a specific tag in the
header ( like portable MP3 players ), while in second case the audio
track and frames themselves stay untouched and there is only one tag
added in the header of the file, telling the player ( software ) how
loud the file is and if the file should be amplified or played with
reduced volume.

About Gstreamer and mp3gain :

After modifying a MP3 file with mp3gain it doesnt need specific support
in the mp3 player to play the file with correct loudness, as the MP3
itself has been changed.

So, what exactly are you after ?

Christian
http://www.matroska.org






More information about the gstreamer-devel mailing list