Gimmie Java!

The HT Guys love their Coffee. If you want to say thanks, a cup of joe will do just fine! You can even make it a recurring subscription, which helps us with the costs of producing the show each week.

Choose your size Small ($6.00) Medium ($8.00) or Large ($10.00)

Or select a Caf-Pow and get a shoutout read on the show

 

Watch the Videos

 

YouTube
 
Categories
Entry
Sunday
Aug072011

Containers vs Codecs

On the last show we talked about containers vs codecs and wondered why videos required a container. We received a couple of emails that explained the concept. We felt one email in particular from Andrew Beck explained the concept really well. The following is that email. Thank you to all who wrote in!

Containers vs Codecs

The reason that you need a container is that the two streams (audio and video)are separate in a movie file. The container holds them and also contains enough metadata for the decoder to separate the streams and decode them.  With out a container your audio and video would be two separate files with nothing to sync them together.  Like any file format the container is spec'd out in the beginning.  As time goes by, newer codecs get developed that may not be able to be fit into the container.  When AVI was created chapters, menus, subtitles, and 3D just weren't considered

AVI is a very old format.  It was never intended to support advanced codecs like mpeg-4 or variable bit rate audio.  These advanced codes depend on looking forward in the stream to decode the frame you are on, and AVI wasn't intended to support this.  Changes have been hacked on, but they are not always successful.

MP4 is a pretty good container, but it's patent encumbered (you may need a license to use it).  It also doesn't have good support for audio other than AAC.  Since HDTV uses AC-3, DVD rips use AC-3 or DTS, and Blu-Ray rips use DTS-MA or DD+; you'll have to re-encode the audio to use this container.  And a re-encode is always a loss of quality.

M4V is just Apple tweaking MP4 to allow for DRM and to put in AC-3 support.  Unfortunately many players won't recognize this extension with the AC-3 audio.  Some people have luck renaming it to MP4; but since AC-3 isn't in the MP4 spec, you might not be able to get the audio.

MKV was developed to solve all of these problems.  It supports virtually any codec (and any future codec should be able to be put in) for audio and video.  It also has support for 3D, subtitles, chapters, and soon DVD style menus.  It also is open sourced and should be free of patent issues.  Also because it supports basically any codec you can often encode into an MKV without transcoding your audio and video.  You just need to rip the raw data and put it into the container.  The downside is that since you are basically unlimited in the codecs you can use, there is almost an infinite number of MKV variations.  People who advertise the ability to play MKV rarely test but a subset of them.  This is what leads to devices having trouble playing them.

Now as to why we have so many containers, I can't really answer that.  It always seems that everyone would rather roll their own due to some perceived deficiency in the existing containers.

Reader Comments (3)

Good reading, thanks

August 7, 2011 | Unregistered CommenterBert

Wanted to add a minor clarification; 'mp4' is used to describe both a container and a codec. When you see .mp4 at the end of the file, it's an mp4 container but not necessarily the mp4 codec inside. Similarly, even if you see a different file name extension/container, you could have an 'mp4' codec inside that container.

Andrew covered the mp4 vs m4v container issue... the main thing to be aware of for Apple device owners is that chapter and subtitle information may not be available on your iOS device or in Quicktime if the file extension is .mp4. Just change the extension to .m4v and it all works. Of course, non-Apple users may need to go the opposite direction as Andrew noted.

The codec story is involved (MPEG4 has multiple 'parts'), but for the average user today (who will most likely be using MPEG4 Part 10) the mp4 codec is essentially the same thing as the h.264 codec which is the same thing as the AVC codec. Blu-Rays label this as AVC, most video geeks label it as h.264, and from my experience, most 'normal' people call it mp4.

August 9, 2011 | Unregistered CommenterBrett in PA

I believe AC3 is now included in the MP4 specification as it is listed as a registered type on the MP4 Registration Authority website (which is actually maintained by Apple for use by the standards community). You can find more information at the website www.mp4ra.org.

M4V is simply used as a "flag" for Apple devices to enable certain functionality (AC3, chapters, subtitles) on their devices. It is otherwise identical to MP4.

August 12, 2011 | Unregistered Commenternateut

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>