Supported codecs and media quality

It is key to understand the different codecs used for audio and video communication, so admins can plan & assess the bandwidth needs before going into production.

Audio

There are three supported codecs for audio streams: G711, G722 and Opus. Default codec used is Opus, as it offers a bitrate which goes from 6kbps for narrow-band voice (perceived quality is a bit worse than PCMU) to 510kbps for full-band audio (High Definition Sound). WebRTC supports silence suppression and comfort noise generation by default, so during silence periods only CN packets will be sent and the aggregated BW may be ~50% of the two-way aggregated bandwidth:

  • Opus codec: 30kbps ared used for audio (which means ~55kbps on the wire).

  • G711A/U: 64kbps which means ~85kbps on the wire.

  • G722: Alternative implementation of G711: 64kbps / ~85kbps on the wire.

The codec configuration is made via the audiomixer configuration file located at audiomixer/configmaps/pjsip-audiomixer-sfu1.conf. The codec choice is done via the allow and disallow keywords followed by one or more of the following values (please note that multiple values are also valid when separated by commas, whitespaces are ignored):

Codec

Value

Opus

“opus” (default)

G711 a-law

“alaw”

G711 u-law

“ulaw”

G722

“g722”

It is allowed to configure a codec for the WebRTC connections and a different one for the SIP connection(s). Both codecs can be different and adapted to match the requirements of the deployment. Also, each SFUs could use a different codec but this approach is not recommended. These are the sections that need to be modified in the configuration file, an example follows where OPUS is selected for the WebRTC legs while G711-a is selected for the SIP endpoints:

1 # codec selection for the WebRTC legs
2 [janus-endpoint]
3 allow = opus
4
5 # codec selection for the SIP legs
6 [kamailio-endpoint]
7 allow = alaw

Video

The following video codecs are supported: VP8, VP9 and H264. Default codec configured in the system is VP8. In order to calculate the expected quality from a video flow we’d need to know at least these three parameters:

  • Codec (VP8, H262, VP9, H265, etc.)

  • Bitrate (in Kbps)

  • Resolution (HD, VGA, QCIF, CIF, etc.)

Bitrate or video bandwidth (without overhead) may vary from a minimum of 100kbps to a maximum of 2000kbps which is the maximum bandwith supported by the browser. Video bandwith consumption will depend on the characteristics of the image, but you can consider the figures below as a reference:

  • 1280:720 at 30FPS → 1000 to 2000kbps.

  • 640:360 at 30FPS → 500 to 1000kbps.

  • 320:180 at 30FPS → 100 to 500kbps.

As a easy-to-remember reference, the total amount of traffic sent (one-way) during one minute of a video call is:

  • 1280:720 at 30FPS → between 7,3 and 14,6 Mbytes

  • 640:360 at 30FPS → between 3,6Mbytes and 7,3 Mbytes

  • 320:180 at 30FPS → between 0,75 and 3,6 Mbytes

In these calculations we are not considering the overhead bandwidth, but in this case it is proportionally less relevant. Screen sharing is sent as video so you can consider similar bandwidth consumptions. The graphic below shows a capture of the WebRTC Chrome internals with a 1000kbps bitrate and 7 frames per second:

_images/video_rates.png

The system has a default configuration value of 300Kbps video bitrate. This value applies to each indiviual stream, so take into account that the total used bandwith is not limited by this single parameter alone as there are other participantes in the conference room. The bitrate value can be configured in the parameter bitrate available in the dispatcher configuration file quobis-dispatcher-config.js (value in kpbs):

1config.dispatcher = {
2 // Maximum bandwidth that a video stream will have during a call, in kpbs
3 bitrate: 300,
4};

Note

Please note that video transcoding is not supported, so all the participants in a room must use the same codec, either VP8 or H264.

The list below can be useful when selecting a video resolution:

  • HD-720p 1280x720 at 60fps 4096kbps

  • HD 960x720 at 60fps 4096kbps

  • XGA 1024x768 at 35fps 6144kbps

  • WIDE FULL HD 1920x1080 at 30fps 10240kbps

  • FULL HD 1440x1080 at 30fps 8192kbps

  • HD-720p 1280x720 at 30fps 2048kbps

  • HD-720p 1280x720 at 30fps 1472kbps

  • HD-720p 1280x720 at 30fps 1024kbps

  • HD-720p 1280x720 at 30fps 768kbps

  • HD 960x720 at 30fps 2048kbps

  • 432P 720x432 at 30fps 1024kbps

  • 720x432 at 30fps 768kbps

  • 432P 720x432 at 30fps 512kbps

  • VGA 640x480 at 30fps 1024kbps

  • VGA 640x480 at 15fps 896kbps

  • VGA 640x480 at 30fps 512kbps

  • VGA 640x480 at 30fps 384kbps

  • W288P 512x288 at 30fps 384kbps

  • CIF 352x288 at 30fps 768kbps

  • CIF 352x288 at 30fps 512kbps

  • QCIF 176x144 at 30fps 384kbps

  • QCIF 176x144 at 30fps 192kbps

  • SQCIF 128x96 at 30fps 128kbps

  • SQCIF 128x96 at 30fps 64kbps

  • 4CIF 704x576 at 25fps 1536kbps

  • 4CIF 704x576 at 25fps 512kbps

  • QVGA 320x240 at 20fps 384kbps

  • VGA 640x480 at 15fps 896kbps

  • CIF 352x288 at 15fps 384kbps

  • QCIF 176x144 at 15fps 128kbps

  • QCIF 176x144 at 15fps 64kbps

  • 4CIF 704x576 at 12fps 1024kbps

  • QVGA 320x240 at 10fps 192kbps

Please note that many of these resolutions may not be available in your device. Typically, the WebRTC stack will provide the closer resolution when one non-supported resolution is requested. You can specify a the resolution by setting the right constraints in the SDKs (for example, LocalMediaHandle object in the Javascript SDK). Other constraints can be defined using this mechanism following the standard contraints defined by the W3C: MediaTrackConstraints https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints

Note

For more information about WebRTC codes, plese check the following documents: