![]() |
How to calculate the real bandwidth for an audio codec Craig Southeren Last updated 17 May 2004 |
Introduction Calculating the actual bit rate Comparing codecs Change history
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.
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.
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 |
| Speex-15k | 38 | 20 | 6 | 8.33 | 228 | 15200 | 268 | 17867 | 118% | 120.00 |
| Speex-15k | 38 | 20 | 7 | 7.14 | 266 | 15200 | 306 | 17486 | 115% | 140.00 |
| Speex-15k | 38 | 20 | 8 | 6.25 | 304 | 15200 | 344 | 17200 | 113% | 160.00 |
| Speex-15k | 38 | 20 | 9 | 5.56 | 342 | 15200 | 382 | 16978 | 112% | 180.00 |
| Speex-15k | 38 | 20 | 10 | 5.00 | 380 | 15200 | 420 | 16800 | 111% | 200.00 |
| Speex-15k | 38 | 20 | 11 | 4.55 | 418 | 15200 | 458 | 16655 | 110% | 220.00 |
| Speex-15k | 38 | 20 | 12 | 4.17 | 456 | 15200 | 496 | 16533 | 109% | 240.00 |
| Codec | bytes/frame | frame (ms) | frames/packet | packets/sec | payload (bytes) | bits/sec | bytes/packet | bits/sec | % optimal | latency |
| Speex-18.2 | 46 | 20 | 1 | 50.00 | 46 | 18400 | 86 | 34400 | 187% | 20.00 |
| Speex-18.2 | 46 | 20 | 2 | 25.00 | 92 | 18400 | 132 | 26400 | 143% | 40.00 |
| Speex-18.2 | 46 | 20 | 3 | 16.67 | 138 | 18400 | 178 | 23733 | 129% | 60.00 |
| Speex-18.2 | 46 | 20 | 4 | 12.50 | 184 | 18400 | 224 | 22400 | 122% | 80.00 |
| Speex-18.2 | 46 | 20 | 5 | 10.00 | 230 | 18400 | 270 | 21600 | 117% | 100.00 |
| Speex-18.2 | 46 | 20 | 6 | 8.33 | 276 | 18400 | 316 | 21067 | 114% | 120.00 |
| Speex-18.2 | 46 | 20 | 7 | 7.14 | 322 | 18400 | 362 | 20686 | 112% | 140.00 |
| Speex-18.2 | 46 | 20 | 8 | 6.25 | 368 | 18400 | 408 | 20400 | 111% | 160.00 |
| Speex-18.2 | 46 | 20 | 9 | 5.56 | 414 | 18400 | 454 | 20178 | 110% | 180.00 |
| Speex-18.2 | 46 | 20 | 10 | 5.00 | 460 | 18400 | 500 | 20000 | 109% | 200.00 |
| Speex-18.2 | 46 | 20 | 11 | 4.55 | 506 | 18400 | 546 | 19855 | 108% | 220.00 |
| Speex-18.2 | 46 | 20 | 12 | 4.17 | 552 | 18400 | 592 | 19733 | 107% | 240.00 |
| Codec | bytes/frame | frame (ms) | frames/packet | packets/sec | payload (bytes) | bits/sec | bytes/packet | bits/sec | % optimal | latency |
| Speex-24.6 | 62 | 20 | 1 | 50.00 | 62 | 24800 | 102 | 40800 | 165% | 20.00 |
| Speex-24.6 | 62 | 20 | 2 | 25.00 | 124 | 24800 | 164 | 32800 | 132% | 40.00 |
| Speex-24.6 | 62 | 20 | 3 | 16.67 | 186 | 24800 | 226 | 30133 | 122% | 60.00 |
| Speex-24.6 | 62 | 20 | 4 | 12.50 | 248 | 24800 | 288 | 28800 | 116% | 80.00 |
| Speex-24.6 | 62 | 20 | 5 | 10.00 | 310 | 24800 | 350 | 28000 | 113% | 100.00 |
| Speex-24.6 | 62 | 20 | 6 | 8.33 | 372 | 24800 | 412 | 27467 | 111% | 120.00 |
| Speex-24.6 | 62 | 20 | 7 | 7.14 | 434 | 24800 | 474 | 27086 | 109% | 140.00 |
| Speex-24.6 | 62 | 20 | 8 | 6.25 | 496 | 24800 | 536 | 26800 | 108% | 160.00 |
| Speex-24.6 | 62 | 20 | 9 | 5.56 | 558 | 24800 | 598 | 26578 | 107% | 180.00 |
| Speex-24.6 | 62 | 20 | 10 | 5.00 | 620 | 24800 | 660 | 26400 | 106% | 200.00 |
| Speex-24.6 | 62 | 20 | 11 | 4.55 | 682 | 24800 | 722 | 26255 | 106% | 220.00 |
| Speex-24.6 | 62 | 20 | 12 | 4.17 | 744 | 24800 | 784 | 26133 | 105% | 240.00 |
[1] RFC 1989 " RTP: A Transport Protocol for Real-Time Applications", http://www.faqs.org/rfcs/rfc1889.html
[2] RFC 768, "User Datagram Protocol", http://www.faqs.org/rfcs/rfc768.html
[3] RFC 760, "DoD standard Internet Protocol", http://www.faqs.org/rfcs/rfc760.html
[4] "Codec bandwidth and latency calculations", http://www.openh323.org/docs/bandwidth.html
| 17 May 2004 | Craig Southeren | Document copied from http://www.postincrement.com/openh323/bandwidth.html Added paragraphs explaining calculations and additional references |
Copyright © 2003-2007 by Post Increment
A.B.N 95 856 785 279
All Rights Reserved
All trademarks and copyrights on this page are owned by their respective owners.