CPUs, Motherboards & RAM
Graphics Cards
Peripherals
Modding & Cooling
Systems
Networking
Security
Operating Systems
PC Games
Console Games
Atomic.edu
Tutorials
Lifestyle
Entertainment
Science
Merchandise
Wallpapers
Revolver Melbourne 2011
Revolver Sydney 2011
Atomic Unlocked 2010
Power to the PC Tour 2010
Industry Events
Login
|
Register
|
RSS
News
|
Reviews
|
Features
|
Podcasts
|
Opinions
|
Galleries
|
Videos
|
Competitions
|
Newsletter
|
Subscribe
Saturday February 11, 2012 10:18 AM AEST
Atomic MPC
>
Features
>
Geek
>
Science
>
Everything you ever wanted to know about video codecs.
Science
Everything you ever wanted to know about video codecs.
By
David Field
17:00 Jun 6, 2007
Tags:
video
|
codecs
|
codec
|
x264
|
xvid
|
h264
|
wmv
|
cinepak
|
multimedia
|
divx
|
mayo
|
MPEG
|
how
|
works
Tweet
Comment Now
«
1 - What we're dealing with here
2 - MPEGmatics
3 - Meet The Codecs
4 - 28 billion images later
»
Related Articles
HD7970 vs GTX 780: the future of graphics cards in 2012
Classical music in video games - 12 of the best for your listening pleasure
ASUS' MARS II GTX 580 SLI about as fast as it gets
Max Payne 3: Design and Technology video showcase
The
Moving Picture Experts Group
, or MPEG, is easily the biggest player in the lossy video codec game. It’s been around for the last 18 years, has a lot of imitators and a legacy of codecs used in all facets of the industry. MPEG-1 drove VCDs. MPEG-2 drove DVDs. If it hasn’t already, MP3 should win the award for the most publicly recognisable IT acronym in the world.
The
MPEG-4 specification
is more of a container standard than a codec. It’s comprised of 23 parts, not all of which are dedicated to video. Part 2 is the standard video codec – the same compression scheme that both DivX and XviD are based on. Part 10 is a more advanced video codec – known formally as H.264/MPEG-4 AVC. H.264 is one of the three codecs that drives both HD-DVD and Blu-ray.
Aside from throwing away half the colour information from a high quality master to save space, codecs (MPEG-based and others) use other techniques to approximate data from a video file before compressing it. Here are the most common techniques:
Spatial compression
Using a technique similar to that of JPEG to compress still images, the size of a single image can be reduced. This does reduce the image size, but not greatly, mostly relegating spatial compression to the domain of lossless codecs. It still serves a fairly major purpose in the process of lossy encoding though, as you’re about to find out.
Temporal compression
Apart from some epilepsy-inducing Japanese music clips, all video is continuous. From one frame to the next, most of the detail stays the same: Think of the background, the walls or, if he’s been cast, Keanu Reeves’ expression. Why waste precious storage space to store tens of thousands of images of Keanu Reeves if he looks exactly the same in 90 percent of them?
This is exactly what temporal compression does. A keyframe (known in the MPEG world as an I-frame) that contains all the important data is drawn, and in the following frames whatever doesn’t change is left out and filled in with data from the keyframe. Temporal compression literally means compression in time (as opposed to spatial compression, which is literally compression in space) and it can slice away massive amounts of data.
Keyframes are reference points in a movie made of a spatially compressed image that is used by subsequent frames to fill in parts of the image that stay the same from frame to frame, letting them be replicated instead of repeatedly encoded. As such, the best position for a keyframe in a sequence is when the sequence suddenly changes, such as a cut between a dim indoor game of cards and an outdoor shot of a car about to run into the house where said game is being played.
Motion compensation
Temporal compression has some limits, in that it doesn’t deal with camera pans very well. When an object moves from one location in a frame to another, the scene has to be updated even if the element itself doesn’t change. MPEG-2 introduced motion compensation, which uses vectors to push static elements around a frame in time instead of redrawing them.
Motion compensation and temporal compression are the keys to reducing data, and the reason why when you jump to a point in a video on an old machine it takes a second to play. The codec has to render the keyframe first then recreate all the frames between it, as well as the frame you requested.
Discrete Cosine Transformation
Although you’ll need a degree in computer science to fully understand it, the DCT is the heart of a lossy encoder. In short, it’s a process of approximating numbers with a degree of accuracy. During an encode, every number in a series is simply halved and the remainders thrown away. When it comes time to decode, they are doubled, resulting in values that closely resemble the original.
The technique works better on bright areas than dark ones, which is why compressed blacks don’t always look as smooth as their non-compressed counterparts, although codecs can control this.
Macroblocks
It’s inefficient, especially when video is stored in a YCrCb colour space, to refer to each pixel individually. Macroblocks are groups of (usually) 8 x 8 pixels that have their values converted to a formula. Because neighbouring pixels normally look very similar, the formula determines the average brightness of the pixels and how they change relative to the average value of the macroblock.
The quantisation matrix
Here’s another tricky concept deeply rooted in hardcore mathematics. Think of a quantisation matrix as a palette of values that controls how the pixels in a macroblock are converted from pixels to a formula. Modifying it modifies the way pixel information is thrown away.
Multipass encoding & variable bitrates
Thanks to the world of audio codecs, you should already be familiar with the concept of variable bitrates. In short, they let you open the bandwidth taps during the more visually intensive scenes and use less bandwidth for the more placid scenes.
Multipass encoding is an extension of this; it lets the codec plot where to position keyframes and how to allocate its bandwidth resources as the footage progresses.
«
1 - What we're dealing with here
2 - MPEGmatics
3 - Meet The Codecs
4 - 28 billion images later
»
This article appeared in the
June, 2007
issue of Atomic.
Behind the scenes with Mass Effect 3! GTX 560 VGA round-up! Essential Skyrim tweaks to improve your game! Plus reviews, news, hardware, more games, and easy to following modding guides for PC builders. ON SALE NOW!
Purchase your copy now - only $8.95 including postage
Subscribe to our digital version - only $49.95 a year
Email this
Print this
Tweet this
Send us your tips
Ads by Google
You must be a registered member of Atomic to post a comment.
Click here to login
|
Click here to register
Five things that could kill Mass Effect 3
Creation Kit and Steam Workshop for Skyrim go live, Texture Pack released
The Darkness
HD7970 vs GTX 780: the future of graphics cards in 2012
PS3 pwns retail, while Xbox also... pwns... huh?
Powered by Disqus
Latest Competitions
Thermaltake kicks off your gaming year with a BANG
Thermaltake has started off the new year with a bang by giving away a Tt eSport Theron Laser mouse to not one or two, but TWENTY lucky Atomicans!
Atomic Magazine
Issue:
133
|
February, 2012
Atomic
is a magazine aimed squarely at computer enthusiasts, gamers, and serious PC upgraders.
Every month we bring you the latest reviews of new technology and PC components, in depth features on everything from overclocking to console hacking, and gaming previews and interviews.
What's in this issue?
Subscribe Now
Buy this issue
Digital Version
Latest Comments
Powered by Disqus
Latest User Reviews
90%
Battlefield 3 is the new benchmark online FPS
A very fun and realistic multiplayer ride.
By
Periander
|
10:59 Nov 20, 2011
90%
Antec Kuhler 920 - liquid cool
Antec Kuhler 920 silent but effientive out of the box no maintence water cooling kit
By
mattleyland
|
14:23 Oct 28, 2011
90%
Antec's Lanboy Air - our new favourite case
Antec Lan boy Air in red a very cool design
By
mattleyland
|
12:55 Oct 28, 2011
90%
Antec's Lanboy Air - our new favourite case
This product overall is awesome.
By
Provodnik14
|
10:43 Oct 16, 2011
90%
MSI's GT780 laptop as fast as it gets
Nice laptop
By
daryl.cheshire
|
00:53 Oct 4, 2011
more user reviews »
Get the February, 2012 issue of
Atomic
mailed to you for
$8.95
, including postage.
Buy now
Digital Version
Please enable JavaScript to view the
comments powered by Disqus.