It’s a subject with widespread confusion often leading to only a partial understanding.
There are file containers, sometimes called wrappers, that wrap around a number of video and audio tracks. Each of those tracks will have an appropriate video or audio codec. A codec is a concatenation of “coder – decoder”. Basically it’s like using a secret code or cryptography: as long as the encoder and the decoder understand each other, we get video and audio back out at the other end.
Think of a shipping container. There’s this standard “wrapper” (the container) which tells us nothing. Inside could be a car, computer or a million wrist watches. Like the shipping container, file containers can carry many different types of content – the video and audio tracks. These tracks are encoded with some sort of codec. Most codecs compress the video to reduce file size and time to download (and to increase field recording times in production), but there are codecs that work with uncompressed video. Every track has to have a codec for video and for audio.
Common containers are QuickTime (which supports over 160 codecs at last count); AVI (which probably supports almost that many) and MPEG-4, which supports only a few codecs, but very versatile ones. Common codecs are “MPEG-4”, “Sorenson”, “H.264”, “Animation”, “Cinepac”, etc. (DivX is it’s own thing, as I’ll explain.)
Most QuickTime codecs are for production purposes. The older QT codecs that were used for .mov on the web have been “deprecated” by Apple. They no longer show up as export options in the default install of QuickTime. Nor should they. They’re way too inefficient by modern standards. The last new QT distribution codec was Sorenson Video 3 in July 2001. In codec terms that’s just a little after the Jurassic era.
AVI has been a workhorse. I refer to it as the Zombie format because Microsoft officially killed it in 1996 (when the last development was done). It is still in use in production on PCs and very popular for distribution on the Internet, with more modern codecs. Most AVI production codecs are specific to their hardware parent. A modern .avi file is likely to be a “DivX” file.
DivX is actually a hybrid of an AVI wrapper with an MPEG-4 Advanced Simple Profile (see later) video codec and an MP3 audio track. This is a bad hybrid of codecs and formats, such that DivX for a while had to have their own player. (MPEG-4 video should go with AAC audio.)
Most often the MPEG-4 codecs are used in the MPEG-4 container. This is a modern, standards-based container not owned by any one company. It is an official International Standards Organization standard. The basic file format was donated by Apple and is heavily based on the QuickTime container, but is NOT the same. You can’t just change the .mov to .mp4 (or reverse) and hope it’ll work. (It will in the QT player but nowhere else.)
The first codec that the Motion Picture Experts Group (a.k.a. MPEG) approved is properly called MPEG-4 Part 2 ‘Simple Profile’ or ‘Advanced Simple Profile’. This was such a great marketing name, that Apple just called it simply “MPEG-4,” thereby creating huge confusion for everyone as the distinction between codec and container was totally blurred! Thanks Apple! Not! Apple only supported Simple Profile; Sorenson and DivX used Advanced Simple Profile and there were components for QuickTime (not made by Apple) that played Advanced Simple Profile MPEG-4 as well as Simple Profile MPEG-4.
DivX uses the Advanced Simple Profile but in an AVI wrapper, as noted above.
Then just a few years ago, the MPEG association approved a new codec, to be used in the same MPEG-4 wrapper, called (in full) MPEG-4 Part 10 the Advanced Video Codec (AVC). The European ITU also supported the same codec independent of MPEG-4 (so it could be used in other wrappers) as H.264. They’re all the MPEG-4 codec that is Part 10, Advanced Video Codec or H.264.
And yes it is possible to put an AVC/H.264 video track in a QT .mov, but that’s a different container and only QT will play it. MPEG-4 is an ISO standard and there are more than 20 player implementations.
It is AVC/H.264 video with AAC audio (the MPEG audio standard) in an MPEG-4 container that is now playable in QuickTime Player, iTunes, on Apple Devices, in 20 standard players and in Flash 9 release 3 or later (9r3 was finalized in Nov 2007 and is now widely installed). Microsoft have also announced support for H.264 MPEG-4 is coming in Silverlight in 2009, and Windows 9 Media Player has support built in for those same files.
3GPP and 3GPP2 cell phone codecs are part of the MPEG-4 family fwiw.
Hope that helps and makes sense.
13 replies on “What’s the difference between a codec and a container or wrapper?”
Hi,
thanks for the article. Makes a lot of sense.
I have to use an AVI file in Final Cut Pro. How should I convert that file ? How do I find out what is wrapped inside ? Or maybe that doesn’t even matter ?
Maybe that question makes no sense. Just let me know.
Cheers
Andreas
QuickTime understands a limited subset of AVI – basically just the Microsoft version of 1996 – but it’s likely it won’t understand or natively convert “any” AVI. It really depends on what codec is in the AVI. You could try opening it in QT Player and Get Info (you’ll have to likely click pass a screen that says that it doesn’t understand the codec or a compressor is missing, you’ll get a white screen).
If it’s a standard codec try installing Perian (perian.org). If it’s a Matrox or other proprietary codec you may need to convert on a PC.
Philip
If Perian allowed the .avi file to be played in QuickTime Player, would saving it out of QT Player as a self-contained .mov repack it into a QuickTime envelope? And would it then be able to work in FCP?
It would repack as a QuickTime envelope but with the same codec unless you specifically exported to a different codec – one that was more natively supported in FCP. FCP will play non-native files in the Viewer, which is just a QuickTime viewer really, but when they go into a Sequence they’ll need rendering or will play back with reduced quality or frame rate.
If you can get the file to open in QuickTime Player with Perian, then export to DV/DVCPRO or to DVPRO50 for a bit higher quality on the intermediate. If you know the codec of your sequence, then export to that format. (For example, export to an Avid codec if going to an Avid system.)
Philip
Hello,
thanks a lot for your feedback. Inside the AVI wrapper is a DV file. It plays fine in the timeline of FCP but FCP comes up with an error message saying I should use the media manager.
I do have Perian installed. I am not sure if that is the reason why it does play.
The other thing I have tried is converting to DV using VisualHub.
Thanks for your feedback
Kind regards
Andreas
QuickTime is a very forgiving technology. Final Cut Pro, being a video only application, is a lot less forgiving. Because QT has a DV codec it reads the AVI and plays it (Perian would do that for DivX and a lot of other formats). However, FCP is not optimized for AVI at all – pretty much you’ll need to render more often than not. The message you’re getting is to process the file to a QT movie that FCP can optimize for playback.
And that is absolutely what you must do. AVI files, regardless of codec, won’t perform well in FCP.
Philip
Hello Philip,
thanks a lot. Thats what I will do.
Andreas
Hi, Philip.
Thanks for tackling the container v. codec question. I’m a non-technical person wrestling with format conversion in order to make a half-decent DVD of holiday footage using OEM or freeware authoring apps.
I’ve got original clips in QuickTime (.mov) and one program that seems not to like the audio stream (a Sonic branded version of Roxio’s MyDVD Plus) and an Open Source program that can’t “see” most of the files I’ve loaded into it (DVD Flick, source files converted to MPEG2 PAL DVD-compliant files using SUPER).
So much for “I’ll just make a DVD of my holiday videos…”!!
Martin.
Unfortunately just knowing it is a “QuickTime Movie” doesn’t much help. We know the container, but have no clues as to the codec. You would need to find software that can read the file you have (and without knowing what codecs are used for video and audio I can’t help) then you have to encode that footage to MPEG-2 for a DVD, then you have to actually author a DVD – it’s more than just MPEG-2 files on a DVD disc.
Philip
I’m sorry, I stumbled on this site doing a google search. After reading a couple of articles I realize this is a wonderful resource, but where am I? Who is Phillip? Can old people ask dumb questions?
Thanlks
Easiest way to find out about Philip is to google Philip Hodgetts! All questions are welcome.
What does a “wrapper” or “container” do? It sounds like the codec is the most important thing. Why do we have this step of codec and then wrapper?
You cannot have a codec without a container or wrapper – you need both. In many cases, particularly QuickTime, the container can hold so much more than just video and audio codecs – filters, transitions, Virtual Reality objects and scenes, interactivity etc. The MPEG-4 container is also capable of a lot of this as well (since it’s heavily based on QT) but not much has been implemented in MPEG-4.
Philip