Compression Tips For The Web

One of the many new disciplines editors have to know is how to properly compress and encode video for presentations on the Internet or as part of CD-ROMs. Often this may be for demo reels or client approval copies, but it could also be for final presentations within PowerPoint, Director or another presentation application. The objective is to get the encoded program down to the smallest file size yet maintain as much of the original quality as possible.

 

Everyone has their own pet software or player format to recommend, but the truth of the matter is that it is unlikely that you will encode your video into a format that absolutely everyone can read without the need to download an additional player that they might have to install. The most common player formats include QuickTime, Windows Media, Real Player, Flash and the embedded media player that AOL bundles into their own software. Within each of these, there are also codec and size options that vary depending on how current a version you are targeting.

 

Modern formats, such as MPEG 4, Windows Media 9, QuickTime with Sorenson 3 and others may look great, but they frequently only run on the newest versions of these players. If your client has an older Windows 98 PC or an OS 9 Mac, it’s doubtful that they can play the latest and greatest software. You should also be aware that not all encoded results are equal. Some formats look awesome at standard medium-to-large video sizes, but don’t look good at all when you get down to a really small window size. The opposite is also true. Here are some guidelines that will let you target the largest possible audience.

 

Size and frame rate

 

The first thing to tackle when encoding for the web is the image size and frame rate. Standard definition video is 720 x 486 (480 for DV) pixels (rectangular aspect), which equates to a web size of 640 x 480 pixels (square aspect). This is considered a “large” window size for most web pages. Scaling the image down reduces the file size, so commonly used smaller sizes are 320 x 240 (“medium”), 192 x 144 and 160 x 120 (“small”). These sizes aren’t absolute. For instance, if your finished program is letterboxed, why waste file size on the black top and bottom bars? If your encoding software permits cropping, you could export these files in other sizes, such as 300 x 200 or 160 x 90 pixels. Another way to reduce the file size is to reduce the frame rate. Video runs at 29.97 fps but due to the progressive display and refresh rates of computer CRTs and flat panels, there is often little harm done in cutting this down to 15 fps or sometimes even 10 fps or lower.

 

Reducing the image size and frame rate is a matter of juggling the reduction of file size with playback that is still easily viewed and doesn’t lose the message you are trying to convey. If you are encoding for a CD-ROM instead of the web, then size is less of an issue. Here you may wish to maintain the full frame rate (29.97) so that your motion stays fluid, as long as most CPU speeds can support the size and rate you choose. For instance, a 320 x 240 file should play fine on most machines with a 200 MHz or faster CPU; however, if this same file is playing back from within another application, like an HTML page displayed in a web browser or PowerPoint, some CPU overhead will be lost to this host program. This means that the same file which plays fine outside of the host application, might tend to drop frames when playing back inside of another application.

 

Formats and players

 

There are a lot of conflicting opinions on this subject, but I tend to go for what is a common denominator and provides quality playback. For this reason, I tend to stick with formats like QuickTime (Photo-JPEG codec), Windows Media 7 and Real Player. MPEG 1 and 4 are supposed to be playable on nearly everything, but I haven’t found that to be true. I love the way Sorenson 3 (QuickTime) looks, but it requires QuickTime 5 or newer. If you encode in one of the previous three I mentioned, which are somewhat older, odds are that nearly any machine out there will be able to play these files or will be able to download a simple player in that format that works on a wide range of Mac and Windows PCs. Although Photo-JPEG is generally not considered a playback codec, the advance of CPU speeds lets these files play quite fluidly and the codec lends itself to controllable encoding – meaning, less voodoo to get a good image.

 

If you are putting a file up for anyone to see, like a demo reel, then you will probably have to create a version in each of these three player formats. If you are encoding for a single client and you know what they can play, then only one version is needed. As an example, a typical :30 commercial encoded with QuickTime (Photo-JPEG at about 50% quality) at a size of 320 x 240 (29.97 fps) will yield a file size of around 10 to 15MB. This is fine for approval quality, but a bit large when you multiply that for a longer demo reel on your website. Cutting down the image size and frame rate and using a lossier codec, will let you squeeze a demo reel of several minutes into that same space.

 

Interlacing and filtering

 

Interlaced video doesn’t look good on computer displays and doesn’t compress efficiently. Some programs let you export single fields only or let you apply de-interlacing filters. I recommend you use one of these options to get better results especially when there is a lot of motion. The one caveat is text. De-interlacing often trashes graphics and text, since half the visual information is tossed out. Generally, you get a better web look if your footage is based on a single-field export. Additionally, some encoding applications include noise reduction and image correction filters. I tend to stay away from these, but a touch of noise reduction won’t hurt. This will prefilter the image prior to compressing, which often results in better-looking and more efficient compression. Adding filters lengthens the encode time, so if you need a fast turnaround, you will probably want to disable any filters.

 

Constant versus variable bit-rate encoding

 

Like encoding for DVDs, many compression applications permit you to choose and adjust settings for constant (one-pass) and variable (one or two-pass) bit-rate encoding. I prefer constant bit-rate encoding because variable bit-rate often makes fades and dissolves look quite “blocky”. Constant also gives you a better look when transitioning between static graphics or frames and motion. The downside is that you will have to use a lower average rate to get comparable results in file size. Not all codecs give you this option, but when they do, it will often take a bit of trial-and-error to determine which rates look best and to decide how often to place keyframes (usually a slider in the software or a number value).

 

Audio

 

Remember that audio is a major component of your program. You can cut done your video by quite a lot, but at some point audio is taking up even more space than the video and needs to be compressed as well. Tackle this in several ways. First, change your stereo audio to a single track of mono audio. The difference is minor and often stereo channels don’t seem to encode well, introducing all sorts of phase errors. Next, drop your sampling rate. You probably edited the show using a rate of 44.1 or 48 kHz. On most programs, you can successfully drop this to 22 kHz without really affecting the sound quality heard on most computer speakers. Do not drop the bit-depth. Reducing the bit-depth from 16-bit (typical) to 8-bit will create some very undesirable audio. Finally, add compression. Most codecs include some typical audio compression schemes, which all players can decode. A compression ratio of 4:1 is common and hardly noticed.

 

Software

 

Choosing the best application to encode/compress your footage gets down to learning curve, comfort factor, speed, preference and whether you are on a Mac or PC. Not all applications give you equal quality results with the same codec, though. You can encode using the internal export functions of most NLEs or choose from a wide range of applications, including Apple QuickTime Player Pro, Apple Compressor, Discreet Cleaner, Canopus Procoder, Sorenson Squeeze, Ligos, Windows Media encoder and many others.

 

When you encode a file, you may also choose to make it streaming or downloadable. Selecting progressive encoding will make the file downloadable, which is generally what you want for a demo reel or a client approval copy. If you want to ensure that the person’s browser will permit a download, wrap the file in an archive (data compression) format like .sit or .zip using WinZip or Stuffit. This forces the viewer to either open the file or save it on their local hard drive.

 

As with most things, it helps to read the book and spend some time experimenting when you’re not under the gun. This will let you decide which codec and encoding application gives you the best results based on need and the target audience.

 

© 2004 Oliver Peters

Advertisements