Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#1904 closed enhancement (fixed)

Support for Opus codec — at Version 2

Reported by: ming Owned by: nanang
Priority: normal Milestone: release-2.5
Component: pjmedia Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description (last modified by ming)

Opus is a totally open, royalty-free, highly versatile audio codec. Opus is unmatched for interactive speech and music transmission over the Internet, but is also intended for storage and streaming applications. It is standardized by the Internet Engineering Task Force (IETF) as RFC 6716 which incorporated technology from Skype's SILK codec and Xiph.Org's CELT codec. (From http://www.opus-codec.org)

How to use:

  1. Download Opus source code from here (latest stable release 1.1.2 or above is recommended). For iOS, you can get the build script here or here. For Android, you can get the Android makefile here.
  2. Run PJSIP's configure script with the option --with-opus=your_opus_installation_dir

Opus Codec Settings

General codec settings for this codec such as VAD and PLC can be
manipulated through the setting field in #pjmedia_codec_param
(see the documentation of #pjmedia_codec_param for more info).

For Opus codec specific settings, such as sample rate,
channel count, bit rate, complexity, and CBR, can be configured
in #pjmedia_codec_opus_config.
The default setting of sample rate is specified in
#PJMEDIA_CODEC_OPUS_DEFAULT_SAMPLE_RATE. The default setting of
bitrate is specified in #PJMEDIA_CODEC_OPUS_DEFAULT_BIT_RATE.
And the default setting of complexity is specified in
#PJMEDIA_CODEC_OPUS_DEFAULT_COMPLEXITY.

After modifying any of these settings, application needs to call
#pjmedia_codec_opus_set_default_param(), which will generate the
appropriate decoding fmtp attributes.

Here is an example of modifying the codec settings:

   pjmedia_codec_param param;
   pjmedia_codec_opus_config opus_cfg;

   pjmedia_codec_mgr_get_default_param(.., &param);
   pjmedia_codec_opus_get_config(&opus_cfg);
   ...
   // Set VAD
   param.setting.vad = 1;
   // Set PLC
   param.setting.vad = 1;
   // Set sample rate
   opus_cfg.sample_rate = 16000;
   // Set channel count
   opus_cfg.channel_cnt = 2;
   // Set bit rate
   opus_cfg.bit_rate = 20000;
   ...
   pjmedia_codec_opus_set_default_param(&opus_cfg, &param);

Change History (2)

comment:1 Changed 8 years ago by ming

  • Resolution set to fixed
  • Status changed from new to closed

In 5239:

Fixed #1904: Support for Opus codec

comment:2 Changed 8 years ago by ming

  • Description modified (diff)
Note: See TracTickets for help on using tickets.