The Art and Science of Online Video Compression
One of the most frequent questions we get at PTV involves some aspect of video compression. That's not surprising, seeing as our software allows companies to manage and distribute online video content. It may be someone trying to encode a simple video, or wondeing why playback is not displaying properly. In an effort to provide a good primer for these types of cases by explainign the basic terms used in the compression process. Since there are a number of programs used for compression, I’m going over the basic priciples rather than how to use a particular program.
Your bandwidth determines how long it will take to download a particular file and therefor limits how quickly you will be able to start playback of the video. Today, many sites that involve online video playback provide the web visitor with different viewing options such as Hi-Speed or Low-Speed for different connection speeds. Seeing as broadband connections have widely penetrated home markets, web sites are beginning to ignore the differences and encode their video content for only a Hi-Speed version. If you are certain that your target audience will have visitors who are using dial-up access, you may want to encode your video content with a version that suit these types of slower connections. As of June 2008, over 90% of internet users were using a broadband connection (over 512kbps), so lets use that as our baseline for bandwidth.
BITRATE
The bitrate is the datarate at which the video plays back. The higher the rate, the more information is kept in the video file and therefore has the ability to attain better quality. A higher bitrate also produces larger files, uses up more bandwidth, and takes more processor power to display. The ideal situation is to find the lowest bitrate that will provide you with the quality you want. This usually involvs some trial and error.
The totla bitrate includes both audio and video (each are compressed with separate codecs). Some applications give you the option for the total bitrate, while others may give you individual options for audio and video. PTV recommends starting out with a total bitrate somewhere bteween 768KB/s and 1MB/s. If you are working with HD footage you will want to be somewhere between 1.5MB/s and 2MB/s. Once again, there is a little guess and check involved. You may find that a much lower bitrate works just fine for your video, especially if your video doesn’t involve a lot of fast motion.
FRAMERATE
Framerate is the nuber of frames displayed per second. The standard rate of most video is 30 frames per second (in reality it’s actually 29.97, but you can ignore that for now). Film is shot at 24 frames per second. Most likely you are compressing video, and if it involves a lot of fast motion you’ll probably want to keep the 30fps rate. If your video does not involve a lot of fast motion, it would help to bring the frame rate down to keep the filesize low, but not going any less than 15fps. Also, keep in mind that if your source video content file is lower than 30fps to begin with, increasing the frame rate is only going to increase the filesize with no added value.
KEYFRAMES
In order to truly compress the video file, the compressor program does not keep all the information from every frame. Instead, it only stores the differences from frame to frame. This process is not perfect, so every so often the compressor software is required to store the information of a full frame - this is a keyframe. If your video involves a lot of fast motion, you should increase your keyframe rate to make playback smoother. A pretty good starting point is having a keyframe every 3 seconds.
Most compressor programs allow you enter keyframe rate by frames. So, starting out with keyframes every 3 seconds, if you find your video is playing back at 15 frames a second, you would want to have keyframes every 45 frames.
FRAMESIZE
The frame size is the width and height of your frame in pixels, and the aspect ratio is the relationship of the video’s width to its height, in that order. Standard televsion ratio is 3:4 and the HD ratio is 16:9. So depending on what your source video is, it will fit into one of those two categories. The most important thing when it comes to frame size is to maintain the aspect ratio of your source footage (there is usually a checkbox that says “maintain aspect ratio”.
If you think that your viewing audience is going to be using full-screen mode more often than not, I recommend keeping the orginal frame size of your source video. That way when the video get blown up to full screen it still looks clear.
If your player is mostly going to sit inside of a webpage or app, I recommend compressing to the exact size that it will be displayed. This is because Flash will be able to scale up or down to fit your display size, but it will use processor speed to do this. I also find that the video always looks better if it was compressed to the actual size rather than having Flash scale it.
FIELD DOMINENCE
If the compressor app allows for it, you should deinterlace your footage, or if it asks for a preferred field dominence choose “none”. This is because most TVs have fields (upper/lower) that they switch between instead of frames. With web video, you want to turn off those fields, called interlacing, so that you see one solid frame. If you notice lines in your video, it’s probably because you need to get rid of the fields.
That covers most of the basic priciples of compression. It might be a lot to take in all at once. I can assure you that there is no one easy method and sometimes each video can present a different issue for you.Without a doubt, there is both an art and a science to online video compression.
Need more info? Feel free to contact us and we'll be happy to help you out.
Matt Sullivan, Web Developer
0 Comments
Sorry. There are currently no comments.