HTML and CSS Reference
Figure 7-5. I, P, and B frames of compression
It's interesting that compression technology dictates the overall quality and size of the encoded file; people often
get concerned about the size of the video, but really it's the size plus the duration. For example, if you have a 6MB file
and the duration of the video is 1 minute, that means you have 1MB of data per every 10 seconds of video. If you have
a 60MB file for 1 minute of video, you'd have 10MB of data per every 10 seconds, or 1MB per second. So, you need
to find a good trade-off between size and duration of your video. Some machines and decoders are simply not fast
enough to decode the videos frames at such a quick rate. Often you will see a machine choke on playback if the data
rate is too high to process; others with enough power will handle it no problem and provide amazing playback quality.
This is also why higher-end graphics cards are used for professional video-editing bays in order to handle the heavy
data rate. However, for the Web and HTML5 video, keep a good relationship between size and duration, especially
when delivering to devices such as phones and tablets with slower system resources than desktop machines.
The Rule of 16
One last note to touch on in regard to video transcoding is what is known at the “rule of 16.” If you haven't already, you'll
find a lot of your time when creating video for the Web dealing with different-sized video assets and needing to transcode
to different sizes. I mentioned before that there is a certain science to the world of video encoding, and no one is better
at that science than video expert Robert Reinhardt. Reinhardt was first to my knowledge to coin the name of this rule.
Basically, at a high level, it breaks down the optimal sizes that videos should be converted to when a transcoding job is
performed and when a video is decoded by a machine for playback. If you take a look at Figure 7-6 , you'll notice that
video encoding is best done in multiples of 16 with a decrease in quality going to 8 (better) and 4 (good).