How to calculate the 
real bandwidth 
for an audio codec
Craig Southeren
Last updated 17 May 2004

Contents

Introduction
Calculating the actual bit rate
Comparing codecs
Change history

Introduction

Users and developers often compare audio codecs on the basis of the codec raw bit-rate. This is does not yield results that are useful in the real world, as the amount of data in the encapsulating UDP[2] and RTP[1] headers can often be larger than the audio data payload.

Calculating the actual bit rate

As an example, consider a stream of G.723.1 packets each containing a 24 byte encoded audio frame. The frame rate for this codec is 30ms, yielding an audio bandwidth of:

( 24 * 8 ) / ( 30 * 0.001) = 6400 bits per second

However, each of these frames is accompanied by an IP header of 20 bytes, a UDP header of 8 bytes, and RTP header of 12 bytes (assuming no CSRC field) for a minimum overhead per frame of 40 bytes. This gives an actual bandwidth of:

( (40 + 24) * 8 ) / ( 30 * 0.001) = 17066 bits per second

which is nearly three times the "headline" bandwidth of the underlying audio codec. This simple calculation ignored additional bits of overhead added by the transport layer, such as Ethernet headers etc, which will make the overheard "on the wire" even higher.

This disparity can be reduced, at the cost of latency, by putting more than one frame of audio into a single UDP packet. If we put three G.723.1 audio frames into a single packet sent every 90ms, the real bit rate is as follows:

 

( (40 + (3 * 24) ) * 8 ) / ( 3 * (30 * 0.001) ) = 9956 bits per second

This is only 1.5 times the "headline" bandwidth, as the 40 bytes RTP/UDP overhead is now smaller than the payload size of 72 bytes.

Comparing codecs

The following tables gives the actual bandwidth for many of the popular audio codecs in use. This data was calculated using an Excel spreadsheet that can be downloaded

