complexlogic / rsgain

A simple, but powerful ReplayGain 2.0 tagging utility
Other
289 stars 21 forks source link

opus-mode=t does not seem to do anything. #81

Closed DmitriK closed 1 year ago

DmitriK commented 1 year ago

I found this project after the r128gain project was deprecated. For my opus files, I used the r128gain --opus-output-gain option, which according to the help output:

For Opus files, write album or track gain in the 'output gain' Opus header. This gain is mandatory to apply for all Opus decoders so this improve compatibility with players not supporting the R128 tags.

Looking at the rsgain help output, the --opus-mode=t seems to be what I'd want to replicate this. However, I tried to use this option on my opus files, and it doesn't seem to do anything, and the file remains unmodified. I'm not sure if there's an issue, or I'm missing an option or something that would actually do the write

To run through an example, I downloaded an opus sample file at https://opus-codec.org/static/examples/ehren-paper_lights-96.opus. In the following, I use rsgain to measure the loudness, attempt to use rsgain to set the output gain header, re-measure with rsgain (which shows no change), use r128gain to update the header, re-measure with rsgain (which shows an expected -23dB LUFS)

$ rsgain custom ehren-paper_lights-96.opus
Track: ehren-paper_lights-96.opus
  Loudness:   -14.66 LUFS
  Peak:     1.000000 (0.00 dB)
  Gain:        -3.34 dB
$ rsgain custom --opus-mode=t ehren-paper_lights-96.opus
Track: ehren-paper_lights-96.opus
  Loudness:   -14.66 LUFS
  Peak:     1.000000 (0.00 dB)
  Gain:        -3.34 dB
$ rsgain custom ehren-paper_lights-96.opus
Track: ehren-paper_lights-96.opus
  Loudness:   -14.66 LUFS
  Peak:     1.000000 (0.00 dB)
  Gain:        -3.34 dB
$ r128gain --opus-output-gain ehren-paper_lights-96.opus
Analyzing loudness of file 'ehren-paper_lights-96.opus'...                                                                                                                                                           
File 'ehren-paper_lights-96.opus': loudness = -14.7 LUFS, sample peak = -                                                                                                                                            
Tagging file 'ehren-paper_lights-96.opus'
$ rsgain custom ehren-paper_lights-96.opus
Track: ehren-paper_lights-96.opus
  Loudness:   -22.96 LUFS
  Peak:     0.418701 (-7.56 dB)
  Gain:         4.96 dB
complexlogic commented 1 year ago

The program doesn't write any tags by default. Make sure to add -s i to the arguments to enable the write mode. Then you can verify the gain was written to the header with the opusinfo utility.

DmitriK commented 1 year ago

Ok, adding -s i did work, I had assumed that only controller the writing of actual metadata tags, and that the output header would be considered different. My mistake. That said, r128gain --opus-output-gain would also write a R128_TRACK_GAIN of 0. The result would be a file that is both RFC compliant, and normalized in a way that tools that don't read tags can use (in my case, dr14t_meter). I am aware of the RFC weirdness, fortunately the players i use either automatically add 5dB with anything that has a R128_TRACK_GAIN tag, or I was able to manually configure it to work. All that said, I can manually write the tag with opustags, so I'll be able to work around this. Don't know if it's worth adding a mode that essentialy becomes a combo of s and t.

complexlogic commented 1 year ago

The RFC actually doesn't require the R128_TRACK_GAIN tags - they are optional. So the program actually is fully RFC-compliant when configured appropriately, i.e. with the -o 's' mode.

Regardless, I can see the benefit of having a R128_TRACK_GAIN with a value of 0, as some players will apply separate pregain values for files with and without ReplayGain tags. However, I don't want to alter the behavior of the program, for the purpose of maintaining backwards compatibility. It seems like you found a feasible workaround for your workflow, so I'm going to close this.