HOW-TO, Techniques, & Best Practices Channel

Compression for the Portable Media World: Shooting for the Internet and Compressing Video

By Chris Cavallari
posted May 13, 2009, 15:12

Chris Cavallari has been working in television, video, and film for 11 years as a cameraman, lighting director, video editor, and grip. By day, he is the Lead Television Studio Technician for an Internet Webcast TV Network; by night, he writes and directs films and podcasts for his company Filmosity Productions, produces the podcast, �The Martini Shot: Moviemaking for Beginners,� and runs the New Jersey Podcasters Association. His website is www.filmosity.com.

Have you noticed? Media is converging. I know, it�s craziness. Internet, TV, radio, magazines, books� They�re all coming together in one big audio/visual mash-up. What�s great about this convergence is that almost any piece of information can be packed up and taken with you anywhere you go. Listen to songs on your mobile phone, watch video on your iPod, or read a book on your PDA. What this also means to content producers is that they�ll have to think about where their piece of information might go and how it will get there. In essence, your video needs a place to live and a new set of clothes.

The Internet has opened a lot of doors for filmmakers, creating an equal playing field that continues to change the face of video production. With attention spans becoming shorter by the minute, it becomes that much more important to have good quality images when posting video to the Internet. Most Internet customers in the U.S. have broadband Internet available to them, but download speeds and broadband bandwidth can limit how good a video image can be. That's where solid video compression techniques become important. Using the right codec for the job can mean the difference between beautiful vistas or blocky, blurry chunks of color.

Pre-Production Planning

I�ve said it before and I�ll say it again: Planning is key. Online video can be tricky and finicky at best. No matter how good the codecs become (n.b., codec = compression/decompression), they still can�t match what you see on your television. This is because Internet bandwidth still is not big enough to get that much information to you in a reasonable amount of time. The pipeline is getting bigger and better each year, but it�s still not there. In the meantime, compression allows for decent quality video to be shown on the Internet while keeping file sizes to a minimum. In recent years, companies like Microsoft and Apple have developed codecsuse complex mathematical algorithms to estimate what even the smallest pixel should look like on the screen, and to predict where that pixel and the ones next to it should go next. This predictive technology allows for complex imagery to be shown more closely to the original image. Of course, there are several playback formats and dozens of codecs that all work with different algorithms to recreate the image. With such a large number of choices, it becomes necessary to decide from the beginning how the piece will be shown.

Final Cut Pro works natively in the Quicktime video file format. Most DV footage is captured at 25Mbps and converted to a Quicktime file which is stored on the hard drive. At this point, the DV footage has already been compressed in camera when it was printed to tape, but even that bit rate is too high for streaming or downloading from the Internet. FCP works best when exporting video in its native Quicktime format. Under this format lie several basic and many more complex video codecs. Looking in the Quicktime export settings, the codec drop down menu shows a long list of codecs from which to choose. Some are better than others, and each one has a different purpose. For instance, the Animation codec uses a special algorithm designed for animation and compositing. It may be best to take a clip of video footage that will resemble your final product and test that with the different codecs to see which works best for you. In this case, however, we�ve decided to deal with the MPEG4 format (a sibling of Quicktime) using the H.264 codec. But before we start exporting, let�s look at how we should be shooting our video.

Shooting for the Internet

Compressing for the Internet is inherently bad for video. No matter how you slice it, you�ll have to make some sacrifice of image quality for file size because for the most part, viewers just don�t want to sit around for hours upon hours downloading a huge video clip. They want it, and they want it NOW! As a conscientious filmmaker, you�ll already have a plan in motion for minimizing the amount of compression that takes place on your video while keeping the file size as small as possible.

One key factor to keep in mind when shooting is the more motion that appears in frame, the more compression that will have to take place on that sequence, and the worse off your image will be. This is not to say that you should have a �talking head� for the duration of your film, but keeping much of the herky-jerky, handheld motion to a minimum will go a long way to a better image. Use a tripod when you can, and keep your pans and tilts smooth and slow. Make sure your subject is properly lit to make it easier to see. Avoid complex backgrounds, crazy colors, and high contrast lighting situations, as this takes more processing power and results in more artifacting. Think about shooting your program in segments that can be downloaded separately.

What is compression?

Most files available online, especially audio and video, are compressed. When an audio or video file is created on your computer, it is generally very large in size, in order to accommodate the large amount of data required for a good sound or picture. You see compression in action each time you download a web page with images on it; JPEGs, GIFs, PNGs, and so on. Each of these files are compressed images using mathematical algorithms that take the image information and combine, rearrange, and interpolate said information, thereby making the file smaller. The entire Internet essentially runs on this basic principle. When dealing with portablemedia like cell phones, iPods, and PDAs, the same principle is applied. Bandwidth on these devices is even smaller than that of a standard web browser running on your computer, so compression is an essential tool. Video is an exceptionally large bandwidth hog because of the amount of data that flows through the file.

