[opus] live streaming

Ralph Giles giles at thaumas.net
Wed Aug 7 14:31:15 PDT 2013

On 13-08-07 2:09 PM, Greg Bernard wrote:
> I just had two quick questions about opus. When using the encoder, how
> do I use a live microphone as the source, and how do I stream the output
> to a server? (Would it work with rtp, http, etc.?) Thanks! :)

That depends on the platform. There are platform-specific APIs you can
use to capture audio and feed it to the encoder, or to build a pipeline
to do the same.

For example on linux:

arecord -c 2 -r 48000 -twav - | opusenc - - | \
   oggfwd icecast.example.com 8000 password /stream.opus

Would record from the default input and stream it over http to an
icecast server, which would replicate it to any clients who connected.

Or of course you can write your own code to do something similar. See
the opusenc source and the Ogg encapsulation draft for details of how to
do http streaming.


You can also send opus over rtp. There's less ready code for that, but
the webrtc.org project supports it, and there's a similar patch for
Asterisk. I wrote a quick debugging tool for RTP encapsulation, but it's
not ready for general applications. It's in the opus-tools git
repository, alongside opusenc.


Hope that helps, and let me know if you have more specific questions!


More information about the opus mailing list