You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Opus: Support reading/writing the 'output_gain' header field #916
I’m currently adding Opus support to my loudgain loudness tagger but I’m unsure how to read an Opus file’s 'output_gain' header field using TagLib. I couldn’t find anything in the properties.
Any insights, please?
Reacted by Magnus, Austin Henderson, Orthestral and Felipe
In a perfect situation, this should even be writable (or least be able to set to zero).
Rationale: Needed for ReplayGain calculation, since the R128_TRACK_GAIN and R128_ALBUM_GAIN values are only an offset based on the 'output_gain'. Setting it back to zero to achieve "clean" ReplayGain values is usually done by encoders only, but might be good to have in a ReplayGain tagger, too.
changed the title [-]Opus: How to read the 'output_gain' header field?[/-][+]Opus: Support reading/writing the 'output_gain' header field[/+]on Sep 12, 2019
Probably every tagger or player written to use TagLib might need this. Here is an excerpt from the section of the OggOpus spec on the new R128 gain tags:
If present, R128_TRACK_GAIN and R128_ALBUM_GAIN MUST correctly
represent the R128 normalization gain relative to the 'output gain'
field specified in the ID header. If a player chooses to make use of
the R128_TRACK_GAIN tag or the R128_ALBUM_GAIN tag, it MUST apply
those gains in addition to the 'output gain' value. If a tool
modifies the ID header's 'output gain' field, it MUST also update or
remove the R128_TRACK_GAIN and R128_ALBUM_GAIN comment tags if
present. An encoder SHOULD assume that by default tools will respect
the 'output gain' field, and not the comment tag.
So all the R128_* tags are always relative to the 'output_gain' which means a player must be able to read both, and a tagger must be able to even write it.
Activity
Moonbase59 commentedon Sep 6, 2019
In a perfect situation, this should even be writable (or least be able to set to zero).
Rationale: Needed for ReplayGain calculation, since the R128_TRACK_GAIN and R128_ALBUM_GAIN values are only an offset based on the 'output_gain'. Setting it back to zero to achieve "clean" ReplayGain values is usually done by encoders only, but might be good to have in a ReplayGain tagger, too.
[-]Opus: How to read the 'output_gain' header field?[/-][+]Opus: Support reading/writing the 'output_gain' header field[/+]Moonbase59 commentedon Sep 12, 2019
Probably every tagger or player written to use TagLib might need this. Here is an excerpt from the section of the OggOpus spec on the new R128 gain tags:
So all the
R128_*tags are always relative to the 'output_gain' which means a player must be able to read both, and a tagger must be able to even write it.Header writing again … :-(
ufleisch commentedon May 7, 2026
Implemented with #1320.