![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Video Compression basics => Key frames This page is very graphically intensive. If you have a dialup connection you may want to go to lunch now and perhaps the page will be loaded when you come back. As we mentioned earlier, video compression often uses the removal of redundant pixels as a vehicle for reducing data size.
If we convert the above GIF to an AVI it will be very small but it won't load into most editors and Windows Media Player will fail when trying to fast forward since there is only one key frame. We could of course partially solve that problem by adding the first frame as frame 30 and then setting frame 30 as another key frame but fast forward would move to the end and fast rewind to the beginning. You may be asking yourself why a tutorial would be showing you how to create a movie that crashes everything that tries to load it. The answer is to show you how easy it is to do and to point out how important key frames are to the software that plays or edits your movies. Without a key frame at every scene change and at reasonably spaced intervals, the player or editor has to load all the frames just to get a complete picture. Similar to the above illustrations, MPEG movies use 16 pixel x by 16 pixel data squares then removes "generally" redundant squares instead of redundant pixels. The below left image represents one 256 pixel square in the center of the below right image.
The technique of removing generally redundant squares produces very high compression. As you might imagine in a scene where only the faces of two people talking to each other only those squares around the speaker's mouth would need to be copied to the next frame. However, since only the changed squares are carried from one frame to the next you don't have a complete picture so a key frame that contains all the data is inserted periodically. Let's try to examine this another way. If we select frame 5 in a movie that has no key frames we must also load frame 1, 2, 3, and 4 then stack all the squares to create frame 5. The problem here is that without key frames you can't select the exact point from which to watch the movie. That is, you can't watch half a movie and then come back later and simply fast forward to the last frame you saw because there's no reference point to key on.
The top row of the images above represents frames 1 through 5 in an uncompressed AVI file. Notice how each frame is a complete picture. The next row represent the same frames from an MPEG file. As you can see, frames 1 and 5 are Key frames showing a complete picture, but frames 2, 3, and 4 contain only the bits of information (delta frames) that are different from the previous. A key frame should be added every few seconds (typically 5 to 10 seconds) and when a scene changes in order to track the position of the movie. In MPEG encoding key frames are called I-Frames or Intra-frames while half-frames which contain the formula to reconstruct missing frames from the differences are called B-frames (backward frames - behind the keys) and P-frames (predicted frames - preceding the key). Because key frames are full pictures they obviously hold much more information than partial frames so the ore key frames, the bigger the movie. Keep in mind that when you split an MPEG file between key frames video for windows players will not be able to reconstruct the movie frames until they reach the next key frame.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||