The Nuts & Bolts of MPEG Compression
Without video compression, we wouldnt have video streaming
over the Internet. We wouldnt have HDTV, and we wouldnt
have DVDs. All three use some form of video compression.
In theory, in order to compress a file you have to discard information.
This is true for video files too. However, if we begin to throw
out frames, the video gets choppy until finally its nothing
more than a slideshow. With video compression, rather than throwing
out entire frames of information, the compression throws out parts
of frames.
A good example of this is a video shot of a news reporter. He stands
in front of the camera and talks. He moves only slightly. If the
background doesnt move, why not keep the background from the
first frame and discard the background each frame after that? Thats
exactly what the video compression MPEG does, and the technology
in the past five years has made compression so powerful that we
can digitally transmit an entire movie in real-time over cable TV
wiring.
THE FRAME GAME
I Frames - Mpeg begins by selecting a reference frame,
called the I frame. This frame is complete without any missing data.
This frame is the frame that the following P frames will be based
on.
P Frames P frames (or predicted frames) contain
only the difference between themselves and the previous P frame
or I frame. The P frame cuts out anything that remained the same
from the previous frame.
B Frames B frames (or bidirectional frames)
contain the difference between themselves and both frames on either
side of themselves. B frames are not used in all MPEG algorithms
because both decoder and encoder require more RAM to operate.
THE GOP
Now that we understand the different frames and how they are made
to save space when it comes to storage, we need to look at the item
that ties them all together, the GOP structure. GOP stands for Group
Of Pictures, which is what video essentially is. The GOP structure
tells the encoder and decoder how the MPEG file is laid out. A typical
GOP structure would look like this:
IPPPPPPPPPPPIPPPPPPPPPPPIPPPPPPPPPPP
The above indicates that for every I frame, you have an additional
eleven P frames before getting to the next I frame. The more P frames
you have between the I frames, the less accurate frame to frame
calculations become and viola
.you have artifacts, which we
will explain in a moment.
Going a step deeper into the building blocks of each frame, we
have the macroblock. A macroblock is a collection of pixels or PELs
(picture elements). The pixels in the block are compressed and then
the motion of the block is predicted based on the I, P or B frames.
Ever watch a football game on digital cable during a play where
the camera zooms past the crowd? If you watch very carefully, youll
sometimes see people distort and become blocky for a frame or two.
Bingo! Artifacts.
While this tech tip probably wont resurface your hard drive
or help you configure an all-new network topography, it gives you
a pretty good idea when you watch a DVD or a video file streaming
off the web, that theres a whole lot more going on in the
background than you may have thought of.
Disclaimer - The Micro 2000 Tech Tip is a free service
providing information only. While we use reasonable care to see
that this information is correct, we do not guarantee it for accuracy,
completeness or fitness for a particular purpose. Micro 2000, Inc.
shall not be liable for damages of any kind in connection with the
use or misuse of this information.
|