mp3rgain FAQ

Updated · mp3rgain v3.16.2

Answers to the questions that come up most often about lossless volume normalization with mp3rgain: how the gain rewrite works, what is reversible, which formats are covered, and how it relates to the tools it replaces.

How does mp3rgain change volume without re-encoding?

MP3 and AAC frames carry a global_gain field that scales the decoded output. mp3rgain rewrites that field in every frame (1 step = 1.5 dB). The compressed audio data itself is never touched, so quality is preserved and the change is permanent on any player or device.

Is mp3rgain a drop-in replacement for mp3gain?

For most setups, yes. The CLI flags, the TSV output format, and the APEv2 MP3GAIN_UNDO tag are mp3gain-compatible, so existing scripts, Dockerfiles, and parsers (e.g. beets) keep working, and migration is usually a one-line sed substitution. A few defaults differ on purpose: mp3rgain re-analyses unless you pass -s R (mp3gain reuses stored tags unless you pass -s r), -a -e applies track gain where mp3gain applies nothing, and on MP3 the ReplayGain tags go to ID3v2 unless you pass -s a.

Is mp3gain safe to use, and is mp3rgain safer?

It depends on where your copy of mp3gain came from. mp3gain 1.6.2 and the code it bundles have 21 published CVEs, mostly memory errors in its bundled MP3 decoder and its APE tag code that a crafted file can trigger. The Debian and Ubuntu packages are patched; the Windows downloads on SourceForge and the Chocolatey package are not, and there has been no upstream release with the fixes. mp3rgain shares no code with mp3gain or aacgain: it is written in Rust, its own source has no unsafe blocks, and it decodes with the pure-Rust Symphonia library, so that class of bug does not carry over. That is a statement about its design, not a guarantee that it has no bugs. The CVE list and each distribution's status are on Is mp3gain safe?.

Is there an mp3gain for current Windows and macOS?

mp3rgain is one. The desktop app, mp3rgui, runs on Windows 10 and 11 (x64 and ARM64), on macOS 11 or later (Apple Silicon and Intel), and on Linux, and it follows the classic MP3Gain workflow: add files, run Track Analysis or Album Analysis, then apply Track Gain or Album Gain. The original mp3gain has made no release since 1.6.2 and its Windows download is far older than that. On Windows, the installer is at mp3rgain.tyna.ninja/download/windows; on macOS, brew install --cask M-Igashi/tap/mp3rgui. See the desktop app page.

Is mp3rgain free?

Yes. mp3rgain and mp3rgui are free, open-source software under the MIT license, with no ads, accounts, or telemetry, and nothing to buy. The source code and every release are on GitHub.

What is the difference between track gain and album gain?

Track gain (-r) gives every file its own correction, so each track ends up at the reference level: right for playlists and shuffled listening. Album gain (-a) computes one correction for a whole album and applies it to every track, which keeps the quiet tracks quiet and the loud ones loud relative to each other, as the album was mastered. On the command line, plain -a treats every file given as one album, as mp3gain does; --album-by dir or --album-by tag splits a whole library into albums. The desktop app groups albums per folder by default.

Can I undo a gain change?

