Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: ReplayGain writes bad Opus Header Gain (Read 2765 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ReplayGain writes bad Opus Header Gain

Original file:

File name : 18. Van Halen - Can't Stop Lovin' You (2004 Remaster).ogg
File size : 4.31 MB (4 523 992 bytes)
Last modified : 2020-12-30 22:45:34
Duration : 4:08.200 (11 913 600 samples)
Sample rate : 48000 Hz
Opus header gain : 0.00 dB
Original sample rate : 48000
Channels : 2
Bitrate : 127 kbps
Codec : Opus
Track Gain: -10.99 dB
Track Peak: 1.169031

When I use FB2K 1.6.2 per-file track gain it changes Opus Header Gain to -15.99 dB and the song is so quiet that it's difficult to hear even at 100% volume. When I scan the whole album as an album the Opus Header Gain is changed to -15.16 dB, which is still absurdly quiet. Audacity measures the RMS volume of the track after ReplayGain at -26.432 dB.

I noticed it because I'm trying to put together a USB thumb drive for the car and want everything to be the same volume, but some tracks are so insanely quiet after ReplayGain that it's unusable.

Re: ReplayGain writes bad Opus Header Gain

Reply #1
After more investigation it looks to be a problem with using RMS. Normalizing this track to -18 dB RMS in Audactiy only requires -7 dB.

Re: ReplayGain writes bad Opus Header Gain

Reply #2
Opus gain headers are supposed to target -23 LUFS. foobar2000 uses R128, but uses ReplayGain relative levels, which target -18 LUFS. So the Opus header and tag fields will be written with a -5 offset, and played with a +5 offset to whatever is already in the headers. If your software is applying the headers as-is, blame that software for not offering a different volume target than -23 LUFS.

 

Re: ReplayGain writes bad Opus Header Gain

Reply #3
That would be foobar2k.

However, the -15.99 dB tag being written by foobar is causing the RMS volume to be -26.437.

Re: ReplayGain writes bad Opus Header Gain

Reply #4
R128 is not RMS.

Re: ReplayGain writes bad Opus Header Gain

Reply #5
Opus gain headers are supposed to target -23 LUFS. foobar2000 uses R128, but uses ReplayGain relative levels, which target -18 LUFS. So the Opus header and tag fields will be written with a -5 offset, and played with a +5 offset to whatever is already in the headers. If your software is applying the headers as-is, blame that software for not offering a different volume target than -23 LUFS.
I've noticed that my Opus files with ReplayGain tags (added by Foobar) play too quietly in pretty much every other app. They play at the correct volume in Foobar though. Are you suggesting that the other apps are not implementing ReplayGain in Opus correctly?

The only workaround I've found is to use another format. :(

Re: ReplayGain writes bad Opus Header Gain

Reply #6
Can you go in to the Foobar preferences > Tools > Replaygain Scanner and change the Analyze loudness using to Classic replaygain and rescan your file and see if the volume matches the other players.
Who are you and how did you get in here ?
I'm a locksmith, I'm a locksmith.

Re: ReplayGain writes bad Opus Header Gain

Reply #7
Can you go in to the Foobar preferences > Tools > Replaygain Scanner and change the Analyze loudness using to Classic replaygain and rescan your file and see if the volume matches the other players.
Nope, with classic ReplayGain the volume of the tracks is still different in other players.

Re: ReplayGain writes bad Opus Header Gain

Reply #8
Advanced Preferences: Tagging | Opus | Header gain
(Don't know, how this setting works)

Another setting: Opus Header Gain - Setup

Maybe it has to do with the 5 LU (dB) correction. (Normalization: -23 LUFS or -18 LUFS)

Re: ReplayGain writes bad Opus Header Gain

Reply #9
Blame xiph/opus for deciding on -23 LUFS, or other players for not following the separate opus header gain and ReplayGain info specs properly. Writing RG info to the opus header gain "should" be the RG value minus 5, foobar is behaving correctly, or rather within the spec. If you dislike it, you can right click the file, go to ReplayGain, "Manipulate Opus header gain", and then type in the RG Track Gain value, like so:



Note, this is not meant as a knock against you. I face the same problem, and I "violate the opus spec" by writing that -18 LUFS RG value into that stupid header tag. I do this whenever I have to use an .opus file. Just know that foobar will re-write the -5 value if you ever edit the tags. Album, artist, year, album art, doesn't matter - any tag edits = header gain value changes.

It's ridiculous for multiple reasons, but it is what it is, and unless you or someone else writes an fb2k component for it, I really don't think there's any way the devs are going to implement a toggle for a feature that would intentionally write "out of spec" header gain tags.

  • opus spec REQUIRES compliant decoders to adhere to the header gain values
  • opus spec actually strongly advises against writing RG info to separate tags
  • opus spec has no provision for a tag "peak value"

Guess what 1-3 mean when combined? Go ahead, write +20 dB in the header gain tag. Instant deep-fried ear-rape. All spec-compliant decoders must oblige and blow your eardrums and speakers out. It goes so deep you can mux that malicious audio into a WEBM or an MKV, and it will play that way. On everything. So at least they got something right.

Here's something I wrote for the older opus/replaygain thread and never posted because I'd have been necro/bumping it, even though people ended up bumping it afterwards anyways...



What an ugly mess. All this has resulted in is me violating the spec by not only writing RG tags to all of my .opus files, but also setting the Opus header gain to the same value as the RG Track Gain (EBU R128 @ -18 LUFS) i.e. 5 LU "too loud." It's the only way to get consistent playback.

Dodge me with that -23 LUFS nonsense, I am not watching TV, or listening to European radio. I am listening to my own music, the entirety of which has been at 89 dB for close to two decades, with "updates" to EBU R 128 -18 LUFS whenever I notice really old tags.

I think it's funny how the Wikipedia page for EBU R 128 claims it "ended the loudness wars" and then dumps this on you:

Target LevelPlatform
−14 LUFSTidal, Amazon Music, YouTube, Spotify
−16 LUFSApple Music
−18 LUFSQobuz


That doesn't look over at all, it just looks like Qobuz and Apple Music "lost the war"...

Shout out to Qobuz for actually going with the sensible, correct value for music too.



Choosing -23 LUFS as a target and not making some kind of provision for RG info all but killed any use I had for the format for music. CoreAudioToolbox/qaac AAC is still just as good as it ever was.