mp3gain -u / mpg123

  • xr200

    xr200 - 2013-01-09

    I thought I'd spend some time standardizing my large MP3
    collection, which is organized by album.

    I'm running PCLinuxOS.

    I read a lot about MP3gain, and I thought I'd give it a try,
    by cd-ing to an album and running "mp3gain -k -a *mp3".

    Before running mp3gain, I can run "mpg123 FILE.mp3" cleanly.

    If I normalize the album using the above command, when I play
    back FILE.mp3 with "mpg123 FILE.mp3", mpg123 will report this error:

    Note: Illegal Audio-MPEG-Header 0x41504554 at offset 2998272.
    Note: Trying to resync…
    Note: Hit end of (available) data during resync.

    I used "mp3gain -u *mp3" to undo the normalization, but after that,
    running mpg123 again, I still a similar note from mpg123:

    Note: Illegal Audio-MPEG-Header 0x41504554 at offset 2641920.
    Note: Trying to resync…
    Note: Hit end of (available) data during resync.

    It seems to me that:

    - mp3gain is doing something to the *mp3's that mpg123 doesn't like, and
    - mp3gain -u does not restore an MP3 back to its original state.

    Am I misunderstanding what the -u option is supposed to do?   Why
    is mpg123 unhappy after I run mp3gain?

  • Clayton Macleod

    Clayton Macleod - 2013-01-09

    Maybe it doesn't like the tags that mp3gain adds.

  • Glen Sawyer

    Glen Sawyer - 2013-01-09

    The "-u" option restores the actual audio data back to its original state, but leaves the metadata tags in the file.

    If the tags really are the problem, then you can use the "-s d" option to delete any existing tags in the files. Then if you want to try adjusting the volume again, use the "-s s" option to skip the tags (i.e. do not read or write the tags).

  • xr200

    xr200 - 2013-01-09

    You guys hit the nail on the head: mpg123 does not like something about the metadata tags added
    by mp3gain.   The -s options described by snelg (thanks!) work exactly as described.  In other words,
    if I start with FILE.mp3, run mp3gain on it, then run mp3gain -u, and then "mp3gain -s d", the result
    will exactly match (cmp -l) the initial FILE.mp3.

    I don't want to run "mp3gain -s s" because (I think) I can't then undo my changes if I wish to.
    Since mpg123 plays back the files fine, I may just end up ignoring the message from mpg123.

    I'm going to look for some mpg123 forum and see what I can learn over there.   If I find anything
    useful, I will post the results back here in case anyone else is looking for an answer to this
    question in this forum.

    Thanks for your expertise.

  • Glen Sawyer

    Glen Sawyer - 2013-01-09

    Another option is to use the "-s i" switch, which will make MP3Gain write ID3v2 tags instead of the default APEv2 tags.
    Someone else contributed the ID3v2 tagging code, so I never tested it as thoroughly as the APE tagging code. But for basic usage it should be okay.

  • xr200

    xr200 - 2013-01-11

    I'm very impressed and humbled by the expertise of the people who replied to my query.

    I did post a question to the mpg123 forum and here's a snippet of the answer:

    "That's APE tags added to the data. This is a special kind of tag format that mpg123 does not understand, but due to the nature of MPEG streams can rather safely skip and ignore. The biggest issue here is the error message itself, no real problem."

    So as some replier suspected, the culprit is the APE tags.  

    And then another poster suggested using "-s i" instead of (the default) "-s a", and as suspected,
    when using the "-s i" option, mpg123 now plays the tracks back without any unnecessary


  • Clayton Macleod

    Clayton Macleod - 2013-01-11



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks