Voice Codecs and Bandwidth Calculations

Traffic

I’ve been recently reviewing for CCIE Collaboration recertification and codec and bandwidth calculations while straight forward it can be easy to make simple mistakes. So thought I would run through and summarise some of the key information and how the different values link in. First I’m going to summarise some of the key information about some of the voice codecs and then show how the bandwidth for calls can be calculated along with a couple of examples. I highly recommend reading through the references at the end for further information (you could either read the references first then view this as a summary, or read this as an overview before reading through the references for more detailed information – your call).

 

Voice Codecs:

  • G.711: The most commonly supported codec, used over the PSTN, a narrowband codec providing toll quality voice.
  • G.723.1: Low-bit-rate codec with 6.3 or 5.3 kb/s compression for Cisco IP Phone 12 SP+ and Cisco IP Phone 30 VIP devices.
  • G.726: Offered at half the bit rate of G.711.
  • G.728: Low-bit-rate codec that video endpoints support.
  • G.729: Low-bit-rate codec with 8-kb/s compression that is supported by Cisco Unified IP Phone 7900. Typically, you would use low-bit-rate codecs for calls across a WAN link because they use less bandwidth. For example, the factory default intraregion maximum audio bit rate is 64 kbps, while the factory default interregion maximum audio bit rate is 8 kbps.
  • iLBC (Internet low bit rate codec): Is an open source narrowband speech codec suitable for VOIP and streaming audio with a choice of payload length of 20ms or 30ms. It handles packet loss with graceful quality degradation because each speech frame is independent unlike ordinary low bit-rate codecs (such as G.729 which has dependencies between frames).
  • iSAC (Internet speech audio codec): Is an adaptive wideband speech codec designed for low and medium bit rate applications. Using an adaptive bit rate of between 10 and 32 kb/s, iSAC provides audio quality approaching that of G.722 while using less than half the bandwidth. In deployments with significant packet loss, delay, or jitter, such as over a WAN, iSAC audio quality is superior to that of G.722 due to its robustness. iSAC is supported for SIP and SCCP devices. The Cisco Unified Communications Manager IP Voice Media Streaming App (IPVMSApp), which includes Media Termination Point, Conference Bridge, Music on Hold Server, and Annunciator does not support iSAC. MGCP devices are not supported.
  • LATM: AAC-LD (MP4A-LATM)-Advanced Audio Coding-Low Delay (AAC-LD) Low-overhead MPEG-4 Audio Transport Multiplex (LATM) is a super-wideband audio codec that provides superior sound quality for voice and music. This codec provides equal or improved sound quality over older codecs, even at lower bit rates. AAC-LD (MP4A-LATM) is supported for SIP devices including Tandberg and some third-party endpoints.
  • G.722: Is a wideband codec that is always preferred by Cisco Unified Communications Manager over G.711, unless G.722 is disabled. Audio codec often used in video conferences. It can operate at 48Kbps, 56Kbps or 64Kpbs.
  • G.722.1:  Is a low-complexity wideband codec operating at 24Kbps or 32Kbps. The audio quality approaches that of G.722 while using at most half the bit rate. As it is optimized for both speech and music, G.722.1 has slightly lower speech quality than the speech-optimized iSAC codec. G.722.1 is supported for SIP and H.323 devices.
  • Wideband codecs: Also known as “HD audio”, for example can be delivered using G.722. Samples at a higher frequency range for better quality as compared with narrowband codecs such as G.711. Refer to references for further information.

Packets per second (PPS)

Given a payload time (how many ms of audio is represented by the payload), how many packets are sent to make up 1 second of audio.

Payload time (ms) Packets per second (PPS)
20ms 50
30ms 33.3
40ms 25

Packets per second can be calculated based on the payload time (1000ms / payload time), for example G.711 with payload time of 20ms: 1000ms / 20ms = 50 PPS.

Codec bit rate and payload

Codec (bit rate) Payload size (Bytes) Payload time (ms)
G.711 (64Kbps) 160B 20ms
G.722 (64Kbps) 160B 20ms
G.723.1 (6.3Kbps) 24B 30ms
G.723.1 (5.3Kbps) 20B 30ms
G.726 (32Kbps) 80B 20ms
G.726 (24Kbps) 60B 20ms
G.728 (16Kbps) 60B 30ms
G.729 (8Kbps) 20B 20ms
iLBC at 20ms sample (15.2Kbps) 38B 20ms
iLBC at 30ms sample (13.33Kbps) 50B 30ms

Codec bit rate can be calculated based on payload size and packets per second (payload size in Bytes * 8 bits * packets per second = codec bit rate in bps [divide by 1000 for Kbps]), for example G.711 with payload size 160B and 50 PPS: 160 * 8 * 50 = 64000bps = 64Kbps.

Bandwidth Calculations:

Given a number of calls using a particular codec over a certain transport, the formula for calculating the bandwidth is as follows:

Bandwidth (in bits per second) = (Packet size in Bytes) * 8 bits * packets per second * number of calls

If you think about the above formula it is very intuitive. Multiple the packet size by the number of times we’re going to see that packet in one second. Multiplying by 8 bits is just to convert the Bytes in the packet size to bits used in the result. Finally the bandwidth for one call is multiplied by the total number of calls to get the total bandwidth. The important parts of the formula are the packet size and packets per second.

Packet Size

The size of a voice packet can be thought of as a combination of the following critical elements:

