Recently I dug into DVD encoding and I spend quite a lot of time trying to figure out what should be the output format. In this complex world, I did not really find synthetic information which explains what a digital video file is made of.
Now that I gained a little knowledge on this topic, I’ll try to briefly expose my findings. I’m not a professional so if you find an error please leave a comment and I’ll fix that.
The container and the streams
A video file is primarily defined by the container. A container is in charge of organizing the video data (also known as “streams”) and metadata (information about these “streams”) physically, within the file. The container controls (and thus allows) the playback of the streams together.
Most of the time, a video is composed of:
- A video stream (obviously)
- A sound stream (the sound of the video)
There are other types of streams, such as subtitles. There can be multiple streams of the same type in a single file: for example, on a DVD you usually have one video stream, several audio streams (for multiple languages) and several subtitle streams.
Some containers cannot handle multiple audio streams, and subtitle streams. The following containers are well known: 3GP, ASF, AVI, MKV, MP4.
The video formats and codecs
Within the container, streams must be encoded to a certain format; there are numerous video formats that can be standards, like MPEG-2 and MPEG-4, and other video formats that are proprietary, i.e. licensed or even locked by a patent, like Sorenson (QuickTime 3) and Microsoft MPEG4 v3.
The software used to encode video to a format, or/and used to decode the video in a given format from a stream is the CODEC. Basically, a Codec is a software implementation of a format. For this reason, a stream encoded with a given Codec might be decoded as well by another Codec. The Codec is usually free, but some are locked or licensed.
By misuse of language, people often mix Codec and Format. For example, what is a DivX? DivX is a codec which implements the MPEG-4 ASP video format standard. Basically, such video streams can be read by lots of other codecs like Xvid, 3ivx, QuickTime, Nero Digital, libavcodec...
I hope things are a bit clearer to you now, as it is for me. Now you should be glad to know that AVI and DivX are not video formats!