Recovery & Repair
Data Transfer
Converter
Recorder

All You Need to Know about Video Codecs and Containers

author Emily Watson
date Wednesday, Nov. 25, 2015

Trying to unravel and decipher the differences and relations among codecs, containers and compression is hard. Complex questions abound. The blurred lines come into being when you start to talk about formats like MPEG-4 which can be classified as a bit of a codec and a bit of container as well. So, what is a video codec, and how does it differ from a container?

Video Format Codes

# What is a Codec?

A codec (encoder/decoder) is an encoding compression algorithm which processes the video files and stores it in a stream of bytes. Video codec makes use of an algorithm to compress the size of video files and decompress it when needed. Selecting the right codec depends on many factors, such as the target file size, output quality and delivery method. Depending on the codec, the encoding occurs in two ways: lossy or a lossless compression.

Some examples of popular codecs include:

H.264 / MPEG-4 AVC: This is the most common codec used in modern camcorders and digital cameras. YouTube now uses H.264 to encode high-definition videos, playable through Adobe Flash; YouTube also provides H.264-encoded video to mobile devices, including Apple's iPhone and Android phones.

MPEG-2: Note that we have to distinguish the codec (MPEG-2 Part 2, also known as H.262) from the MPEG-2 container format. MPEG-2 is used exclusively as the compression standard for DVD video. It was also used in the early days of Blu-ray Disc creation.

DivX / XviD: The DivX codec is often used to rip DVDs in the pre-HD era. And XviD is an open source version of DivX, popular among movie pirates.

# Video File Formats and Containers

Well, when you look at a video file, you will notice that the file names end with, for example .mp4, .mov, .wmv, .flv, etc. These extensions indicate the video file format. Just like a ZIP file can contain any sort of file within it, container is essentially a bundle of audio and video files. This can hold tracks of audio, video and audio/video codecs, subtitles, metadata.

Some examples of popular containers include:

MPEG 4, usually with an .mp4 or .m4v extension. The MPEG 4 container is based on Apple's older QuickTime container (.mov). Movie trailers on Apple's website still use the older QuickTime container, but movies that you rent from iTunes are delivered in an MPEG 4 container.

Flash Video, usually with an .flv or .swf extension. Flash Video is, unsurprisingly, used by Adobe Flash. More recent Flash video is encoded with H.264 video and AAC audio codecs.

Audio Video Interleave, usually with an .avi extension. AVI is an older Microsoft container format. It's still fairly common, but you probably won't want to use it with new projects.

AVCHD is the standard container used by many camcorders. Video captured with these devices is compressed with the H.264 AVC codec. Audio is encoded as Dolby Digital (AC3) or uncompressed linear PCM.

# So - does this help at all?

Till now, have you gotten the basic idea of video codec and container? What questions do you have with encoding, editing and converting video? Please include any question that you might have in the comments section below.