xiph / opus

Modern audio compression for the internet.
https://opus-codec.org/
Other
2.17k stars 583 forks source link

Compatibility issues: 1.3.1 encoder (on Ubuntu 20.04) with 1.1.2 decoder (on Ubuntu 18.04) #270

Open tuvalkohl opened 1 year ago

tuvalkohl commented 1 year ago

Hi all,

TL;DR: Encoding with 1.3.1 Opus encoder and decoding with 1.1.2 Opus decoder results in extremely bad / distorted audio.

When we encode the audio with 1.3.1 Opus encoder (on 20.04), and decode it with 1.1.2 Opus decoder (on 18.04) - we get very distorted sound. When we manually cloned the Opus git repo, and built v1.1.2 on the 20.04 machine - the resulting sound quality was good.

  1. Do you know why we are experiencing the distorted / bad quality audio? Are 1.3.1<>1.1.2 incompatible (I didn't find any such note in the Opus documentation)
  2. Can I somehow change the 1.3.1 encoder configurations, so that it's compatible with a 1.1.2 decoder?
  3. Is there a way to install 1.3.1 on 18.04 OR 1.1.2 on 20.04, without manually cloning the git repo and building?
jmvalin commented 1 year ago

All versions of Opus should be compatible with each other. Can you post an Opus file that decodes fine with 1.1.2, but not with 1.3.1?

yuvalr123 commented 1 year ago

Hello jmvalin, I apologize for the late response (and thank you for your prompt answer!). I was a bit under the weather following Tuval's initial query.

It would seem that I have misled him and you regarding the specifics of the issue we encountered. What we are seeing (doubly confirmed now) - is that when encoding in version 1.3.1 and requesting 4kpbs bit rate, we get roughly that, and in 1.1.2 we get 6.8kbps or so. The quality of the audio heard after decoding is the same (subjectively speaking) regardless of which version decodes it. This difference in the actual bit rate explains the difference in the audio quality obviously.

What confuses me is that the API clearly states that the bit rate for the encoder should be in the 6k-512k range, but in both versions it accepts a lower value and does... something (differs between the versions). I'd expect the function to return with an error value, which doesn't seem to be the case.

At any rate, we solved the issue on our side, thanks again.

jmvalin commented 1 year ago

The 6-512 kb/s range you'll often see is what we consider to be the range of bitrate where Opus might do something useful. If you ask for a lower bitrate, the Opus encoder will still try to do its best. And its best depends on the encoder version -- even though the decoder does not change between version. The 1.3 encoder is overall much better than the 1.0 encoder, but if you rely on the exact behaviour of an encoder version (especially when that behaviour is not specified in the doc), then that upgrading to a new version may cause some changes.