Concept of Video Compressing
Posted: Tue, 16th Feb 2010, 7:51am
Post 1 of 5
Out of simple curiosity, I would like to know how a film is able to be compressed without losing quality. I just finished compressing a film which was originally 500 MB and is now 168 MB, yet I see no difference in the quality of the film. How is a video able to be made smaller without losing quality? More or less, what's the catch?
Posted: Tue, 16th Feb 2010, 8:20am
Post 2 of 5
Its more difficult to describe without pictures, but there is a very nice explanation in the book "The Art & Science of Digital Compositing", by Ron Brinkmann.
In uncompressed footage, each pixel of each frame must have a color value recorded for it. So if you have a frame of video in DV resolution, and the frame is entirely black, the data for the first line of pixels would be something like:
003:0,0,0 all the way up to the 720th pixel being 720:0,0,0. This is a total of 4,320 digits, just to record the color data of the first line. For a complete frame of 480 lines, this ends up being over 2 million digits.
Its fairly straightforward, in this case, to compress the first line to
001-720:0,0,0 and compress 4,320 digits into 9 digits, without any actual color info being modified. You still have lossless compression.
This is an extreme case for the sake of demonstrating the principle, but by combining adjacent pixels of a single color into a group when recording the color data, significant reduction of file sizes can occur without losing any quality whatsoever. Some codecs will also use averaging of colors to identify areas that can be compressed together.
Since video is made up of lots of frames in a sequence the second common principle is to group pixels in a similar fashion, only over the course of frames. So if one pixel is pure green for the first 29 frames of a clip, its info could be recorded:
001: (fr1-29) 0,255,0
These are the two most basic methods, and also the only two that I really understand. Hopefully my explanation is understandable to you. Like I mentioned, if you have charts or pictures it helps, and the book I recommended at the beginning is worth checking out for many many reasons, not just for its excellent explanation of compression.
Posted: Tue, 16th Feb 2010, 8:38am
Post 3 of 5
While there are lossless methods of compression, most video compression does have a significant impact on quality (you just might not be able to tell that easily). You can compress a 17GB MiniDV file (about the length of a feature film) down to 700MB with H.264 and still have an entirely watchable movie (although the quality will drop).
Posted: Tue, 16th Feb 2010, 3:05pm
Post 4 of 5
TO think I've used this method for years and never really understood how it was done.... +1
Posted: Tue, 16th Feb 2010, 5:10pm
Post 5 of 5
Indeed, as schwar mentioned, the far majority of codecs aren't actually lossless, even if you don't notice the degradation in quality. They seek for a balance of reducing quality while still keeping the results imperceptible, and modern codecs can do a very good job, using some seriously complex algorithms. A lot of the information can be discarded once without its loss being noticed. Its when you take this same footage, which appears to be high quality, and try to process it or convert it again, that the missing data really has an impact, and quality loss becomes apparent. Which is why mpeg codecs and things like h.264 are not good codecs for editing.
Since most video is kept in YUV colorspace, not RGB, many lossy codecs will discard some color data in favor of retaining brightness and contrast info from the Y channel. This takes advantage of the fact that the human eye is far more sensitive to brightness than it is to color. It is fairly common for dv codecs, and other video codecs as well, to store only one chrominance sample for every 4 luminance samples (thus we have 4:1:1 or 4:2:0) sampling), which obviously saves space, but eliminates color data that can never be retrieved. The fact is, DV cameras do this while recording, so a good portion of your color data is never even captured, in favor of reducing file sizes. With many recent HD cameras, which are recording to MPEG or H.264 variants, the amount of discarded info is vastly higher still.