Kevin O'Connor
2018-Oct-18 14:42 UTC
[opus] Is OPUS_AUTO the default for an encoder's bitrate?
I had expected that the default bitrate for the encoder would be the same as setting it to OPUS_AUTO, but I'm getting difference results:>opusenc --comp 4 sample.wav sample.opusEncoding using libopus 1.3-rc2 (audio) ----------------------------------------------------- Input: 8 kHz, 1 channel Output: 1 channel (1 uncoupled) 20ms packets, 25 kbit/s VBR Preskip: 312 Encoding complete ----------------------------------------------------- Encoded: 2 minutes and 34.94 seconds Runtime: 1 second (154.9x realtime) Wrote: 588189 bytes, 7747 packets, 157 pages Bitrate: 29.7104 kbit/s (without overhead) Instant rates: 1.2 to 50.4 kbit/s (3 to 126 bytes per packet) Overhead: 2.17% (container+metadata) If I explicitly set the bitrate to OPUS_AUTO, it produces a stream with twice the bitrate of the encoder's default from above.>opusenc --comp 4 --set-ctl-int 4002=-1000 sample.wav sample.opusEncoding using libopus 1.3-rc2 (audio) ----------------------------------------------------- Input: 8 kHz, 1 channel Output: 1 channel (1 uncoupled) 20ms packets, 25 kbit/s VBR Preskip: 312 Encoding complete ----------------------------------------------------- Encoded: 2 minutes and 34.94 seconds Runtime: 1 second (154.9x realtime) Wrote: 1245829 bytes, 7747 packets, 157 pages Bitrate: 63.6644 kbit/s (without overhead) Instant rates: 1.2 to 120.4 kbit/s (3 to 301 bytes per packet) Overhead: 1.03% (container+metadata) As this is example 8kHz single channel audio, the encoder's default bitrate seems more appropriate than the OPUS_AUTO bitrate. This presents a bit of a problem because there are three possibilities for the bit rate, an explicitly set value, a value set by OPUS_AUTO, and some mystery value from the default encoder initialization. If the bitrate setting is changed, I don't see any way to get back to the mystery value without re-initializing the encoder. Can anyone comment on why it works this way? Kevin O'Connor
Jean-Marc Valin
2018-Oct-18 14:56 UTC
[opus] Is OPUS_AUTO the default for an encoder's bitrate?
On 10/18/2018 10:42 AM, Kevin O'Connor wrote:> I had expected that the default bitrate for the encoder would be the > same as setting it to OPUS_AUTO, but I'm getting difference results:libopus defaults to OPUS_AUTO for the bitrate, but opusenc is free to have its own default bitrate. In this case, it appears that opusenc is making a better decision than libopus (which IIRC doesn't take into account the fact that your file is narrowband). Cheers, Jean-Marc>> opusenc --comp 4 sample.wav sample.opus > Encoding using libopus 1.3-rc2 (audio) > ----------------------------------------------------- Input: 8 kHz, 1 > channel Output: 1 channel (1 uncoupled) 20ms packets, 25 kbit/s VBR > Preskip: 312 > > Encoding complete > ----------------------------------------------------- Encoded: 2 > minutes and 34.94 seconds Runtime: 1 second (154.9x realtime) Wrote: > 588189 bytes, 7747 packets, 157 pages Bitrate: 29.7104 kbit/s > (without overhead) Instant rates: 1.2 to 50.4 kbit/s (3 to 126 bytes > per packet) Overhead: 2.17% (container+metadata) > > If I explicitly set the bitrate to OPUS_AUTO, it produces a stream > with twice the bitrate of the encoder's default from above. > >> opusenc --comp 4 --set-ctl-int 4002=-1000 sample.wav sample.opus > Encoding using libopus 1.3-rc2 (audio) > ----------------------------------------------------- Input: 8 kHz, 1 > channel Output: 1 channel (1 uncoupled) 20ms packets, 25 kbit/s VBR > Preskip: 312 > > Encoding complete > ----------------------------------------------------- Encoded: 2 > minutes and 34.94 seconds Runtime: 1 second (154.9x realtime) Wrote: > 1245829 bytes, 7747 packets, 157 pages Bitrate: 63.6644 kbit/s > (without overhead) Instant rates: 1.2 to 120.4 kbit/s (3 to 301 > bytes per packet) Overhead: 1.03% (container+metadata) > > As this is example 8kHz single channel audio, the encoder's default > bitrate seems more appropriate than the OPUS_AUTO bitrate. This > presents a bit of a problem because there are three possibilities for > the bit rate, an explicitly set value, a value set by OPUS_AUTO, and > some mystery value from the default encoder initialization. If the > bitrate setting is changed, I don't see any way to get back to the > mystery value without re-initializing the encoder. Can anyone > comment on why it works this way? > > Kevin O'Connor > > _______________________________________________ opus mailing list > opus at xiph.org http://lists.xiph.org/mailman/listinfo/opus >