So you've spent months writing your script, days shooting at various locations, weeks editing every cut and transition to perfection and color grading each shot by hand, and now it's all finished. Your hard work, condensed to a few minutes of pure moving picture glory. The only thing left is to upload your feature to Vimeo. Compared to the effort exerted beforehand, in theory exporting the video should be a piece of cake. But then you export your video, and it's a blocky mess like a toddler playing with spaghetti. What happened?
Video compression is the last step before uploading your file online. As the name implies, compressing video reduces its file size. This is very important, because smaller files upload faster, save bandwidth and storage costs, and load quicker when played back. However, if video is compressed too much, the file can lose its detail, resolution, clarity, and much much more.
Let's watch this tutorial video by the knowledgable Darren Levine to get a handle on the basics of video compression. Then we'll jump into the details.
Here's how video compression works: every second of video is composed of a series of still frames (typically 24-60 frames per second). Depending on the subject, only part of the image changes from frame to frame. Instead of storing two nearly-identical frames within a video file, only the parts of the image that have changed are recorded. So if you have a friend waving to the camera, and your friend's arm is the only thing moving in the shot, the image information of your friend's arm is the only thing that is recorded. The method a computer uses to determine the amount of change between frames is called the codec.
Every couple of frames, the codec will pick a keyframe that will serve as a reference for all the frames after it. Each keyframe consists of the entire image, and the following frames base their changes off of it. It's important to select a keyframe interval that isn't too frequent, or too infrequent. If you set the interval too frequent, you'll end up with a large video file, set it too infrequent and you'll have strange ghosting artifacts. Matching your keyframe interval to your frame rate (essentially making a new keyframe once every second) is usually a good place to start, but depending on what you're shooting this may vary.
Bit rate (also known as data rate) is the amount of data that is used for each second of video. In the world of video, this is generally measured in kilobits per second (kbps). Bit rates come in two flavors: constant and variable. A constant bit rate (CBR) uses the same amount of data every second, while a variable bit rate (VBR) adjusts the amount of data used depending on the complexity of the changes between frames. Generally, a variable bit rate will produce a smaller file, using less data for less complex frames. However, if there is a lot of action going on in your video, a variable bit rate will use more data to account for more movement.
Again, you'll want to find that sweet spot between a high and low bit rate; too high and you'll have a larger file without a significant increase in quality, too low and you'll lose detail and start to see blocky areas in your video. Quality between CBR and VBR can vary, so try exporting two versions of your video using either bit rate type and see which one gives you the best quality for your video.
Check out this comparison between a clip encoded at a low bit rate vs. a high bit rate. The screenshots are taken from our Vimeo in Spanish announcement video, where the camera tilts up looking at Vimeo HQ. At a very low bit rate with a fair amount of movement, large areas of the image are grouped together and look like big chunky blocks of color.
Resolution is the actual size of your video, measured in pixels. When you're exporting your video, most of the time you'll want to match the resolution of your camera. Our Video School lesson on resolution has all the details for you.
The number of frames shown every second is called frame rate. We've covered this before in our Frame Rate vs. Shutter Speed lesson, but this time around we're talking about the frame rate of the video you export. Just like resolution, when exporting you'll want to match the frame rate of your camera, which is typically 24, 25, or 30 frames per second (fps) when it comes to video.
One thing to watch out for when exporting your video is the option for a variable frame rate. Just like variable bit rate, exporting with a variable frame rate changes the number of frames per second depending on the amount of movement in your video. While theoretically this can save space, not all programs or websites can play back variable frame rate videos, and the audio can fall out-of-sync. To play it safe, stick with a constant frame rate.
What settings you use overall depends on where your video is ultimately going. Videos that will be uploaded to Vimeo should use the settings recommended on our Compression Guidelines page. If you're exporting a rough cut for a director, maybe a low bit rate, low resolution video is best. Videos going to Blu-Ray should have the highest quality possible. Always keep the final location of your video in mind when choosing your export settings.
Remember: don't let the pressure of compression get to you. Stay cool, keep your file sizes reasonable, and may your playback be buttery smooth.