Understanding codecs and containers

The following is one of the most complex topics of video editing. Many people do not know the distinction between codecs and container file formats, thanks in part to the general lack of standardization, confusing marketing terms and filename extensions.

This guide is an attempt at clarifying this distinction without going into technical details. If you want to learn more about containers and codecs, you should probably look at Wikipedia's page on containers and codecs.

Basically, a container is what we typically associate with the file format. Containers "contain" the various components of a video: the stream of images, the sound, and anything else. For example, you could have multiple soundtracks and subtitles included in a video file, if the container format allows it. Example of popular containers are OGG, Matroska, AVI, MPEG.

Codecs are ways of "coding" and "decoding" streams. Their job is typically to compress data (and decompress it when playing it back) so that you can store and transmit files with a smaller filesize. There are many codecs available out there, each with their strengths, weaknesses and peculiarities, and choosing the right codec with the right settings for the right situation is a form of art.

The following figure should make things clearer: