I admit that I am more than a newbie in terms of audio compression and everything that surrounds that world, but I was doing some research on how audio codecs work and how they actually cut off frequencies in order to achieve small file sizes while still keeping more or less intact what our ears can feel. I found out, for example, that all aac audio streams on YouTube are cut off at 15/16 KHz.

Audio spectrum of a song on YouTube encoded with aac

Also trying to transcode some wave files by my self, I obtained similar results with the native aac encoder built in ffmpeg. Every video on YouTube has both aac and opus audio streams available, so I inspected opus streams also. And this is the opus audio spectrum of the same song:

Audio spectrum of a song on YouTube encoded with opus

Frequencies here spans up to 20 Khz, but the file size and the bitrate are the same as the aac counterpart. Is this the result of the opus very efficient hybrid (SILK + CELT) encoder? What else can be "removed" from the audio spectrum in order to achieve such results? Later on, I decided to re-encode the aac 128 kbps file into an opus stream with ffmpeg.

ffmpeg -i aac_file.m4a -c:a libopus -b:a 96k opus_file.ogg

And this is the output spectrum:

aac file re-encoded with opus

Why is opus "adding" frequencies that wasn't there before? You can clearly see the old 16 KHz bound that gets "expanded" on top up to the opus 20 Khz bound. I'm not really getting why adding information that doesn't exists needs to occur in this place. I'm probably missing something of how opus works and I would like to know something more specific about it.

  • 1
    I can't provide a full technical explanation for this, but suffice to say "You don't want to do that. You will not get what you think you will get." Similar uninformed techniques are why the interwebz is full of dodgy FLAC rips claiming to be 'highest quality'. See also sound.stackexchange.com/q/50839/9601 for further cynicism ;)
    – Tetsujin
    Aug 2 '21 at 16:15
  • robbitara - both the mathematical functions used to encode audio, and the decisions around cutoff frequency will create additional frequencies and data. As @tetsujin commented, the explanation is lengthy and complex.
    – Rory Alsop
    Aug 4 '21 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.