How to normalize the volume of an OPUS file

The rgain project can do this. It's in the Debian replaygain package (not on Ubuntu yet, sorry), though the Debian package doesn't yet support the .opus extension (see its issue 13, resolved in version 1.0.0, which comes after 1.3.4).

I installed the Debian package (warning, I'm running Debian Testing, not Ubuntu) and then edited /usr/lib/python3/dist-packages/rgain3/rgio.py to add .opus to the following stanza starting on replaygain-1.0.0-1's line 360:

    BASE_MAP = {
        ".ogg": _simplereaderwriter,
        ".oga": _simplereaderwriter,
        ".opus": _simplereaderwriter,
        ".flac": _simplereaderwriter,
        ".wv": _simplereaderwriter,
        ".m4a": _mp4readerwriter,
        ".mp4": _mp4readerwriter,
    }

Alternatively, install without package management as per the rgain instructions.

Then it's just a matter of running replaygain file.opus


I found loudgain in the 21.04 Hirsute repos:

Package: loudgain Section: universe/sound Description-en:

ReplayGain 2.0 loudness normalizer based on the EBU R128 standard loudgain is a loudness normalizer that scans music files and

calculates loudness-normalized gain and loudness peak values according to the EBU R128/ITU BS.1770 standard (-18 LUFS).

loudgain will embed ReplayGain 2.0-compatible metadata tags in a file if requested but will not modify the audio data in any way.

loudgain supports the FLAC, Ogg, MP2, MP3, MP4, M4A, ALAC, Opus, ASF, WMA, WAV, WavPack, AIFF and APE audio formats. Video files with compatible audio streams are also supported.