Packet overhead 40                
Codec bytes/frame frame (ms) frames/packet packets/sec payload (bytes) bits/sec bytes/packet bits/sec % optimal latency
G723.1 20 30 1 33.33 20 5333 60 16000 300% 30.00
G723.1 20 30 2 16.67 40 5333 80 10667 200% 60.00
G723.1 20 30 3 11.11 60 5333 100 8889 167% 90.00
G723.1 20 30 4 8.33 80 5333 120 8000 150% 120.00
G723.1 20 30 5 6.67 100 5333 140 7467 140% 150.00
G723.1 20 30 6 5.56 120 5333 160 7111 133% 180.00
G723.1 20 30 7 4.76 140 5333 180 6857 129% 210.00
G723.1 20 30 8 4.17 160 5333 200 6667 125% 240.00
G723.1 20 30 9 3.70 180 5333 220 6519 122% 270.00
G723.1 20 30 10 3.33 200 5333 240 6400 120% 300.00
G723.1 20 30 11 3.03 220 5333 260 6303 118% 330.00
G723.1 20 30 12 2.78 240 5333 280 6222 117% 360.00
Codec bytes/frame frame (ms) frames/packet packets/sec payload (bytes) bits/sec bytes/packet bits/sec % optimal latency
G723.1 24 30 1 33.33 24 6400 64 17067 267% 30.00
G723.1 24 30 2 16.67 48 6400 88 11733 183% 60.00
G723.1 24 30 3 11.11 72 6400 112 9956 156% 90.00
G723.1 24 30 4 8.33 96 6400 136 9067 142% 120.00
G723.1 24 30 5 6.67 120 6400 160 8533 133% 150.00
G723.1 24 30 6 5.56 144 6400 184 8178 128% 180.00
G723.1 24 30 7 4.76 168 6400 208 7924 124% 210.00
G723.1 24 30 8 4.17 192 6400 232 7733 121% 240.00
G723.1 24 30 9 3.70 216 6400 256 7585 119% 270.00
G723.1 24 30 10 3.33 240 6400 280 7467 117% 300.00
G723.1 24 30 11 3.03 264 6400 304 7370 115% 330.00
G723.1 24 30 12 2.78 288 6400 328 7289 114% 360.00
Codec bytes/frame frame (ms) frames/packet packets/sec payload (bytes) bits/sec bytes/packet bits/sec % optimal latency
GSM 33 20 1 50.00 33 13200 73 29200 221% 20.00
GSM 33 20 2 25.00 66 13200 106 21200 161% 40.00
GSM 33 20 3 16.67 99 13200 139 18533 140% 60.00
GSM 33 20 4 12.50 132 13200 172 17200 130% 80.00
GSM 33 20 5 10.00 165 13200 205 16400 124% 100.00
GSM 33 20 6 8.33 198 13200 238 15867 120% 120.00
GSM 33 20 7 7.14 231 13200 271 15486 117% 140.00
GSM 33 20 8 6.25 264 13200 304 15200 115% 160.00
GSM 33 20 9 5.56 297 13200 337 14978 113% 180.00
GSM 33 20 10 5.00 330 13200 370 14800 112% 200.00
GSM 33 20 11 4.55 363 13200 403 14655 111% 220.00
GSM 33 20 12 4.17 396 13200 436 14533 110% 240.00
Codec bytes/frame frame (ms) frames/packet packets/sec payload (bytes) bits/sec bytes/packet bits/sec % optimal latency
G.711 240 30 1 33.33 240 64000 280 74667 117% 30.00
G.711 240 30 2 16.67 480 64000 520 69333 108% 60.00
G.711 240 30 3 11.11 720 64000 760 67556 106% 90.00
G.711 240 30 4 8.33 960 64000 1000 66667 104% 120.00
G.711 240 30 5 6.67 1200 64000 1240 66133 103% 150.00
G.711 240 30 6 5.56 1440 64000 1480 65778 103% 180.00
G.711 240 30 7 4.76 1680 64000 1720 65524 102% 210.00
G.711 240 30 8 4.17 1920 64000 1960 65333 102% 240.00
G.711 240 30 9 3.70 2160 64000 2200 65185 102% 270.00
G.711 240 30 10 3.33 2400 64000 2440 65067 102% 300.00
G.711 240 30 11 3.03 2640 64000 2680 64970 102% 330.00
G.711 240 30 12 2.78 2880 64000 2920 64889 101% 360.00
Codec bytes/frame frame (ms) frames/packet packets/sec payload (bytes) bits/sec bytes/packet bits/sec % optimal latency
LPC10 7 22.5 1 44.44 7 2489 47 16711 671% 22.50
LPC10 7 22.5 2 22.22 14 2489 54 9600 386% 45.00
LPC10 7 22.5 3 14.81 21 2489 61 7230 290% 67.50
LPC10 7 22.5 4 11.11 28 2489 68 6044 243% 90.00
LPC10 7 22.5 5 8.89 35 2489 75 5333 214% 112.50
LPC10 7 22.5 6 7.41 42 2489 82 4859 195% 135.00
LPC10 7 22.5 7 6.35 49 2489 89 4521 182% 157.50
LPC10 7 22.5 8 5.56 56 2489 96 4267 171% 180.00
LPC10 7 22.5 9 4.94 63 2489 103 4069 163% 202.50
LPC10 7 22.5 10 4.44 70 2489 110 3911 157% 225.00
LPC10 7 22.5 11 4.04 77 2489 117 3782 152% 247.50
LPC10 7 22.5 12 3.70 84 2489 124 3674 148% 270.00
Codec bytes/frame frame (ms) frames/packet packets/sec payload (bytes) bits/sec bytes/packet bits/sec % optimal latency
Speex-5.95 15 20 1 50.00 15 6000 55 22000 367% 20.00
Speex-5.95 15 20 2 25.00 30 6000 70 14000 233% 40.00
Speex-5.95 15 20 3 16.67 45 6000 85 11333 189% 60.00
Speex-5.95 15 20 4 12.50 60 6000 100 10000 167% 80.00
Speex-5.95 15 20 5 10.00 75 6000 115 9200 153% 100.00
Speex-5.95 15 20 6 8.33 90 6000 130 8667 144% 120.00
Speex-5.95 15 20 7 7.14 105 6000 145 8286 138% 140.00
Speex-5.95 15 20 8 6.25 120 6000 160 8000 133% 160.00
Speex-5.95 15 20 9 5.56 135 6000 175 7778 130% 180.00
Speex-5.95 15 20 10 5.00 150 6000 190 7600 127% 200.00
Speex-5.95 15 20 11 4.55 165 6000 205 7455 124% 220.00
Speex-5.95 15 20 12 4.17 180 6000 220 7333 122% 240.00
Codec bytes/frame frame (ms) frames/packet packets/sec payload (bytes) bits/sec bytes/packet bits/sec % optimal latency
Speex-8k 20 20 1 50.00 20 8000 60 24000 300% 20.00
Speex-8k 20 20 2 25.00 40 8000 80 16000 200% 40.00
Speex-8k 20 20 3 16.67 60 8000 100 13333 167% 60.00
Speex-8k 20 20 4 12.50 80 8000 120 12000 150% 80.00
Speex-8k 20 20 5 10.00 100 8000 140 11200 140% 100.00
Speex-8k 20 20 6 8.33 120 8000 160 10667 133% 120.00
Speex-8k 20 20 7 7.14 140 8000 180 10286 129% 140.00
Speex-8k 20 20 8 6.25 160 8000 200 10000 125% 160.00
Speex-8k 20 20 9 5.56 180 8000 220 9778 122% 180.00
Speex-8k 20 20 10 5.00 200 8000 240 9600 120% 200.00
Speex-8k 20 20 11 4.55 220 8000 260 9455 118% 220.00
Speex-8k 20 20 12 4.17 240 8000 280 9333 117% 240.00
Codec bytes/frame frame (ms) frames/packet packets/sec payload (bytes) bits/sec bytes/packet bits/sec % optimal latency
Speex-11k 28 20 1 50.00 28 11200 68 27200 243% 20.00
Speex-11k 28 20 2 25.00 56 11200 96 19200 171% 40.00
Speex-11k 28 20 3 16.67 84 11200 124 16533 148% 60.00
Speex-11k 28 20 4 12.50 112 11200 152 15200 136% 80.00
Speex-11k 28 20 5 10.00 140 11200 180 14400 129% 100.00
Speex-11k 28 20 6 8.33 168 11200 208 13867 124% 120.00
Speex-11k 28 20 7 7.14 196 11200 236 13486 120% 140.00
Speex-11k 28 20 8 6.25 224 11200 264 13200 118% 160.00
Speex-11k 28 20 9 5.56 252 11200 292 12978 116% 180.00
Speex-11k 28 20 10 5.00 280 11200 320 12800 114% 200.00
Speex-11k 28 20 11 4.55 308 11200 348 12655 113% 220.00
Speex-11k 28 20 12 4.17 336 11200 376 12533 112% 240.00
Codec bytes/frame frame (ms) frames/packet packets/sec payload (bytes) bits/sec bytes/packet bits/sec % optimal latency
Speex-15k 38 20 1 50.00 38 15200 78 31200 205% 20.00
Speex-15k 38 20 2 25.00 76 15200 116 23200 153% 40.00
Speex-15k 38 20 3 16.67 114 15200 154 20533 135% 60.00
Speex-15k 38 20 4 12.50 152 15200 192 19200 126% 80.00
Speex-15k 38 20 5 10.00 190 15200 230 18400 121% 100.00