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: Opusenc.exe raises volume of encoded track (Read 4019 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Opusenc.exe raises volume of encoded track

You can see the behaviour in effect here (screenshot from audacity):



On top is the original flac, below the encoded opus file. As you can see the peak amplitude has been raised (even as far that clipping happens), but I can't see any setting about volume normalization in the encoder. What's going on there? This happens regardless if I use foobar2000 or the opusenc.exe directly - with all tracks that I tested.

Opusenc.exe raises volume of encoded track

Reply #1
Lossy encoding necessarily implies the audio won't be exactly the same, but usually "pretty close" (as far as your ears are concerned). "Pretty close" to the maximum value might sometimes be greater than the maximum, which results in what you're seeing. It happens much more often with audio that is heavily clipped, such as the audio you're using.

The same thing happens with MP3, AAC, Vorbis, and many other lossy codecs (unless the encoder intentionally reduces the volume for you - I seem to recall reading that some encoders do this).

Opusenc.exe raises volume of encoded track

Reply #2
This often occurs with lossy encoders. You should first normalize your source to -1 or -2 dB since it already looks clipped a lot.


Edit: Looks like I typed too slowly

Opusenc.exe raises volume of encoded track

Reply #3
Lossy encoding necessarily implies the audio won't be exactly the same, but usually "pretty close" (as far as your ears are concerned). "Pretty close" to the maximum value might sometimes be greater than the maximum, which results in what you're seeing. It happens much more often with audio that is heavily clipped, such as the audio you're using.

The same thing happens with MP3, AAC, Vorbis, and many other lossy codecs (unless the encoder intentionally reduces the volume for you - I seem to recall reading that some encoders do this).


Hm yeah, might have been an overreaction on my part. I just checked the same file with other codecs (at similar bitrates) and see a similar behaviour. I never realized that there was such a noticeable change in amplitude, especially when there is some (0.5db) headroom in the original recording (you stated that the original is already clipped... it isn't). It still seems weird to me though that the encoder doesn't try to avoid introducing clipping. Thinking about it further this would probably require some form of 2-pass encoding? I guess I gotta stick to ReplayGain processing beforehand.

@Brazil2: You also speak of clipping, I don't see any pre encoding. Maybe you guys mean compression?

Opusenc.exe raises volume of encoded track

Reply #4
You see where the amplitude of the FLAC is sustained at 1.0? That's usually evidence of clipping.

Even if there wasn't any actual clipping in the FLAC, the Opus encoder might any lossy encoder will occasionally go over 1.0 for those sections as Octocontrabass stated. To my eyes, that looks to be exactly what happened in this specific case.

However, it's still important to keep in mind that clipping in itself isn't a problem unless it's audible. If it is, you might consider playing with the gain of the original and try encoding again with more headroom.

Opusenc.exe raises volume of encoded track

Reply #5
I never realized that there was such a noticeable change in amplitude, especially when there is some (0.5db) headroom in the original recording (you stated that the original is already clipped... it isn't).
It could have been clipped and then reduced to -0.5dBFS. It wouldn't be very unusual - I have a lot of music that was mastered in this way.

Opusenc.exe raises volume of encoded track

Reply #6
Quote
You see where the amplitude of the FLAC is sustained at 1.0?

It's not though. But there's not a lot of headroom so it's easy to miss when taking a quick look at an Audacity screenshot



Quote from:  link=msg=866672 date=0
However, it's still important to keep in mind that clipping in itself isn't a problem unless it's audible. If it is, you might consider playing with the gain of the original and try encoding again with more headroom.


Yeah, that's exactly what I'm going to do just to err on the side of caution.

Opusenc.exe raises volume of encoded track

Reply #7
If the original is clipped then that adds some very high frequencies. Since lossy encoding typically removes some high frequencies, the clipping may actually be less audible after encoding.

Opusenc.exe raises volume of encoded track

Reply #8
I never realized that there was such a noticeable change in amplitude, especially when there is some (0.5db) headroom in the original recording (you stated that the original is already clipped... it isn't).
It could have been clipped and then reduced to -0.5dBFS. It wouldn't be very unusual - I have a lot of music that was mastered in this way.
I think I have far more CDs where the music is clipped/compressed up to a specific level that's a fraction of a dB below full scale than actually right up to full scale.

It doesn't help one bit, but I guess it makes the mastering engineers feel better when the "clipping" lights on meters don't come on.

I have plenty of CDs where certain tracks "clip" at several dB below full scale. That's where a track was mastered in isolation + clipped/compressed to full scale (or near it), and then found to be too loud in the context of the whole CD, and "turned down". That prevents additional clipping due to lossy encoding but is a really shoddy way of mastering a CD.

Cheers,
David.

Opusenc.exe raises volume of encoded track

Reply #9
Deathcrow, your screenshot is a prime example of clipped audio.
You see how the many peaks reach a maximum point?

Opusenc.exe raises volume of encoded track

Reply #10
Your original is most definitely clipped, just not clipped at full scale but rather at -.5 dB.

To go from a smooth waveform to one that is clipped involves very precise bursts of high frequency distortion to cancel out the crests of the signal just right so it stays at the saturation level. A lossy encoder that operates in the frequency domain simply isn't going to maintain the clipped level. Just a little difference in the phase of the different frequencies, totally inaudible to human listeners, will totally disrupt that cancellation.

So while a natural recording with a maximum amplitude of -.5dB probably has enough headroom, a recording clipped at that level doesn't, since any tiny change in the frequency domain can mess with the time domain max amplitude.

Suppose the unclipped version of your recording was peaking at 4 dB above full scale. To give that unclipped version enough headroom, you'd reduce the level by 4.5 dB.

Even though your version would have a max amplitude 4.5dB lower than the original, it would need to be reduced to give sufficient headroom. The only case where that wouldn't be true would be something like a square wave, where clipping does exactly the same thing as reducing the volume. It probably would need to be reduced by at least 2dB and might conceivably need to be reduced by up to the entire 4dB.

Note that though Opus has increased the recording's maximum amplitude, Opus is very unlikely to have made your recording any louder- if you decode the opus file to floating point (so the output isn't clipped but can go beyond full scale) and measure it with ReplayGain, EBU R128 tools, etc the human-perceived loudness will be the same as the original track.

Opusenc.exe raises volume of encoded track

Reply #11
Deathcrow, your screenshot is a prime example of clipped audio.
You see how the many peaks reach a maximum point?


Yes, you are right. I know what you are all speaking about now and I have seen it many times (clipped audio below the maximum level). This can be easily seen when looking at the wave-form zoomed in. Have a look at some of the peaks in this case:

.

In any case I was referring to the red clipping lines above maximum volume that were visible in the encode, when talking about the introduction (!) of clipping. Maybe it was just a misunderstanding.

(*) This is an example from a recent release (guess which ), which is usually what I'd describe as "badly clipped":

That's just sad. The sound has been mangled by the loudness war beyond any recognition.

 
SimplePortal 1.0.0 RC1 © 2008-2021