General information on Containers and Codecs

Discuss about generic usage of MediaCoder.

Moderator: HuggiL

Posts: 3004
Joined: Tue Jul 11, 2006 4:20 pm
Location: Portland, Oregon USA

General information on Containers and Codecs

Postby mixer » Sat Dec 12, 2009 4:48 pm

When using software programs like “MediaCoder” to convert one type of file to another, some of the problems people run into are: terminology and method.

End Result
It's always best to think backwards of what you want to achieve. Knowing the "end result" helps you decide the method to use. For example, if you know your "end result" will be a file that will play on a home entertainment DVD, then you can choose the proper format and delivery. For a home DVD player, that would be determined by what the DVD player will accept. Other "end results" might be to create a video/audio file that would playback just on your computer, a file that plays on a older slower computer, or a file that you use for storage and editing. All these and many more examples each require a different process.

Multiple scenarios: My home DVD (the one hooked to my television) instruction book says it will accept MP3, VCD or DVD files. It also says that these files have to be on certain types of media or discs. In this case mine can read from CD -R, DVD -R, DVD +R and MP3's (recorded on a "data" type disc). Based on that information, I'll be able to setup things correctly to make a media disc that will playback on it. But, let's suppose that I want to create a video/audio file that plays back only on my computer using its CD or even DVD drive. Now, that would be a different setup altogether.

One important thing to remember is that each "end result" is unique. So, just because I create an video/audio file that plays on my computer, doesn't mean that it will playback on another device.

Containers and Codecs
First let's get some terminology out of the way.

A video/audio file is comprised of three primary things: A container, the codecs, and the video and audio signal. Some people refer to a container as the "format" or the sometimes the file extension. For instance, "AVI" is a container. MPG is a container, QT/Quicktime "MOV" is a container, and “WMV” is a container. All these "containers" hold the codecs for both the audio and video signal.

So what is a codec? CODEC is a acronym or abbreviation for "Compressor Decompressor". When you record or encode, transcode or "recompress" a video/audio signal you compress the signal, and when you play it back, you decompress it. Now, this had me stumped for years: If a video or audio signal is encoded with a certain codec, then you'll have to have that same codec to play it back. This is why you get that irritating message: "Windows Media Player cannot play the file. One or more codecs required to play the file could not be found." This, of course, is when you're trying to playback a file on your or another persons computer.

So, as you can see, the type of codec you use within the container is also important, especially if you want compatibility between computers or platforms (MAC vs. PC). In other words, not all "containers" or all "codecs" work on all computers. To obtain additional codecs in the form of installable codec packs, see "Additional Information" below. And, there is another issue: Many codecs have settings or options that allow you to set the quality of the encoding (and ultimately playback). The higher the quality, the larger the file size, and all of this “quality” requires more computing power, memory and player speed.

Choosing a container and codecs
Again, think backwards from what you want to create. If perhaps you want your final file for storage and playback on a PC, then MPG container with the MPEG2 codec might work, or for little or no compression, then the AVI container using any of the low loss codecs like Huffyuv or DV to name a few. Just remember: quality will come at a cost in terms of eating up lots of drive space.

On the other hand, if you want a file that you can give to a friend that has a MAC, then perhaps a QT or Quicktime file would be best. Think about the delivery of the file. Is it going to be on a disc or streamed? You also have to think about what type of computer you’re going to playback the file on since it will have to have the necessary hardware (CPU, drives and memory) and software (OS, media player and codec support). You may even want to consider creating a master file that you can use for different platforms with different methods of delivery.

Sound confusing? Choosing a container and a codec is actually pretty easy when you follow these steps.
1. Determine your final product, and what it will playback on.
2. Pick the container
3. Pick the codecs based on the platform or delivery (PC, MAC, DVD, streaming or other personal device), quality of compression, file size and specifications of the format.

Keep in mind that every time you convert or re-encode from one to another, you introduce more artifacts, more noise...etc. These "generations" start with the raw or recorded video or audio source and go down in quality for every conversion or edit. Essentially your dealing with math computations in these codecs and doing anything to a A/V file will "round" and "truncate" the math. True, some codecs are more efficient and accurate in reproduction. They simply do that math better!
So, it seems that you want to keep the video as good as possible by sticking with the generation your computer and editor will handle.

Note: Programs like “MediaCoder” may refer to containers codecs or compression in different terms. For example: In “MediaCoder”, audio "Encoder" is the same as selecting the audio codec, and video "Format" is the same as selecting the video codec. Also, while it is feasible to "mix and match" just about any codec with any container, many will be non-standard and won't be supported for playback.

