Codec vs. Format: Part 1
The difference between codecs and formats.
When discussing video formats, people often confuse the concept of a codec with that of a format .
The difference is straightforward: a codec refers to the algorithm used to compress video (or audio and subtitle data), while the word format usually refers to the combination of the container or encapsulation used to store audio and video, together with the codecsused to compress them.
Format = Container + codecs
Example: XDCAM is a format that uses the MXF, container, the video codec MPEG2Video and audio in PCM
There is no naming convention for every possible combination, so in practice the format often refers to the container and is usually reflected in the file extension .
For example: MP4. When people refer to the MP4 format, they usually associate it with the container MP4, the video codec H264 and the audio codec AAC, although other codecs can also be used.
Examples of containers:
MP4, AVI, MOV, MKV, MPEG-TS, OGG, WMV
Examples of codecs:
H264, MPEG4, WMV, MPEG2-VIDEO, AAC, AC3
Not every container supports every codecs, and a player may recognize the container but not some of its codecs.
Think of the container as a means of transporting cargo—an airplane, train or bus—and codecs as the types of cargo it can carry. They are generally independent, with some exceptions where a container supports only particular codecs, such as FLV
AVI and MP4 are containers.
In my view, AVI could be compared to an old, limited train:
and MP4 could look more like this:
WMV is it a codec or a format?
WMV is the name of both a format and a codec created by Microsoft. As a format, it contains video encoded with WMV and audio encoded with WMA. The video codec WMV can also be stored within a different container, such as AVI
When someone says they have a file in the MP4format, that does not tell us which video codec it contains. Several codecs are supported, including MPEG2VIDEO and H264; the name refers only to the container.
“When we talk about a format , we are usually referring to a containercontaining video and/or audio compressed with a particular codec.”