Layer 2 header Layer 3 header   Voice Payload
(18 bytes for Ethernet)
(7 bytes for multilink point to point or frame relay*)
(40 bytes for IP/UDP/RTP headers)
(2 or 4 bytes when cRTP is used)
(variable depending on codec)

* Technically the header is 6 bytes with 1 byte for the end of frame flag in multilink point to point and frame relay, I kept it at 7 bytes in the context of keeping it simple for bandwidth calculations, refer to the references at the end for futher details.

You should be given enough information to work out what to use for the calculations. You may be told the voice payload size, or some indirect information which can be used to work it out. For example, you may be told to calculate the bandwidth for G.711 with a payload time of 40ms which would be 320B (twice the 160B at 20ms payload time).

Packets per second (PPS)

Make sure you determine the correct packets per second (PPS). In the same way that the payload size can vary if given a different payload time, the PPS can also vary. Using the previous example, given G.711 with a payload time of 40ms (and payload size of 320B) the packets per second would be 25. You can work this out in one of two ways: (1) PPS = (1000 / payload size in ms), in this case = (1000 / 40) = 25 PPS or (2) if you know that 20ms is 50 PPS, then doubling the payload size (to 40ms) will half the PPS (from 50 to 25 PPS). Alternatively, just remember the PPS values for the common sample times: 50 PPS (20ms), 33.3 PPS (30ms), 25 PPS (20ms).

Examples

(1) Calculate the bandwidth required for 9 G.711 calls over Ethernet with a voice payload size of 20ms.

Because the payload time is 20ms, the size of the payload will be 160B. For layer 3, there is no mention of cRTP being used so we can assume 40 bytes for IP/UDP/RTP headers. For layer 2 we need to account for 18 bytes for the Ethernet frame header.

Packet size = Layer 3 + Layer 2 + Payload = 18 + 40 + 160 = 218 bytes

Since the payload time is 20ms we know the packets per second (PPS) is 50, and number of calls is given as 9.

Bandwidth (bps) = (packet size in bytes) * 8 bits * PPS * number of calls
= 218 * 8 * 50 * 9
= 784800 bps
= 784.8Kbps

(2) Calculate the bandwidth required for 3 G.729 calls with voice payload size of 40 bytes; allow for 6 bytes for layer 2 FRF.12 header, 1 byte for end of frame flag and 2 bytes for cRTP.

Here we are given all the details for the packet size including the voice payload, so we calculate as follows:

Packet size = Layer 2 + Layer 3 + Payload = 7 + 2 + 40 = 49 bytes

Since the payload size is given as 40 bytes, we know this is twice the normal G.729 size (20 bytes and 20ms) so the payload time will be 40ms and hence the packets per second will be 25 (1000 divided by payload time). The number of calls is given.

Bandwidth (bps) = (packet size in bytes) * 8 bits * PPS * number of calls
= 49 * 8 * 25 * 3
= 29400bps
= 29.4Kbps

Here are a few more for you to try yourself:

(3) Calculate the bandwidth required for seven G.711 calls with voice payload size of 160 bytes; allow for 6 bytes for layer 2 FRF.12 header, 1 byte for end of frame flag.

(4) Calculate the bandwidth required for four G.729 calls over Ethernet where the packets per second is 25.

(5) Calculate the bandwidth required for six G.728 calls with a payload of 60ms. The link being used is frame relay FRF.12 so account for a 6 byte layer 2 header and 1 byte end of frame flag. The layer 3 header will be 2 bytes because cRTP is being used.

Answers: (3) 579.6Kbps (4) 78.4Kbps (5) 220.6Kbps

 

Tips:

  • Remember that 8 bits is 1 Byte and 1000 bps (bits per second) is 1 Kbps (kilobit per second). Yes, obvious enough but important to remember when working through calculations.
  • Practice calculations on paper only with no calculator, you are not allowed to use a calculator in the CCIE Collaboration written exam so don’t practice with one. If you are not used to not using a calculator, it is very easy to make simple mistakes while doing long multiplication. Remember when doing long multiplication with decimal places do the multiplication ignoring the decimal places then divide by the total number of decimal places at the end. For example for (123.45 * 67.8) first do long multiplication on (12345 * 678) then divide by 1000, the total number of decimal places in both numbers (two in 123.45 plus the one in 67.8).
  • Learning the payload values for the different codecs in the table will be helpful and maybe required. Get familiar with the formulas which means you can calculate missing pieces of information in a pinch. For example, if you know the payload time you can work out the packets per second, if you know the payload size and packets per second you can work out the bit-rate. Understanding the relationships will be helpful.

 

References:

Voice Over IP – Per Call Bandwidth Consumption: This is the main reference used for the information on bandwidth calculations in this post
Voice Over IP – Per Call Bandwidth Consumption

Other references:
Wikipedia – Internet Low Bitrate Codec (iLBC)
Cisco IOS Software Releases 12.4 T – iLBC Codec Support
Cisco IOS Software Releases 12.4 T – iLBC Support for SIP and H.323
Cisco IOS Software Releases 12.4 Special and Early Deployments – G.722-64 and iLBC Codec Support on Cisco Unified Border Elements, DSP Farms, and Voice Gateways
CUCM System Guide, Release 9.0(1) – System Configuration – System-level configurations settings – Locations and regions
Cisco Unified IP Phone 7900 Series – Wideband Audio and IP Telephony

 

I hope you find this useful in your studies, let me know if you did. If any errors are spotted also let me know so I can fix them up, thanks for reading.

Image: Silicon Valley Highway 101 Traffic Hell by user bike on flickr used under Creative Commons license.