A container/codec example: DVD home players
Now when it comes to using a container and codec that will work in a standalone (non-computer) DVD/CD player, it’s even easier because these DVD players will only playback an disc that contains certain types of files. Those files that are also made up of containers and codecs for both the video and audio signal are specific to the player and its hardware. Most modern DVD players will play either a VCD or DVD disc.
A VCD is a disc based on MPEG 1 standards. A DVD is a disc based on MPEG 2 standards. Playable DVD’s or VCD’s that will play in a standalone DVD player require three things: The correct type of disc or media and the correct files on the disc. These files on the disc have to conform to certain standards. They can either be “manually” burned to the appropriate media or you can use an authoring program.
Note: If you use a software program to create or “author” your DVD or VCD and your video or audio files don’t conform to the DVD or VCD standards, then the program will recompress the files as necessary. Many programs will only recognize certain containers, file extensions, formats or codecs. This also applies if you decide to manually create the proper DVD files (without using an authoring program) from “scratch” since the player will still need the correct files and layout.

How much will fit (especially for authored or DVD's for standalone players)?
The amount of material you can put on a VCD or DVD disc is determined by the codec, compression, quality of the video and audio signal, duration and the type of media. There's no secrets here, it all comes down really to the bitrate of the signal. So, for saving files to a DVD or CD it's just a matter of having enough space.
For authored or discs that will play in a standalone player, you could spend a few minutes doing the math, but a quick search of the Internet will provide you with numerous "calculators" that will calculate the maximum amount of time or bitrate you can use.
Remember, when you use these "calculators" and you are creating a DVD or VCD for a standalone plyaer, you still need to conform to the DVD and VCD standards for either NTSC or PAL (see above), as well as leaving some space for file and menu generation.
Bitrate calculator for DVD: or

What will it look like (quality)?
The old adage applies here: "Garbage In = Garbage Out". In other kinder words, if you start with a blocky, noisy video signal, enlarge it and "re-encode" it to another format, it's going look even worse. One example of this is when I thought I'd save a bunch of Flash Video files and convert them so I could watch them on my television. Well, they didn't look so good because of the quality of the original material, the re-compression, and the poor resolution of my television. Other factors for playback quality can also be determined by your codec settings.

CBR vs VBR, two/three pass
CBR stands for "Constant Bit Rate", while VBR stands for "Variable Bit Rate". Bit rate is a measurement of how much your video is compressed. When converting using CBR, all video is encoded at the same (constant) bitrate. When performing a VBR encode, the encoder intelligently varies the bitrate up and down as depending on the complexity of the video segment. VBR is more efficient, because different video segments are more or less complex than other segments. By using a low bitrate on some, the encoder can then using a higher bitrate on others.

In theory, you might think you should always use VBR because of its higher efficiency. However, encoders can make mistakes when they determine how much bitrate is needed for a given scene. If they guess to low, they can create ugly artifacts (noise or distortion). For this reason, some encoders have features such as 2-pass or even 3-pass VBR encoding. Another disadvantage is that multi-pass encoding takes more time.
In general, a good encoder using CBR will look great on shorter programs (up to about an hour). There is no precise threshold for when to use VBR, but most programs that run more than 70 to 90 minutes will benefit greatly from it.

Re-encoding or Transcoding using MediaCoder: The Basics
• Codec compatibility: As you select a encoder/format keep in mind that your computer and associated players, software....etc may or may not have the necessary codecs to use the selections you choose. Many times, this requires you to experiment with the various settings. You may also have to download and install one or both of the following codec packages.
Codecs for operating systems: K-Lite): ... c_Pack.htm
• Encoding Speed: The more "conversion" or altering of the original video source you do, the longer it will take to convert the files to the new format. Other things that will affect this time are: Computer memory, CPU speed, Hard Drive condition (space and fragmentation), compression format, final bit rate.....etc.
• Encoding Time: The amount of time to encode or re-encode (transcode) a file from one format to another is determined by many factors. Some of these are based on your Computer (CPU speed, memory, hard drive), Source File (type, size, quality), and also determined by the New File Settings (codec type, quality, bit rate, size, and other processing) you choose.
• Encoding Quality: "Garbage In" equals "Garbage Out". Re-encoding a poor quality file will almost always result in an even poorer quality file. Always consider using the first generation or least altered video/audio file.

Additional Information

For more information on containers or codecs see:
• A/V Containers: ... er_formats
• Containers and Codecs: ... video4.htm
• Codecs: ... codec.mspx
• Codec Packages (Windows XP):
• Codec Packages: (K-Lite): ... c_Pack.htm
• Codec Packages: (MediaCoder only-support for older codecs): ... 071118.exe

This article is in process and will be edited to add more topics and information. mixer, 01/03/08
The text contained in this article is copyrighted (automatically under the Berne Convention) and licensed to the public under the GNU Free Documentation License (GFDL).
"Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts." A copy of the license is available for viewing at:
If you create a derivative version by changing or adding content, this entails the following:
* your materials in turn have to be licensed under GFDL,
* you must acknowledge the authorship of the article (section 4B)
You may be able to partially fulfill these obligations by providing a conspicuous direct link back to the article hosted on this website. Other obligations may also have to be met.

12-11-2009, Mixer

Return to “Generic Discussions”

Who is online

Users browsing this forum: Bing [Bot] and 6 guests