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: Why is opus introducing audio that wasn't there? (Read 9832 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Why is opus introducing audio that wasn't there?

Opus is introducing audio in higher frequencies upto 20kHz.

IN.flac is a FLAC file sourced from a CD.


Now when it is encoded @96kbps:


You can see the source audio file didn't have any audio above 16kHz but the audio file encoded at 96kbps clearly does.

Now @128kbps


Now @160kbps


Now @192kbps


Now @256kbps


As you can see the "introduction of new audio" decreases as the bitrate increases.  I wonder why?

And why not no audio at all if there isn't any to begin with?

Re: Why is opus introducing audio that wasn't there?

Reply #1
Clipping


Re: Why is opus introducing audio that wasn't there?

Reply #3
Weird that a FLAC file sourced from a CD cuts off at 16kHz.

Re: Why is opus introducing audio that wasn't there?

Reply #4
Clipping
The clipping isn't because the real source audio goes beyond full scale, but because the lossy encoded audio isn't a 100% accurate reproduction of it.  Lossy files can decode to well beyond full scale, for very brief periods rather than audible lengths of time, and so would clip.  Not usually audible, but stronger at lower bitrates.  Assuming that's what translates to the high frequencies you didn't expect.

Re: Why is opus introducing audio that wasn't there?

Reply #5
It also depends on the frequency ranges that are covered by the codec. It may introduce noise at higher frequencies than were present in the original. It should not be different. Well, that much subjectively different, ranging from inaudible to just barely audible to annoying. It just depends on the material and the quality settings used. Disclaimer: I was just pulling all this information out of my back side, I don't have any formal education on audio compression technologies.

Re: Why is opus introducing audio that wasn't there?

Reply #6
From https://people.xiph.org/~xiphmont/demo/celt/demo.html:

Quote
"CELT" stands for "Constrained Energy Lapped Transform" an accurate and remarkably unforced acronym. It is exactly that: A lapped transform codec with a psychoacoustic design philosophy based on band-energy preservation.

Quote
Constrained Energy

The single most important new discovery in Vorbis was that preserving narrowband energy produces far superior results to earlier techniques that attempted to globally minimize quantization noise. This was a relatively late discovery in the Vorbis project, and although it was easy enough to add energy preservation to the Vorbis encoder ('Noise Normalization'), Vorbis did not incorporate energy preservation as an inherent design concept.

CELT's design assumes unity narrowband energy gain throughout. The absolute energy of each band is explicitly coded, and every entropy-backend codeword also encodes unity energy. Critical band spectral energy and the coarse shape of the spectral envelope is thus preserved no matter what.

I suspect that you see the result of this.

Re: Why is opus introducing audio that wasn't there?

Reply #7
Ah, thanks for that.

 

Re: Why is opus introducing audio that wasn't there?

Reply #8
Isn't this the result of Opus CELT band folding?
I guess you can prevent the codec from using that last band by applying a lowpass at or below 16khz.

Re: Why is opus introducing audio that wasn't there?

Reply #9
Isn't this the result of Opus CELT band folding?
I guess you can prevent the codec from using that last band by applying a lowpass at or below 16khz.

It works with a lowpass of 15kHz. It doesn't work with anything above that. I wonder why.

I am doing it like this, is there a better way?

Code: [Select]
sox -G IN.flac -t wav - sinc -15000 | opusenc --bitrate 160 --ignorelength - out.opus

Re: Why is opus introducing audio that wasn't there?

Reply #10
From https://people.xiph.org/~xiphmont/demo/celt/demo.html:

Quote
"CELT" stands for "Constrained Energy Lapped Transform" an accurate and remarkably unforced acronym. It is exactly that: A lapped transform codec with a psychoacoustic design philosophy based on band-energy preservation.

Quote
Constrained Energy

The single most important new discovery in Vorbis was that preserving narrowband energy produces far superior results to earlier techniques that attempted to globally minimize quantization noise. This was a relatively late discovery in the Vorbis project, and although it was easy enough to add energy preservation to the Vorbis encoder ('Noise Normalization'), Vorbis did not incorporate energy preservation as an inherent design concept.

CELT's design assumes unity narrowband energy gain throughout. The absolute energy of each band is explicitly coded, and every entropy-backend codeword also encodes unity energy. Critical band spectral energy and the coarse shape of the spectral envelope is thus preserved no matter what.

I suspect that you see the result of this.

Why is CELT less apparent at higher bitrates? And why does it almost disappear if the source audio doesn't have anything above 15kHz?

Re: Why is opus introducing audio that wasn't there?

Reply #11
As already noted by MetaPixel, when bitrate starved, CELT uses "band folding" to artificially recreate higher frequencies, it does so by extrapolating lower bands to higher bands. If there's nothing above 15kHz, there's nothing to extrapolate.
I'd leave the encoding as it is without resampling which is lossy too. Especially at 160kbps where artificial content is almost non existant. Unless it is more annoying than resampling ...I bet that both things are inaudible though.

