Closed guest271314 closed 2 years ago
What is the reasoning for opusenc encoding original input sample rate, and specifically, opusdec decoding to original input sample rate?
It's generally necessary to do so if the length is to be preserved exactly, since in a wav file the only thing determining the length is the number of samples, and there was an integer number at the original rate and for it to be the same duration the decode rate has to be an integer multiple of the original for that to be possible. Also, if the original rate were (say) 8000, then it would be kind of misleading to output a 48kHz wav file.
How does opusdec know what the original sample rate is,
It's communicated in the OggOpus header. You can tell opusdec to force decoding to 48000 if you want.
Any good resampler will be perceptually lossless, certainly more so than the opus encoding itself.
@gmaxwell I filed this issue because Chromium authors of WebCodecs 'opus' AudioEncoder
and AudioDecoder
evidently do not gather the significance of decoding to original sample rate, therefore I wanted an objective party with knowledge of the subject matter to provide reasoning for why opusdec
does resample to original sample rate. If you find the time perhaps you could chime in to be redundant in this Chromium bug https://bugs.chromium.org/p/chromium/issues/detail?id=1254496, as I gather I am still not explaining what the only fix is.
What is the reasoning for
opusenc
encoding original input sample rate, and specifically,opusdec
decoding to original input sample rate?How does
opusdec
know what the original sample rate is, and how doesopusdec
resample from 48000 kHz Opus to input sample rate?