General A/V compression guidelines

This is a generic tutorial on audio/video compression. It does not adhere to any specific application, but it teaches you what is what, so by using this knowledge you can export from ANY application in the market. So, here’s what you need to know:

* Many video editors require that you “tell them” in their project properties what kind of source footage you got. For example, if your source footage is NTSC HDV, you need to tell them to accommodate/optimize for 1080/60i. For PAL that would be 1080/50i. Then there is 24p footage, different resolutions, or plain DV or just digicam VGA video. You must always know what kind of source footage your camera outputs, so you can configure your video editor or utility to accommodate it. For example, if your camera shoots HD at 24fps and you let your video editor to use the default DV in a 60i timeline, you will get bad quality, and performance degradation during editing. So, get it right! Not all editors automatically recognize your source footage and auto-configure themselves.

* If you are using Sony Vegas, I would recommend you right click on clips in the timeline that lots of motion, select “Properties” and then “Disable Resample”. This will get rid of the “ghosting” effect during the final export. Not sure how to do that on other video editors, most of them don’t have the ability to turn it on/off.

* When you are finally ready to export, the first thing you need to decide is the medium you want to export to. Is it the web, the iPod, the PS3, a DVD, or simple archival? You see, depending the device you want to export for, different codecs and options apply. Here are some basic codec guidelines for some popular devices:
– iPod: 320×240 resolution, native frame rate as source footage, h.264 video codec 512 kbps, AAC audio codec 64 kbps stereo.
– Sony PS3 and XboX360: 1280×720 or 1920×1080 resolution depending if you have a 1080p or a 720p TV, native frame rate as source footage, h.264 or WMV or XViD video codec at 5 or 9 mbps, AAC audio codec 128 kbps stereo or 5.1 surround.
– DVD: use the DVD templates that video editors usually come with.
– Youtube: Same as iPod.
– iPhone and PSP: Same as iPod, but at 480×270 resolution at 1mbps bitrate.
– Vimeo SD and HD: Tutorials here and here.
– Zune and Creative players: 320×240 resolution, native frame rate as source footage, WMV video codec 512 kbps, WMA audio codec 64 kbps stereo.
– Archos and other PMPs: 320×240 resolution, native frame rate as source footage, XViD video codec 512 kbps, MP3 audio codec 64 kbps stereo.
– Archival: a lossless or near-lossless codec, like DV, HDV, mjpeg, Huffyuv, Lagarith, Cineform, ProRes, AIC etc.

* Video codecs. There are two kinds of codecs. The Delivery grade codecs and the Intermediate grade codecs. The first ones are supposed to be exporting/view-friendly, and the other ones archival/editing friendly. More information here on the subject. I would suggest to hunt for h.264 video, AAC audio, inside the .mp4 container format. That’s the most compatible and widespread format today on devices.

* Frame rate. Keep frame rate the same as the source footage (you should be able to find some “summary” information about your footage somewhere on your application). For NTSC that would be 29.97 (60i), for PAL 25 (50i), and then there’s 24 progressive frames, which actually in reality is 23.976 fps. I would suggest you export with the right frame rate each time and not round these weird numbers to 30.00 or 24.00.

* Resolution. When you export, depending on the camera you got, here are your resolution options and bitrate you should be exporting at with delivery-grade codecs:
NTSC DV 4:3: 656×480 or 640×480 (at 1800 kbps)
PAL DV 4:3: 768×576 (at 2300 kbps)
NTSC 16:9: 874×480 or 880×480 (at 3000 kbps)
PAL 16:9: 1040×576 (at 4000 kbps) or 880×480 (at 3000 kbps)
HVX or DVX 16:9 DV Panasonic cameras, export at 848×480 or 852×480 (at 3000 kbps)
AVCHD/HDV: 1920×1080 (9 mbps) or 1280×720 (5 mbps)
Canon TX1 or Kodak 720p digicams: 1280×720 (5 mbps)
Digital camera VGA 4:3: 640×480 (at 1800 kbps)
Please note that you should never export for web/viewing purposes with aspect ratios that are not 1.0000. I see a lot of people for example exporting DV at 720×480 or 720×576, but this is not the safe thing to do, because most applications don’t take into account the special aspect ratio value that these kinds of exports have, and so you end up with squashed heads. Use the above guide to get it right, and make sure that aspect ratio is set to either 4:3 or 16:9 for the above resolutions, or at aspect ratio 1.0000 if your application uses this way to represent pixel information.