Yes. mp3rgain records the applied gain in an undo tag (mp3gain's own MP3GAIN_UNDO on MP3, an mp3rgain_undo atom on AAC), and mp3rgain -u puts every frame back to its original gain, for MP3 and AAC/M4A alike. The audio comes back exactly, and a file that had no ID3v2 tag of its own is byte-identical to the original (since 3.16.2; earlier versions left an empty tag behind). An MP3 that already had an ID3v2 tag keeps it, rewritten as ID3v2.4. Frames clamped at the 0 or 255 gain limit cannot be restored; mp3rgain warns when that happens. An AAC file that crackles after a gain change by 2.8.0 to 3.11.1 has to be undone with that version (see the next question). foobar2000's AAC gain feature, by contrast, has no undo path.

My AAC files crackle after a gain change. How do I fix them?

Versions 2.8.0 to 3.11.1 misread a fill element that FDK-AAC writes (fdkaac, ffmpeg's libfdk_aac, and tools built on them) and left those frames at their original volume while the rest of the file moved, so after a large change each one is heard as a click. 3.12.0 fixes it (#402). Undo an affected file with the old version first (mp3rgain -u, or Undo Selected in mp3rgui), then upgrade and apply the gain again. Undoing it with 3.12.0 or later makes it worse: the new version also moves the frames the old one never changed, so they end up louder than the original. If you have already upgraded, the 3.11.1 downloads are on its release page. MP3 files, and AAC files that do not crackle, need nothing.

What replaced aacgain? Is there a maintained aacgain alternative?

aacgain's last release was 2.0.0 (December 2019) and its last commit was in July 2022, with no security fixes applied. As far as we know, mp3rgain is the only actively maintained CLI for lossless AAC/M4A bitstream gain adjustment: cross-platform, scriptable, and undoable, with the same CLI conventions as mp3gain and aacgain. It handles AAC in M4A/MP4 and raw ADTS .aac streams.

How is this different from ReplayGain tags written by rsgain, loudgain, or ffmpeg?

It is a superset, not an alternative. mp3rgain runs the same kind of ReplayGain analysis and writes the standard REPLAYGAIN_TRACK_GAIN / REPLAYGAIN_ALBUM_GAIN tags too, but it also applies the gain to the bitstream itself, so the corrected volume plays everywhere, including on hardware players, car stereos, and apps that ignore ReplayGain tags. If you only want the tags, --tags-only does that. By default it uses the ReplayGain 1.0 algorithm (89 dB reference) for mp3gain compatibility; since v3.0, --rg2 and --r128 measure loudness with ITU-R BS.1770 (LUFS), consistent with those tools.

Can I use mp3rgain to prepare DJ tracks for rekordbox and CDJs?

For MP3 and AAC, yes: CDJs and other DJ hardware ignore ReplayGain tags, and gain rewritten into global_gain is a change they do play back. For a whole DJ library, Bake'n Deck is the better fit. It is by the same author and has mp3rgain built in, and it brings every track to a -0.5 dBTP true peak ceiling (gain only, no limiter), handles FLAC, AIFF, WAV, and ALAC as well, keeps rekordbox cues and beatgrids linked, sorts playlists by key and BPM, and makes a CDJ-safe MP3 backup USB. rekordbox's own Auto Gain is never written into exported files, so it does not reach the CDJ.

Why does mp3rgain report a higher peak than rsgain on my AAC files?

Because the two are measuring different signals, and both are right about their own input. Lossy AAC decodes to samples that can exceed full scale, and decoders disagree about what to do with them: symphonia (which mp3rgain uses) and ffmpeg's native decoder pass them through, while Apple's AudioToolbox decoder hard-limits at exactly 1.0. mp3rgain reports the decoded signal as it is, which is the headroom a float playback path actually needs. On the file this was investigated with, mp3rgain measured a true peak of 2.287768 and rsgain 1.307024, and 1.3215 is exactly what an ideal band-limited interpolation of the clamped signal gives. The gain values agree to 0.01 dB throughout, and applying each track's gain brings the unclamped peak below full scale anyway, so no player attenuates differently. The bursts themselves come from the encoder: re-encoding the same source with Apple's encoder dropped that track from 1.790314 to 1.276827.

Does mp3rgain write ReplayGain tags?

Yes. Track and album gain (-r, -a) write REPLAYGAIN_TRACK_GAIN and REPLAYGAIN_TRACK_PEAK, plus REPLAYGAIN_ALBUM_GAIN and REPLAYGAIN_ALBUM_PEAK in album mode. Since 3.2.0 the MP3 default puts REPLAYGAIN_* in ID3v2, where players look (ffmpeg does not read APEv2 on MP3 at all), while MP3GAIN_UNDO stays in APEv2 for mp3gain interop. Use -s a for the old all-APEv2 layout or -s i to put everything in ID3v2. AAC in MP4 uses iTunes freeform atoms and raw ADTS uses ID3v2. Following mp3gain's convention, the values describe the residual gain left after the bitstream rewrite, so ReplayGain-aware and ReplayGain-blind players arrive at the same loudness. In the --rg2 and --r128 modes a REPLAYGAIN_ALGORITHM tag records which measurement was used. Manual gain (-g) shifts stored ReplayGain values by the gain it applies (since 3.10.0), and -s s writes no tags at all, including the undo tag.

Does mp3rgain support EBU R128 or ReplayGain 2.0 loudness?

Yes, since v3.0. ReplayGain 1.0 stays the default so re-scans land on the same gain steps as mp3gain, and two opt-in flags select ITU-R BS.1770 gated loudness measurement: --rg2 normalizes to the ReplayGain 2.0 reference of -18 LUFS and --r128 to the EBU R128 broadcast target of -23 LUFS. Add --true-peak to measure true peak instead of sample peak. The test values agree with ffmpeg's ebur128 filter within 0.05 LU. The GUI has a matching analysis mode selector.

Does mp3rgain need ffmpeg or other dependencies?

No. mp3rgain is a single binary with no external tools to install: no ffmpeg, mp3gain, or aacgain. Decoding for analysis is done by the pure-Rust Symphonia library built into the binary. (The Linux GUI needs GTK 3.)

Does mp3rgain support FLAC, Opus, or Vorbis?

No. mp3rgain reads MP3 and AAC only; FLAC, Ogg (Vorbis, Opus), and WAV are not supported for analysis or gain. With -R they are ignored, and named directly they fail with an error. A tag-based tool such as rsgain is the right choice for those formats. ALAC and DRM-protected M4P files are different: mp3rgain recognises them and reports them as skipped, leaving the file alone without failing the rest of the run.

Does mp3rgain handle raw .aac files and video MP4s?

Yes, both since v3.7.0. A raw ADTS .aac stream (what ffmpeg -f adts, DVB and HLS captures, and some rippers produce) gets the same lossless global_gain rewrite and undo as AAC in an M4A container. A raw stream has no container for metadata, so its undo and REPLAYGAIN_* values go into an ID3v2 tag and the -s a / -s i layout choice does not apply. In an MP4 with video, mp3rgain finds the AAC audio track behind the video track and adjusts it. If a file has several audio tracks, gain is applied to the first one.

Can I write ReplayGain tags without changing the audio?

Yes, with --tags-only since v3.5.0. It analyses as usual but stores the absolute REPLAYGAIN_* values and leaves the audio untouched, the way loudgain and rsgain work, so the listener keeps the choice of turning ReplayGain off in their player. It needs -r, -a, or -e, and writes no undo tag because nothing was changed. The trade-off is the point of mp3rgain in reverse: no correction is baked in, so hardware that ignores ReplayGain tags plays the file at its original loudness.

Is there a GUI version?

Yes. mp3rgui is a desktop app for macOS, Windows, and Linux with drag and drop, parallel track and album analysis (RG 1.0, RG 2.0, or R128), album grouping per folder or by tags, an options panel for the common CLI flags, and an undo menu, in English, Brazilian Portuguese, German, Indonesian, Italian, Japanese, and Turkish. Its defaults differ from the CLI: Prevent clipping and Preserve mtime are on, and Album Gain treats each folder as one album. Install with brew install --cask M-Igashi/tap/mp3rgui, winget install M-Igashi.mp3rgui (or the Windows installer at mp3rgain.tyna.ninja/download/windows), yay -S mp3rgui, or sudo apt install mp3rgui from the apt repository on Debian 13+ and Ubuntu 24.04+.

Is mp3rgui available in my language?

mp3rgui follows the system language and has a Language menu. It ships in English, Brazilian Portuguese, German, Indonesian, Italian, Japanese, and Turkish (German and Indonesian since v3.15.0), compiled into the app, so every package includes them. A new language is one gettext .po file and needs no programming: issue #440 on GitHub explains how. The command-line tool stays English, since scripts and mp3gain front-ends read its output.

How do I install mp3rgain?

macOS: brew install M-Igashi/tap/mp3rgain or sudo port install mp3rgain. Windows: winget install M-Igashi.mp3rgain. Debian 12+ and Ubuntu 22.04+, 26.04 included: the apt repository published with every GitHub release, then sudo apt install mp3rgain (setup on the install page). The Ubuntu PPA is deprecated and stops receiving updates after 2026-12-31. Arch Linux: yay -S mp3rgain-bin (a third-party package). Nix: nix profile install github:M-Igashi/mp3rgain. pkgx: pkgx mp3rgain. Android (Termux): pkg install tur-repo, then pkg install mp3rgain. Docker: docker pull ghcr.io/m-igashi/mp3rgain:latest. Cargo (Rust 1.85+): cargo install mp3rgain. Release archives for every platform are on GitHub Releases.

Can I use mp3rgain in Docker or CI pipelines?

Yes. Official multi-arch images (linux/amd64, linux/arm64) are published to ghcr.io/m-igashi/mp3rgain with the tags latest, vX.Y.Z, and vX. The image is FROM scratch around a static musl binary (about 2 MB) with the binary as entrypoint, so all CLI flags work as on the host. It replaces mp3gain in containerized batch jobs such as Plex library maintenance. Run it with --user so rewritten files are owned by you.

Will rewriting files break my backups or sync?

Applying gain rewrites the file, which updates its modification time and makes rsync, Syncthing, and most backup tools re-transfer it. Pass -p to keep the original modification time. Each write goes to a temporary file that then replaces the original, so permissions are kept but hard links, ownership, and extended attributes are not. A symlink keeps pointing at the updated file (since 3.10.0). A read-only file is refused rather than replaced (since 3.11.0).

Next

Not covered here? Open an issue on GitHub, or browse the download statistics and project documentation.