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: Zoog: an (experimental) tool for modifying Opus header gain (Read 1063 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Zoog: an (experimental) tool for modifying Opus header gain

I recently had a look at encoding some of my music into Opus having first ripped it to FLAC. When playing these files I then encountered the problem that I've seen people post about elsewhere, that the files play too quietly. After some research I found out that this was due to opusenc setting the gain value in a binary field in the Opus header to normalize the file volume according to EBU R 128 when it sees ReplayGain information in the FLAC file.

I don't use a fancy player that supports R128 tags, but neither did I want to strip these tags from the FLAC before encoding since this would eliminate the R128 (R128_ALBUM_GAIN and R128_TRACK_GAIN) tags in the Opus file which might be useful later on if I migrate players.

As a way to work around this on the weekend, I've written Zoog. Zoog can apply a delta to the output gain header inside an Opus stream and at the same time apply the inverse delta to the R128 tags inside the file (meaning that playback volume won't change for R128-aware players). Zoog doesn't decode the audio itself so it requires the 128_ALBUM_GAIN or R128_TRACK_GAIN tags to be present in order to determine a loudness reference. It can then alter the binary output gain value inside the file so that in a player that doesn't support R128, playback occurs at either: the volume of the source, -18 LUFS (ReplayGain), or -23 LUFS (EBU R 128).

I've got generation of binaries for Linux, Windows and MacOS  working, but I've only been testing on Linux. The code is also very new and untested, and could potentially corrupt files, so only use on files you have a backup of / can easily regenerate if necessary.

Hopefully this tool might be of use to other Opus users who have encountered similar issues until a opusgain equivalent is available with support for setting the output-gain value as well.


 

Re: Zoog: an (experimental) tool for modifying Opus header gain

Reply #1
Useful tool. But it is 5 megabytes and only 64-bit for just editing a header. A free volume adjustment of the header gain could also be useful for making a recording louder or quieter without scanning and normalizing. This should be added to the gain tags if they exist.

Re: Zoog: an (experimental) tool for modifying Opus header gain

Reply #2
The nature of Opus embedding within Ogg and the possibility of the comment header size increasing means that it needs to rewrite the stream. The release builds still retain debug information which is useful for if anyone encounters an error. As far as I'm aware, 32-bit systems are no longer in significant use since 2010, which is why I made the builds 64-bit.

 
SimplePortal 1.0.0 RC1 © 2008-2021