[opus] runtime reconfiguration of opusenc

Ralph Giles giles at thaumas.net
Thu Oct 16 12:40:25 PDT 2014


On 2014-10-06 12:17 AM, Michael Mehari wrote:

> However, i have one problem when using the opusenc application. The
> input parameters are start time configurable but i was looking for
> realtime reconfiguration for example changing bitrate on the fly.

Hi Michael. You're correct that opusenc doesn't expose anything for
dynamic control of the encoding parameters. It's designed for encoding
static files or for http streaming.

The reference encoder in the libopus library does have this dynamic
switching ability. The framesize is controlled by how much audio data is
submitted to each call of opus_encode(). See


https://mf4.xiph.org/jenkins/view/opus/job/opus/ws/doc/html/group__opus__encoder.html#details

for an overview of the calling conventions.

Overall bitrate, redudancy, expected packet loss, and many other
parameters can be controlled dynamically through the opus_encoder_ctl()
interface. Just make calls to this in between submitting data for each
packet. A complete list of options is available in the API docs at


https://mf4.xiph.org/jenkins/view/opus/job/opus/ws/doc/html/group__opus__encoderctls.html
or
  http://opus-codec.org/docs/html_api-1.1.0/group__opus__encoderctls.html

You could modify opusenc.c to call these in response to commands read
from a socket, for example.

However, while opusenc is fine for internet radio applications,
conferencing usually uses the RTP protocol for its prioritization of
realtime interaction over complete delivery. I'm not aware of a
stand-alone tool for that with opus. You'd need to implement something
yourself here as well.

There's an experimental 'opusrtp' program in the opus-tools source
package you can look at, but it's only useful over an uncongested network.

For a sophisticated implementation of Opus in RTP see the webrtc.org
codebase. You can find the wrappers their engine calls to adjust encoder
parameters here:


https://code.google.com/p/webrtc/source/browse/trunk/webrtc/modules/audio_coding/codecs/opus/opus_interface.c

You can also look at open source voip clients like mumble:


https://github.com/mumble-voip/mumble/blob/master/src/mumble/AudioInput.cpp#L675

Hope that helps, and thanks for your interest in Opus.

 -r


More information about the opus mailing list