Think of it this way: You have an uncompressed RAW image that is 1000 kilobytes in size (1000Kb = 1Mb). Multiply that 1000Kb thirty times per second to get 30,000kb per second. So, in a five minute video, you�d end up with a 9,000,000kb file. That�s 9000 Megabytes. That�s a pretty big file to be uploading to your server and then serving out to viewers. Now, imagine pumping that out to 100 people. That�d be 90 GIGABYTES for just that one file. If you�re going to be producing a lot of video and serving it up to a lot of people, that adds up really quickly, and you�ll pay for it with bandwidth costs. It quickly becomes clear why compression is so important in the portable and online media worlds. Without it, your bandwidth bill would pile up really, really fast.

Exporting from the timeline in FCP

There are many different ways to compress video, and which one you use depends a lot on where you intend your video to play.

Let�s assume that the video to be compressed is completely edited and ready to be exported in Final Cut Pro (bear in mind that most of the following settings can be used in other editors like Avid, and other compression software like Sorenson Squeeze). We�ll also assume that you�ve followed the shooting tips from above and kept crazy motion and animations to a minimum; it�s now time to decide what format and codec to use. In Final Cut Pro 4.5 HD, click on File --> Export. In this menu, you�ll find several options for exporting your video. Click on �Using Quicktime Conversion.� A dialog box appears asking you for a file name and location to save it. Type in your file name, but before you click �OK,� let�s make some changes to the settings.

In the pull down menu labeled �Format,� make sure QuickTime Movie is selected. Then click on the �Options...� button next to the menu. This will open another dialog box with a variety of settings. Make sure the checkbox next to the �Video� area is selected, then click on the �Settings...� button. Yet another window pops up. This is where the real work happens. A year or so ago, Apple came out with a new codec called H.264. This codec was hailed as quite an accomplishment for it�s capability to compress even high bit rate video with the least amount of artifacting yet. Under the �Compression Type� pulldown menu, select H.264. In the �Motion� data box, you can choose to eitherkeep your current frame rate, or change it. A good idea is to bring the rate down to something like 15fps. This literally halves the number of frames the codec has to render and will cut down on file size dramatically. Of course, the video will look a bit choppy, but it will be acceptable for the Internet. If you�re willing to accept a larger file size, use a higher frame rate. Under the �Key Frames� heading, select Automatic, unless you know how many keyframes you want the compressor to use. This setting takes a real frame of video from the shot and uses it as a baseline for interpolating, or redrawing, the other frames around it. Check the �Frame Reordering� box to allow for better interpolation.

Under the �Data Rate� heading, you have two choices: Automatic, or Restrict to X kbits/second. Choosing Automatic will automatically choose an optimal bitrate for the piece. If you choose the �Restrict to� setting, you can choose your own bitrate. Keep in mind our calculations above when using this setting; the higher the bitrate, the bigger the file size. Now, under the �Compressor� heading, select your quality by using the slider. High is usually a good setting. Then, next to the �Encoding� heading, choose one of the two radio buttons: Best Quality, in which the codec passes over the video twice, giving a better encode but taking longer to render; or Faster Encode, which does the compression in a single pass, but results in lesser quality video. Click �OK.� Now, in the �Movie Settings� dialog that remains, under the �Sounds� heading, make sure the settings tell you that you�re using uncompressed audio at a sample rate of 44.1kHz and a sample size of 16. This gives you the best quality audio, and since audio takes up very little of the compressed stream, it�s best to keep it uncompressed.

If you�re planning to put this video online, these settings work best. The final step here is to check the box that says�Prepare for Internet Streaming� and use the �Fast Start� setting from the pull down menu. This puts some information in the movie file that tells the QuickTime player to start playing the movie as soon as it has downloaded enough of the file to the user�s computer that it can play uninterrupted. Click �OK,� find a place to save the file, click �Save,� and you�re done!

Other Methods

There are actually several other ways to compress video for online and portable media. Each one has it�s advantages, disadvantages, and quirks. Whether you�re using an Avid and compressing with Sorenson Squeeze, you�re cutting on Final Cut Pro and using it�s wealth of compressing options, or you�re platform independent and compressing with Quicktime Pro, you have several options for making your video work on a number of portable devices.

This article may not be reprinted in print or internet publications without express permission of StudentFilmmakers.com.

Check out this article in the January 2007 print edition of StudentFilmmakers magazine, page 42.