Open xtemp09 opened 9 years ago
NB opusenc will convert ReplayGain tags attached to input flac files.
If input file doesn't contain ReplayGain information in metadata, the encoder won't add it. =(
I would have thought ReplayGain should be independent of audio encoding, as it can be done either before encoding (on the input .flac or .wav file) or after it (on the output .opus). I usually use foobar2000 to calc ReplayGain on the resulting Opus files.
Saying that, an optional(?) --add-replay-gain [album|track] switch on the encoder side would be a "nice bonus", conducive to Opus adoption on the net :-)
(or we could be super pro-active and make the encoder always add ReplayGain if it's missing, unless --no-replay-gain is used?)
@MisterZeus, as I know it ReplayGain is always used as a tag, it never clips the audio directly.
From my research, I could find that the wiki lists that as a To Do (https://wiki.xiph.org/OpusTodo): "EBU R128/Replaygain (half done— needs a gain tool)"
There is already initial work on this repo https://github.com/kepstin/opusgain, maybe someone could pick it again?
While the official support is not here, I just found two nice third-party that can do the job (both using R128_TRACK_GAIN of course).
https://github.com/kepstin/regainer and https://github.com/desbma/r128gain (this one besides the name has nothing to do with the old R128GAIN that now is called BS1770GAIN).
@rillian you said "NB opusenc will convert ReplayGain tags attached to input flac files" but I read here that the Opus RFC itself recommends avoid this. Is that correct?
The Opus RFC distinguishes between replaygain the feature, and REPLAY_GAIN the tag format. It says to implement the replaygain feature using tags with the EBU R128 normalization standard which is better defined and more professional.
The RFC says that tools shouldn't write tags using the REPLAY_GAIN normalization in opus files, the way loudness-scanner is reported to do in that thread.
What opusenc does instead is to convert REPLAY_GAIN tags in an input flac file to the R128 normalization scheme and write overall and R128_TRACK_GAIN
annotations representing the same levels. So that's ok by the spec. What it's trying to avoid is just copying the REPLAY_GAIN tags without any conversion to the Opus standard.
Does that make sense?
Refs the related #39 :)
Hello,
I'm not sure if this is the correct issue but I'm having a problem with how the Opus tools handle some ReplayGain tags.
Here are the steps to reproduce the problem:
loudgain -a -k -s e 01_Ghosts_I.flac
(I'm using loudgain 0.6.8)REPLAYGAIN_ALBUM_GAIN=-2.97 dB
REPLAYGAIN_ALBUM_PEAK=0.956751
REPLAYGAIN_ALBUM_RANGE=6.32 dB
REPLAYGAIN_REFERENCE_LOUDNESS=-18.00 LUFS
REPLAYGAIN_TRACK_GAIN=-2.97 dB
REPLAYGAIN_TRACK_PEAK=0.956751
REPLAYGAIN_TRACK_RANGE=6.32 dB
opusenc --bitrate 128 01_Ghosts_I.flac 01_Ghosts_I.opus
opusinfo 01_Ghosts_I.opus
and notice the 'Playback gain' value:
REPLAYGAIN_ALBUM_RANGE=6.32 dB
REPLAYGAIN_TRACK_RANGE=6.32 dB
R128_TRACK_GAIN=0
Playback gain: 99.0312 dB
The Opus file is unplayable now, very loud and distorted. If you use opusdec
you'll get a completely clipped signal.
Could you add ReplayGain calculation?