* Bitrate. Bitrate is the amount of bits per seconds that the video uses. That’s the only factor that decides how big a video file will be or not. There are two kinds of bitrates: constant and VBR. In constant bitrate, you just tell the application to use a specific number of kbps or mbps, as shown above. But in VBR, you give two numbers: one for the average number and one for the peak number. For example, if you want an average bitrate of 3mbps, you can also ask the application to have a peak number of 5mpbs. The application will go as high as 5mbps only when there is a lot of motion on the scene and it requires more bits to encode it properly, while it will stay at 3mbps or below if the image is static and doesn’t require lots of bits. VBR is generally preferred for best quality, but it’s more difficult to figure out, if the application’s user interface is not well done.

* De-interlacing. If your camera does not shoot in progressive mode (most camcorders don’t, only digital cameras do), then you must de-interlace during export, otherwise your video will have “jaggies” (horizontal lines). You must hunt for a checkbox or option that’s called “de-interlacing” or “progressive”. Please note that if you are exporting in an intermediate format for editing/archival reasons, or back to the camera’s tape, you should not be exporting as progressive, because this is not the footage’s native format. Only de-interlace for “viewing” purposes, e.g. youtube, ipod etc.

* Audio bitrate. For audio select between 64kbps to 128 kbps (although you can have VBR for audio too). More than that is usually goes unused by many devices/headphones, so there’s no reason to use more. Use 44.100 Khz for sample rate, and Stereo.

* Audio Codec. Like with the video codecs, there are many different audio codecs you can choose from. But the audio codec should always be decided in conjuction to the video codec. For example, if you want to export in h.264 Mpeg4, you must use AAC, because that’s the way most players are optimized to read h.264 with. For DivX/XViD it’s mp3. For Theora video it’s Vorbis audio. For WMV it’s WMA, and so on.

* Containers. Don’t confuse “containers” with “codecs”. MOV and AVI are *not* codecs, so saying that “I exported as AVI” says nothing to others who might try to debug your problem. AVI/MOV are simply file formats that inside them can “host” actual video and audio codecs. In theory, you can have a gazillion different codecs in them, it’s just a container format to keep “glued” the different kinds of audio and video together…

5 Comments »

DS wrote on February 8th, 2008 at 6:53 AM PST:

For SE K790, K800, K810, K850, and equv. w series phones (W850 probably) .
Codec: XVid low profile (No B franes, No qpel)
Frame rate: native if up 30, cut off otherwise
Bit rate: up to 300 kbps
Audio: AAC, LLC profile, br 30-64kbps
Format: MP4 (MP4Box does the job on linux).
Theese settings produce produce video viewable both on the phone and video capable ipods (incl. nano)


jeff wrote on February 11th, 2008 at 7:57 AM PST:

A lot of people including me also want to host their own videos not with vimeo’s 3rd grade interface. So I don’t know why you left out flash hosting. It seems easier to just buy the converter because your post mid 2007 seemed complicated.

Another question: Why aren’t you using flash so the content is HD on your blog?


This is the admin speaking...
Eugenia wrote on February 11th, 2008 at 1:17 PM PST:

Vimeo’s interface is not 3rd grade, get over yourself. It has bugs, but it’s much better looking than youtube.

As for not hosting HD on your own, it’s because 99% of the people either don’t have a homepage, or they have it in places where they have hard bandwidth limits. It’s not applicable to host HD yourself, bandwidth costs money.


jeff wrote on February 11th, 2008 at 2:26 PM PST:

Well write that tutorial for us 1% then. And pretend that in the next year bandwidth costs will go down.


This is the admin speaking...
Eugenia wrote on February 11th, 2008 at 2:37 PM PST:

But I have already written a Flash tutorial.


Comments are closed as this blog post is now archived.

Lines, paragraphs break automatically. HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

The URI to TrackBack this blog entry is this. And here is the RSS 2.0 for comments on this post.