Codecs And Formats
What is a codec? What is a format?
A codec is a compression standard. Raw video or audio is compressed when encoding, and decompressed (decoded) on playback. MP3 is an audio codec – a compression standard that MP3 players know how to decode, and MP3 encoders know how to encode. There are hundreds of codecs out there; some of the more important ones are MPEG-2, H.264, Theora, VP8, DivX, XviD, and the WMV family (video) and MP3, AAC, Vorbis, and the WMA family (audio).
A format is a file container that holds one or more codecs – video, audio, or even data. The container format contains information about the video, audio, and data tracks that it holds. Some example container formats are mov (Quicktime), mp4, ogg, and avi.
What incoming video formats are compatible with Zencoder?
Nearly everything. We know that it’s difficult to predict what types of formats might be uploaded to your application, especially with user-generated content, so our goal is to accept every video format possible. So we support hundreds of codecs and formats, including all of the most common ones.
It’s actually probably more helpful to talk about the formats we don’t support, since that’s a manageable list. At the moment, there are only a few:
- Apple Intermediate
- HDV 720p60
- ProRes 4444
- Go2Meeting3 (G2M3)
- ER AAC LD (Error Resiliant, Low-Delay variant of AAC)
- Avid Meridien Uncompressed
Other than these codecs, which we hope to support soon, we can handle just about anything. And if you find something we don’t support, let us know – chances are we can figure out a way to make it work.
What output formats do you encode to?
H.264 is currently the highest quality video codec available, which means that it can usually look better at the same file size, or the same at smaller file sizes, than other codecs. It's also widely deployed, and most web browsers can play it (either natively, or via a Flash plugin), and so can many mobile devices, like the iPhone and Android. But there are licensing issues to consider.
Theora is a free and open video codec with no licensing issues. It is natively playable in many browsers, including Firefox, Chrome, and Safari. But compression is a bit worse than H.264.
VP8 is a newer codec. Like Theora, it is free and open. But it compresses better than Theora, and about as well as the H.264 Baseline profile. H.264 is still better in its Main and High profiles. But that will hopefully change as VP8, and VP8 encoders, mature. VP8 is expected to be widely adopted in web browsers, and can be played today in the newest versions of Chrome, Firefox, and Opera.
VP6 is supported natively in Flash 8, and so is widely used on the web. It is a good codec, but doesn't compress as well as H.264. We encode to VP6 in the FLV container, with MP3 audio.
MPEG-4 is often used in a 3GP format on mobile devices.
WMV is a Windows codec. We specifically support WMV 8, which is confusingly the same as WMV2.
MP3 is a pretty good audio compression format. But you do have to pay royalties on distribution of MP3 content in some cases.
AAC is quite similar to MP3. The standard itself is better, but MP3 encoders are often a bit more mature, so the quality differences between them are small. There are no licensing fees for distributing AAC content.
Vorbis audio is free and open, just like Theora and VP8 for video. Vorbis is a good audio codec, and is very comparable to MP3 or AAC.
WMA is a Windows audio codec that we support alongside of WMV video.
Microsoft Smooth Streaming (MSS) is an adaptive bitrate format which enables streaming of video content to platforms such as Microsoft Silverlight, XBox 360, Windows Phone 7, and select connected TV platforms.
Can you add support for codec X?
Maybe. We have plans to add support for a few more codecs, and we make these decisions based on customer demand. Get in touch and let us know what codec you want, and why, and we’ll definitely consider it.
Keep in mind that we aren’t interested in supporting 50 output codecs. We want to support every possible input codec, but only the most important output codecs. We’d rather do an awesome job with 5 video codecs than a mediocre job with 15.
What codecs should I use?
On the video side, this depends on how onerous you find the H.264 patent licensing terms. Frankly, they’re pretty liberal at the moment, so H.264 works for most people. It’s the best quality codec around and the most widely deployed, so it’s a good default. Again, be sure to understand the licensing terms.
Try VP8 if you want a new, emerging codec that is totally free and unencumbered by patents. Try Theora if you want a more established free codec, and can live with a bit less compressibility. But keep in mind that neither Theora nor VP8 are playable in every browser, whereas H.264 is playable in 99.9% of browsers.
What file extension should I use?
H.264 and AAC content uses a MP4 file format. Valid extensions are .mp4, .m4v (mp4 video), .f4v (mp4 video for Flash), or .m4a (mp4 audio-only).
VP8 content uses the .webm extension.
Theora and Vorbis content can use .ogg or .ogv (Ogg Video).
MP3 audio-only files use the .mp3 extension.
I want .flv video. Why do you tell me to use .f4v?
FLV isn't just a file extension — it's a container format used by older Flash Video codecs (H.263 and VP6), which is officially deprecated for H.264 content. If you want H.264 content playable in Flash, you typically want to use a MP4 container format, not FLV. Call it ".f4v" if you like.
It is possible to place H.264 and AAC streams into the traditional FLV file, but Adobe strongly encourages everyone to embrace the new standard file format.
What licensing issues should I worry about?
Vorbis, Theora, and VP8/WebM are totally free, and not patent encumbered. At least in theory; it's possible that someone will discover patent issues with these codecs at some point in the future. On the plus side, Google has a vested interest in defending Vorbis and VP8 against patent suits, and if anyone can do this, Google can.
AAC is free for distribution. Zencoder takes care of licensing AAC, so you don't have to.
MP3 isn't free - expect to pay 2%-3% of revenue related to MP3 content. See http://mp3licensing.com for more info.
H.264 is sometimes free, and the terms are a little complicated. See this document for details. Basically, if you charge money for H.264 content (either via subscription or on a title-by-title basis), you might have to pay something, depending on volume. But if you distribute H.264 content for free online, there are no required royalties. You might still want to sign some docs with MPEG-LA to get the royalty-free license, though.
As always, consult a lawyer.
How can I add quickstart to my videos so they play during download?
Zencoder automatically places the MOOV atom at the front of the file, similar to what qt-faststart (or qtstart) does. This means that videos will play sooner when downloading.
Can you transcode SWF files?
Maybe. SWF files can contain a variety of things - if we're able to identify a video or audio stream in the file we may be able to transcode it. Many SWF files don't contain an audio or video stream at all, but are instead animation instructions. While this may result in a series of changing pictures during playback, it's not a video stream that we can process.