The word ‘codec’ has two meanings in the technology world.
The term originally stood for coder/decoder – typically a hardware-based device that performed digital-to-analog and analog-to-digital conversion. One well-known example is a modem, used for transmitting data over analog telecommunications lines.
The second, and now more common meaning of ‘codec’ is compression/decompression. It describes the process of encoding voice and video traffic into a digital format for transmission across a network. These codecs use software-based algorithms to convert voice or video information into a byte sequence for transmission to a destination endpoint, where the sequence is converted back to voice or video.
Types of Voice and Video Codec
Voice and video codecs can be defined as loss, lossless, compressed or uncompressed. Lossless codecs capture and transmit all information, thus producing high quality audio/video but requiring a large amount of bandwidth. Lossy codecs only capture and transmit a portion of the data, with advanced algorithms used to predict and insert the missing information at the far end, thus reducing the amount of bandwidth required but usually resulting in lower audio quality. Uncompressed codecs are typically lossless, while compressed codecs may be either lossy or lossless.
Voice codecs can also be categorized as wideband or narrowband, depending on the breadth of the audio spectrum they can reproduce. Wideband codecs produce the highest audio quality and are often marketed as HD voice.
The audio quality of a codec can be evaluated using a Mean Opinion Score (MOS), a test that has been used for decades to determine a human user's experience of the call quality. MOS scores are ranked from 5 (excellent) to 1 (bad).
Selecting the best codec always involves some compromise between bandwidth consumption and audio/video quality. The codecs most commonly used for Voice over IP are G.711 and G.729. Other less common VoIP codecs include G.722, G.723, G.726, GSM, iLBC, Speex and SILK (used by Skype).
G.711, also known as Pulse Code Modulation (PCM), is a narrowband codec that delivers uncompressed toll-quality audio with very accurate speech reproduction. However each call consumes 64 kbps, so if call volumes are high then G.711 can require a large amount of bandwidth. This is one of the oldest codecs, having been introduced by the ITU in 1972. G.711 is royalty-free and has a MOS rating of 4.2. It copes well with multiple transcoding hops – i.e. if a call is first routed over an IP network using G.711 and then hops off to a cellphone network using GSM or G.726, then the call quality will remain acceptable.
G.729 offers powerful compression and excellent bandwidth utilization, only consuming 8 kbps per call. It is a licensed codec, meaning users indirectly pay to use the codec when they buy hardware that supports G.729. G.729 has a MOS rating of 4.0 after one compression/decompression cycle. However the MOS score can quickly deteriorate if the call is compressed and decompressed multiple times, which can occur if a call is routed over multiple networks and is therefore transcoded more than once.