Understanding codecs and containers

The distinction between codecs and container file formats is often ambiguous. This is in part due to the general lack of standardization, confusing marketing terms and filename extensions. This page attempts to clarify this distinction briefly and 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.

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 close to be a form of art in itself.

The relationship between containers and codecs