Skip to content

replaygain: Use R128 gain tags when available

Val Packett requested to merge valpackett/gstreamer:r128tags into main

This is the actual fix for #1639 (closed) (:

RFC 7845 section 5.2.1 defines R128_TRACK_GAIN and R128_ALBUM_GAIN vorbiscomment tags to be used in Ogg Opus files in preference to ReplayGain.

[EBU-R128] normalization is preferred to the earlier REPLAYGAIN schemes because of its clear definition and adoption by industry. Peak normalizations are difficult to calculate reliably for lossy codecs because of variation in excursion heights due to decoder differences. In the authors' investigations, they were not applied consistently or broadly enough to merit inclusion here.

mpv code for reference // and no, I have no idea how (..is it called per tag actually?) code that early-returns when REPLAYGAIN_* are present ends up preferring R128_* in practice but it does! I have a funny file with conflicting tags

      R128_ALBUM_GAIN : -3328
      R128_TRACK_GAIN : -3584
      REPLAYGAIN_ALBUM_GAIN: 5.00 dB
      REPLAYGAIN_ALBUM_PEAK: 0.236628

and mpv correctly picks up R128 values making it quieter, not louder

[cplayer] Replaygain: Track=-9.000000/0.000000 Album=-8.000000/0.000000
[cplayer] Applying replay-gain: 0.354813
[cplayer] ...with clipping prevention: 0.354813

and with this patch GStreamer does too.

Merge request reports