Opusenc produces broken samples (wrong quantization) with 24-bit source
Original Issue
I was encoding a specific sample of music (24 bits, 48 kHz) with opusenc
in opus-tools 0.2 (Opus 1.3)
and noticed a significant artifact in the beginning.
More description: You can hear the artifact within 00:01. It's a broken "boom"-like sound.
Check the image below. The waveform graph has significant changes.
This is how I encoded:
>opusenc sample.flac --bitrate 256 sample.opus
Encoding using libopus 1.3 (audio)
-----------------------------------------------------
Input: 48 kHz, 2 channels
Output: 2 channels (2 coupled)
20ms packets, 256 kbit/s VBR
Preskip: 312
Encoding complete
-----------------------------------------------------
Encoded: 1 minute and 31.1 seconds
Runtime: 1 second
(91.1x realtime)
Wrote: 2993392 bytes, 4555 packets, 94 pages
Bitrate: 261.351 kbit/s (without overhead)
Instant rates: 1.2 to 510.4 kbit/s
(3 to 1276 bytes per packet)
Overhead: 0.576% (container+metadata)
Update
I tried using FFmpeg
to convert the original file into 16 bits (original is 24 bits).
>ffmpeg -i sample.wav -f wav -c pcm_s16le sample_16bit.wav
Then I encoded again with the same settings.
>opusenc sample_16bit.wav --bitrate 256 sample_16bit.opus
Skipping chunk of type "LIST", length 26
Encoding using libopus 1.3 (audio)
-----------------------------------------------------
Input: 48 kHz, 2 channels
Output: 2 channels (2 coupled)
20ms packets, 256 kbit/s VBR
Preskip: 312
Encoding complete
-----------------------------------------------------
Encoded: 1 minute and 31.1 seconds
Runtime: 1 second
(91.1x realtime)
Wrote: 2990541 bytes, 4555 packets, 94 pages
Bitrate: 261.103 kbit/s (without overhead)
Instant rates: 1.2 to 510.4 kbit/s
(3 to 1276 bytes per packet)
Overhead: 0.576% (container+metadata)
The result turned out to be good.
Check the image below. The waveform graph has no significant changes now.
So there may be issue in quantization of 24-bit (or high bit depth?) samples.
Sample Download
The updated sample files are here.
All source samples are converted to FLAC files for better compression.
The 16-bit sample is converted from the 24-bit one; the 24-bit one is the original, not padded.