Re: Why is opus introducing audio that wasn't there?

Reply #12
So as far as I can tell, what you're seeing here is *not* clipping because clipping would extend all the way to 24 kHz. I'm not 100% sure, but my guess is that it's the effect of an encoder feature designed to save bits in the energy encoding. When encoding the energy of each band, Opus uses the neighbouring bands for prediction and codes the difference. In this case, because 16-20 kHz is completely silent, the encoder would need to code a large (negative) difference, which costs bits. However, it has a model that tells it that it can code a smaller negative number (which costs fewer bits) and that even though the energy will be too high, it's still not going to be audible. That optimization gets reduced as the bitrate increases, which probably explains why the effect is less visible.

All that being said, unless there's a bug in the masking assumptions the encoder is making, all that energy should be inaudible. So in effect, the encoder is free to improve the quality elsewhere by introducing these inaudible artifacts. If you can actually *hear* the extra energy at a reasonable bitrate, I might have a look at it, but from the spectrogram I'm seeing, I kinda doubt it.

Re: Why is opus introducing audio that wasn't there?

Reply #13
All that being said, unless there's a bug in the masking assumptions the encoder is making, all that energy should be inaudible. So in effect, the encoder is free to improve the quality elsewhere by introducing these inaudible artifacts. If you can actually *hear* the extra energy at a reasonable bitrate, I might have a look at it, but from the spectrogram I'm seeing, I kinda doubt it.

No I cannot hear them and I have no problem with it. Just curious what that extra audio is about.

Excuse me if this is a n00b question, but why can't opus store the information elsewhere (~metadata) instead of using inaudible artifacts?

Re: Why is opus introducing audio that wasn't there?

Reply #14
You can highpass filter to try to hear it (and then probably increase volume or transpose down...).

I guess more or less an analogy for what you're asking, would be trying to store JPEG artifacts in metadata instead of an image. They're a kind of new information too - try to save some PNG clipart as low quality JPEG, and then save it as PNG again - you'll see that transcoded PNG is bigger than original. Unfortunately one can't simply shovel artifacts from one domain to another.

Re: Why is opus introducing audio that wasn't there?

Reply #15
Excuse me if this is a n00b question, but why can't opus store the information elsewhere (~metadata) instead of using inaudible artifacts?

The purpose of lossy encoding is to introduce inaudible effects in order to save bits.  Opus is lossy, so it does this. 

There codecs that do what you are suggesting (store correction files as metadata).  Check out wavpack hybrid lossless if that is what you are after. 

Re: Why is opus introducing audio that wasn't there?

Reply #16
Excuse me if this is a n00b question, but why can't opus store the information elsewhere (~metadata) instead of using inaudible artifacts?
This is not about *storing* information. The decoder automatically generates the content of that bands and the encoder would need to spend *more* bits to get rid of it. That's why it only spends the minimum number of bits required to make the band inaudible.

Re: Why is opus introducing audio that wasn't there?

Reply #17
Excuse me if this is a n00b question, but why can't opus store the information elsewhere (~metadata) instead of using inaudible artifacts?
This is not about *storing* information. The decoder automatically generates the content of that bands and the encoder would need to spend *more* bits to get rid of it. That's why it only spends the minimum number of bits required to make the band inaudible.

Ithink, pr0m3th3u5 meant that the encoder would look for the highest frequency occuring in a file and storing that to a metadata and the decoder would then make a low-pass eactly at that frequency - similarly to what REPLAYGAIN does for the volume.

(But as those frequencies are inaudible anyway, I don't know if that makes any sense...)

Re: Why is opus introducing audio that wasn't there?

Reply #18
From https://people.xiph.org/~xiphmont/demo/celt/demo.html:

Quote
"CELT" stands for "Constrained Energy Lapped Transform" an accurate and remarkably unforced acronym. It is exactly that: A lapped transform codec with a psychoacoustic design philosophy based on band-energy preservation.

Quote
Constrained Energy

The single most important new discovery in Vorbis was that preserving narrowband energy produces far superior results to earlier techniques that attempted to globally minimize quantization noise. This was a relatively late discovery in the Vorbis project, and although it was easy enough to add energy preservation to the Vorbis encoder ('Noise Normalization'), Vorbis did not incorporate energy preservation as an inherent design concept.

CELT's design assumes unity narrowband energy gain throughout. The absolute energy of each band is explicitly coded, and every entropy-backend codeword also encodes unity energy. Critical band spectral energy and the coarse shape of the spectral envelope is thus preserved no matter what.

I suspect that you see the result of this.

Why is CELT less apparent at higher bitrates? And why does it almost disappear if the source audio doesn't have anything above 15kHz?
Sounds like band folding is interfering with intensity stereo or something similar. I know it sounds unrelated but I remember doing similar tests because I seem to be sensitive to stereo correlation on higher frequencies (which was the breaking factor for me on Opus lower than 128kbps) and I wondered the same thing.