Making Videos – it’s about the codec, not the extension

Ever wonder why your stupid program won’t open your video file? Oops, maybe I have to convert my .mp4 to an .avi. You cannot make such a conversion, actually – because note that your mp4 and your avi could be exactly the same type of file.

WHAT?!? Seriously? But an .xls is not the same as a .doc, right?

Multimedia is a special case. The extension of a multimedia file doesn’t matter, only what’s known as the codec. The only thing you can probably tell from the extension of a multimedia file is that it’s probably in fact a multimedia file, but not much more than that. a multimedia extension such as .avi, .mp4, or .mov is just a “container”. In other words: it doesn’t really matter what the extension of a multimedia file is – it can contain anything!

Anything? S*** – can it contain a virus or rootkit!?!?!

If you are instructed to change the extension into an executable one and then execute it on your system, yes. Can you catch a virus if you play the video? Well…I actually do know of some exceptions that I might talk about in future blogs, such as where playing a video can result in you getting a virus or getting spied on through your webcam (crazy, isn’t it)…but if you open it in something like VLC media player on your desktop, no.

Ok, so what the heck is a “codec”?

Codec means compressor-decompressor. That’s right there is something special called a decompressor that acts on your video whenever anyone plays it back. The “compressor” portion of the codec is what’s used to “encode” the video into that “video format”.

This applies to YouTube videos for example – usually YouTube videos are some form of h264. When you upload your video keep in mind YouTube re-encodes your video into its own set of standardized codecs – which means it has to understand your video that could be one of any number of codecs. YouTube usually supports almost any valid video that you can give it when you upload your video, so they probably have quite a lot of codecs installed on their servers.

Examples?

Cinepak is a codec. h264 is a codec.  To complicate matters further, there’s more than one kind of h264 codec for example. To find your specific codec, you should do the following:

1) Download and install  VLC media player which is free to use

2) Open your multimedia with it, and immediately pause it.

3) Go to Tools > Codec Information

4) You will see displayed information about your video’s codec, and your audio’s codec. THAT’s what a multimedia file really is based on – NOT the extension

Fallacies of thinking that extension = file format for multimedia

If you are somewhat familiar with Apple video, you may think that .mov is always associated with a Quicktime file. Wrong. A .mov is just another container. Do you know that it can still contain something that a non-Quicktime extension can contain? Such as  H.264/MPEG-4 Part 10 (also known as  H.264/MPEG-4 AVC for short)

Obviously an MPEG-4 is .mp4 – so a .mov could be MPEG-4 too? What?

Exactly – MPEG-4 is the codec. .MP4 DOES NOT MEAN MPEG4   – .mp4 is just the file extension.

Technically,  here’s an example of a real codec: H.264/MPEG-4 Part 10  (also known as  H.264/MPEG-4 AVC for short)

Saying just “h264” or “MPEG-4” is too vague! When you say MPEG-4, do you mean MPEG-4 Part 2 or do you mean  H.264/MPEG-4 Part 10 (see what I mean)?

This chart here about container formats (file extensions)  might help clear things up – but notice how some of the extensions such as MKV support anything and even MP4 supports a lot of codecs that some of the other file extensions also support. Notice that for Quicktime it says “Limited to what is available to the QuickTime codec manager” – some of these codecs are not necessarily codecs only supported by Quicktime such as MPEG-4.

Let me tell you one more thing though – players like VLC media player are going to check only the codec, and not give a rat about the file extension or the rules about the above chart. That’s why it used to have a slogan along the lines of “play everything anywhere” – because players like VLC Media Player do not check for container compatibility,  only the video and audio codecs, as well as bypassing some other integrity checks that may make a video unplayable in some other players to be playable with VLC Media Player (as long as the CODEC is INSTALLED on your system and the video isn’t too corrupted digitally!)

What this “codec” stuff means for creating multimedia

Pick a real editing program that supports most formats, such as Premiere Pro, Final Cut PRO, Avid, Sony Vegas, and so on, and you might not need to worry about your videos not importing into the editor. Some video editors just will not support some codecs even if you have installed them on your system.

However, you can use any video editor, even those that only support a few codecs and container formats such as Windows Movie Maker. You will however need to use a video conversion tool to convert the video into your desired codec, if your video does not seem to be openable in that program.

You need to research the supported codecs and sometimes even the “containers” (file extensions) for your target program and make sure you convert your multimedia to those codecs. You also might need to be absolutely sure that the file extension is correct because it might matter to the programs that are more limited in terms of video editing. In other words, even if your program is encoded in the proper codec, maybe the program is going to check the extension too, unfortunately, so make sure both the codec and the file extension match what your editing program supports.

The best and most universal video converters do cost some money, though some of them are free. There may be some quality loss, and there are some specific ways to minimize or eliminate it by ensuring a lossless codec is chosen if possible (also be sure that the codec is really lossless in that it does not do keyframe estimation – using a video format that requires keyframe interpolation is still a form of quality loss), and that lossless encoding options are chosen (or if not possible to be lossless, at least choose resolution and other settings as close as possible to the original )

Example of a Free re-encoder?

That “useless looking program” called Virtualdub

I hope this trick was helpful and informative to you!

Advertisements

About tricksoflife

My name is Robert Florescu and I'll be posting random observations about interesting "tricks" I've found in general.
This entry was posted in Tricks. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s