What is a codec ?

VideoLAN HOWTO
Prev | Chapter 1. Introduction | Next

# 1.2. What is a codec ?

To fully understand the VideoLAN solution, you must understand the difference between a codec and a container format

- A codec is a compression algorithm, used to reduce the size of a stream. There are audio codecs and video codecs. MPEG-1, MPEG-2, MPEG-4, Vorbis, DivX, ... are codecs

- A container format contains one or several streams already encoded by codecs. Very often, there is an audio stream and a video one. AVI, Ogg, MOV, ASF, ... are container formats. The streams contained can be encoded using different codecs. In a perfect world, you could put any codec in any container format. Unfortunately, there are some incompatibilities. You can find a matrix of possible codecs and container formats on the features page

To decode a stream, VLC first demuxes it. This means that it reads the container format and separates audio, video, and subtitles, if any. Then, each of these are passed decoders that do the mathematical processing to decompress the streams .

There is a particular thing about MPEG:

- MPEG is a codec. There are several versions of it, called MPEG-1, MPEG-2, MPEG-4, ...

- MPEG is also a container format, sometimes refered to as MPEG System. There are several types of MPEG: ES, PS, and TS

  When you play an MPEG video from a DVD, for instance, the MPEG stream is actually composed of several streams (called Elementary Streams, ES): there is one stream for video, one for audio, another for subtitles, and so on. These different streams are mixed together into a single Program Stream (PS). So, the .VOB files you can find in a DVD are actually MPEG-PS files. But this PS format is not adapted for streaming video through a network or by satellite, for instance. So, another format called Transport Stream (TS) was designed for streaming MPEG videos through such channels.

Prev | Home | Next
What is the VideoLAN project ? | Up | How can I use VideoLAN ?