Creative Commons License

Optimal Compression Settings

One of the first questions people have when it comes to compression is "which format or codec is best?" Unfortunately there's no real answer to that. Compression is constantly evolving and improving, so the format that has the best picture quality today may not be the best in 6 months. Additionally, some codecs are better at certain things than others, so the best for high quality video isn't necessarily the best for low bandwidth video. Finally, other factors such as image size and data rate can have significantly more impact on final quality than the particular codec used - and if you understand these things it's easy to test various codecs against each other using similar settings. So I'm going to focus on these other factors here because they will be applicable regardless of the codec used.

There are three primary factors to consider when it comes to compressing your video for online delivery - data rate, image size, and frame rate. If you understand how and why you would vary these it's easy enough to do your own tests and determine the best solution for your particular video & needs.

Data Rate

We'll start with data rate, because this is the most important factor when it comes to minimizing your viewer's download time. The first thing you need to know is what kind of bandwidth your viewer has - here are some common advertised speeds:

Dial Up - 56Kbps
DSL - 768kbps - 6Mbps
Cable - 1.5Mbps - 6Mbps

Now, the reality is that connection speeds can vary quite a bit from advertised speeds. Comscore's connection speed survey from April 2004 shows the following averages:

Dial-Up - 34 kbps
DSL - 861 kbps
Cable - 2,178 kbps (2.178 Mbps)

And's Bandwidth report for March 2006 shows 68% penetration of broadband among active internet users.

To put these speeds into perspective, a typical DVD runs at somewhere between 4-9Mbps - so to hit most broadband users online we need to compress 2-10x smaller than we do for a DVD. Realistically, at an average speed of 34kbps dial up is simply not an option for delivering video with any kind of acceptable quality. All else being equal, higher data rates will result in higher quality video, so we want to use the highest data rate we can get by with while making the video accessible to the most viewers.

So we'll focus on the broadband audience. To hit a speed that we know will stream to most broadband users we'll need to have a data rate of no more than about 800Kbps. That gives us a good starting point - we may also want to do a higher quality version at about double that, call it 1.5Mbps. Another option would be to just pick a midway point, maybe round it off to 1Mbps, and let those on slower speed connections wait a little longer - Cable has about double the market share of DSL now, so running a little higher than the average for DSL probably won't affect too many viewers.

You can test your own connection speed with a variety of online tools - I like Speakeasy's utility here:

Image Size

Now that we have a target data rate we can decide what size to make our video. Assuming you're working with standard DV video, the full resolution of your video is 720x480 pixels. However, DV uses rectangular pixels while computers display images using square pixels, so full standard definition resolution for online video would be 640x480 pixels. You could just export your video at this resolution and your chosen data rate, but this may not be the best option.

At any given data rate a smaller video will look better than a larger one. This is because you are reducing the amount of image data to compress before applying compression to it, which means less compression needs to be applied to each individual frame. Less compression results in a better image. Of course, there is a point of diminishing returns, at which the image gets so small that you're losing most of your image detail. So the trick is to find a good middle ground.

Reducing your original 640x480 pixel video to half that size - 320x240 pixels - results in 75% less original pixels. This means you only need to apply one quarter of the compression you'd need at 640x480 to hit your target data rate. Depending on your target data rate this can have a huge impact on image quality, so the trade-off of a smaller video may be worth it.

You can also usually play back a video at double it's actual size - sometimes compressing a smaller video and playing it back doubled can result in a more pleasing image than compressing it at the original size because of the lower amount of compression necessary at any given data rate.

Common sizes for online video:

4:3 ratio:

640 x 480 (full)
480 x 360
320 x 240 (half)
240 x 180
160 x 120 (quarter)

16:9 ratio:

853 x 480 (full)
640 x 360
480 x 270
320 x 180

Frame Rate

Reducing the frame rate of your video can also improve quality by reducing the amount of information to be compressed - however, it generally doesn't make as much of a difference as reducing the size. The reason for this is that most modern web codecs use 'interframe' compression, meaning they only save the differences between frames in order to compress the video further.

This means that video with little motion can compress very efficiently because there is a lot of redundant image information, and each individual frame may not show much compression. Video with a lot of motion doesn't have much redundant information, so each frame has to be compressed a lot more and the image tends to look significantly worse.

So if your DV source is at the standard 30 frames per second (fps), you would think dropping it down to 15fps would drop the necessary compression in half. However, it's entirely dependant upon the video itself. High motion video may be improved significantly by dropping the frame rate, whereas low motion video won't show much difference. You'll have to make the decision based on the individual video.

Typically when reducing the frame rate you want to keep it at an even multiple of the original source - this means you'll usually use either 30fps (original frame rate), 15fps (half rate) or 10fps (one third rate). Lower frame rates make motion less smooth, and 10fps is about the lower limit before things get very choppy.

Two Pass Encoding

In the encoding process your encoding software basically goes through your video a frame at a time, compressing each to a size that will allow the total data per second to meet the data rate you specified. The problem is applying equal compression to each frame is not the most efficient way to do things and won't result in the best quality.

As I mentioned before sections of video with little motion can often be compressed far more easily than those with high motion. Ideally you would apply more compression in the more static sections of your video and use the data saved to allow less compression in the areas of high motion - and that's exactly what 2-pass encoding does.

In 2-pass encoding the encoder runs through the entire video once to determine where it can compress the most and where it needs to use less compression. Then it takes a second pass (hence the name) to do the actual encoding based on it's findings from the first pass.

The drawback is this takes twice as long as single pass encoding - however the difference in overall picture quality (especially during transitions and high-motion sequences) is significant. I'd say unless you are under a really tight deadline you should always use 2-pass encoding.


So knowing all of this, how do you determine the best setting for your video? You have to do tests - there's just no way around it. After you do some testing you'll probably get a good idea where to start in the future, but because compression quality is affected both by the codec used and the video itself the optimal settings for any given video will require further testing.

Start by choosing your target data rate. Export 10 seconds of your video at this data rate - try to choose a segment which is representative of your overall video, with an appropriate level of motion. Export 3-4 versions at different image sizes (all at the same target data rate) to see how big you can go before the compression makes the image look worse than the smaller sizes. That will give you two sizes - one at which the image looks good, and a larger one at which it begins to fall apart. Now test exporting the larger size at a lower frame rate and compare it to the smaller one - does the image quality improve significantly? If so, is the improved image worth the trade off of slightly choppier video?