Creative Commons License

Video Compression for the Web

Video delivery online is all about compromises - there is no one 'best' setting for compressing your video before you upload it. The primary limitation is bandwidth - not only the viewer's bandwidth, but also that of your server. Because bandwidth is something you have little control over, you have to compromise other factors - image size, frame rate, etc, to create a video your online audience can view. In addition to these factors you have to choose a format & codec for your video - this choice is also often a compromise between player penetration (the number of users who have the correct player installed) and video quality at a given size and data rate. Again, there is no best format - you have to make a decision based upon your particular delivery needs.

Streaming vs. Progressive Download

Video online is often referred to as 'streaming' video whether it is really streaming or not. True video streaming requires a special streaming server for delivery, and usually involves lower data rates, correspondingly lower quality, and greater expense (you have to pay for the server, which is sometimes licensed based on the number of streams you want to serve). Streaming has several unique strengths - it's the only way to deliver live video online, it also allows the viewer to have random access to prerecorded video files, and it is more secure because the entire video is never downloaded to the viewer's computer (only a few seconds of buffer are ever stored locally).

Progressive Download is a term for non-streaming video which nonetheless plays as it is downloaded to the viewer's computer. It does not allow random access to a video until the entire video has been downloaded, and the entire video is stored on the viewer's computer, so it is easier to copy the files. However, it's generally less expensive and simpler to deliver than streaming video, and because there is less of bandwidth limitation than with streaming you can usually deliver higher quality video. If the data rate of your video is lower than the speed of your viewer's connection a progressively downloaded video file will appear to stream in real time.

In general, if you don't need true streaming (i.e. for a live event) progressive download is the better choice, and I'll be focusing on it for the purposes of this article.

File Size & Data Rate

Data Rate is how much data is used per second of video - this is usually expressed in kilobits per second (Kbps = 1000 bits/second) or megabits per second (Mbps = 1000Kbps = 1,000,000 bits/second ).

File Size is just the total size of your video, and will generally be expressed in megabytes. The final file size of a video can be calculated by multiplying the total number of seconds in your video by the data rate.

File Size = Data Rate X Length of Video (in seconds)

From the viewer's perspective, file size is less important than 'data rate'. If your data rate is lower than the bandwidth of your viewer's connection, the viewer will not have to wait for the entire video to download - it will 'stream' from the server and play in real time as it downloads. If the data rate of your file exceeds the viewer's connection speed they will have to wait before they can watch your video - how long they will have to wait depends upon their connection speed and the length of the video.

On the server side, both data rate and file size are concerns. The data rate affects how many people can download the video simultaneously before the server's connection speed is exceeded and things start slowing down for everyone. File size is also a concern because it will effect the total bandwidth used based on the number of downloads - most hosting plans have a limit on daily or monthly bandwidth usage, and exceeding that limit can be costly (if you have to pay for the overage) or result in your file/site going offline. File size may also affect the number of videos you can store on your server based on the storage capacity of your hosting plan.

Server bandwidth usage is hard to predict because it's highly dependent upon the popularity of your video - the number of downloads multiplied by the file size determines your total bandwidth usage. It's also a component you have some control over - you can buy more bandwidth & storage if necessary to accommodate a very popular video. Viewer bandwidth, on the other hand, is something you don't have any control over, so it's usually the starting point for determining your compression settings. Because of this I'll discuss server bandwidth issues more in a future article - for now we'll concentrate on viewer bandwidth.

Ultimately, you can make your video as small or large as you like via compression. However, if you make it too large your viewers won't wait around for it to download, and if you make it too small the quality will be so bad it won't be worth their time to watch it. Ideally you want to match your data rate to their bandwidth so that you maximize the video quality while minimizing download times. What this means is that it's usually worth making several versions of your video for delivery online - smaller, lower bandwidth versions for people with slow connections, larger & higher quality versions for those with faster connections, and maybe even a very high quality version for those who are willing to wait for the highest quality.