Jump to content

Album gain not being applied with Opus files


Recommended Posts

Poweramp build number: v3-build-874-arm64-play
Device: Pixel 3a
Android version: 10
No custom ROM
I cannot get album gain to be applied when playing an Opus file. Only the track gain is applied, no matter what I select in the audio settings screen.
Here is the output of opusinfo aka.opus:
New logical stream (#1, serial: ea3c018d): type opus
Encoded with Lavf58.45.100
User comments section follows...
        ALBUM ARTIST=Rina Sawayama
        ALBUMARTIST=Rina Sawayama
        ARTIST=Rina Sawayama
        ENCODER_OPTIONS=--vbr --bitrate 160
        TITLE=Akasaka Sad
Opus stream 1:
        Pre-skip: 312
        Playback gain: 0 dB
        Channels: 2
        Original sample rate: 48000 Hz
        Packet duration:   20.0ms (max),   20.0ms (avg),   20.0ms (min)
        Page duration:   1000.0ms (max),  910.9ms (avg),   20.0ms (min)
        Total data length: 217080 bytes (overhead: 0.9%)
        Playback length: 0m:10.013s
        Average bitrate: 173.4 kbit/s, w/o overhead: 171.9 kbit/s
Logical stream 1 ended

Note that it only says the encoder is lavf58.45.100 because I losslessly cut it with ffmpeg so that it would be under 0.49 Mb and I could attach it here. The file was originally encoded using opusenc.

As you can see, R128_ALBUM_GAIN is -50 and R128_TRACK_GAIN is -4096. If Poweramp correctly applied this gain I would expect to see a significant volume difference when I switch from Source: Album to Source: Track in audio settings.

However, I don't see any change. In fact, the song is fairly low in volume which leads me to believe that Poweramp is ignoring the album gain tag and only applying the track gain.


Link to comment
Share on other sites


(a question, does track gain work for you? Poweramp doesn't apply enough gain for me)

Of those two Opus samples, Tone low is far quieter than Tone high. I'm not sure if that's correct or not 😄.

EDIT: same experience using foobar2000 mobile


Personally I don't enable Opus header gain ever. It's simply a hack to try to make Opus files work with players that haven't implemented Replaygain yet, but it makes it harder for developers to implement Replaygain because they have to make sure they aren't applying gain twice (once from the header and again from the tags). In foobar2000 I always make sure Advanced > Tagging > Opus > Header gain is set to null. And whenever I encode I make sure to do it from FLAC files that aren't tagged with Replaygain, otherwise the encoder will write the gain into the header.

Edited by chardish
Link to comment
Share on other sites

1 minute ago, chardish said:

Of those two Opus samples, Tone low is far quieter than Tone high. I'm not sure if that's correct or not 😄.

No, it's not correct, but @maxmp just said he couldn't reproduce with these test files (which leads me to believe he didn't compare the two Opus files somehow). Do you think maybe it's the header gain's fault?


Also +1, I want Opus album gain support.

Link to comment
Share on other sites

It's the header gain. I disabled it like you said you did and now everything works. I encoded from foobar2000.

Now I need to find a way to make it work from Linux though, from the terminal. I get to encode my music into 80GBs of Opus music, again. And I'm gonna have to resize the embedded artwork, again, because otherwise Poweramp gets angry and crashes while scanning.

EDIT: Wait, fb2k can just remove header gain and then scan the files again. Nice.

Edited by null
Link to comment
Share on other sites

8 hours ago, null said:

EDIT: Wait, fb2k can just remove header gain and then scan the files again. Nice.

And it can do it as a batch task if you simply load the overall folder. I did all of my albums a few months ago so I know everything is now consistent (overwrote any old values). Took a little while to process, but I don't think it was more than an hour or so for 10,000+ files.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...