4.3 Representing moving images
A moving image is simply a series of still images presented at sufficiently short time intervals that the eye smoothes over the change from one image to the next. In practice, this means the images must change at a minimum rate of around 20 per second; if the rate is lower then the moving image flickers or is jerky. Each still image that goes to make up a moving image is known as a frame.
So far as computers are concerned, moving images are of two types. One type is animations and the other is videos (also known as films or movies or video clips). The essential difference between a video and an animation is that in a video the images will have been captured by some sort of camera whereas in an animation they will have been drawn, probably with the assistance of a computer. These days the difference is becoming blurred because videos can be heavily altered by computer techniques and animations can be made to look very lifelike indeed, so animations and video can be merged into a single frame.
In Section 3.2 you saw that even as small a full-colour image as 3 inches by 2 inches can need 1.5 megabytes to represent it if it is uncompressed. At the minimum of 20 frames per second, a 5-minute video clip (300 seconds) will need 1.5 × 300 × 20 megabytes = 9000 megabytes of storage space! So compression is even more necessary here than it is for still images.
For moving pictures, a lossy compression technique called MPEG (‘em-peg’, which stands for Motion Picture Experts Group) is often used. MPEG uses methods similar to those of JPEG for each frame in the sequence, but performs further compression from one frame to the next by taking advantage of the fact that often the next frame is only slightly changed from the previous (e.g. someone has moved slightly against an unchanging background). A compressed MPEG file would therefore not include data to represent the background in the next frame (and possibly not in a few more frames as well), but would simply indicate that certain portions of the picture have not changed from one frame to the next. Further, MPEG may not include some frames at all on compression, and the decompression process would work out what these frames must have been and include them. (This is not as odd as it sounds. Often it is very easy to work out what must have happened between frames. For instance, if an object has moved a short distance then the decompression process will simply assume that the object has moved smoothly and will put it at intermediate positions in the intermediate frames.) MPEG can achieve compression ratios of as much as 50, a compression ratio that is necessary if a full-length film is to be fitted onto a DVD.
Activity 20 (Self assessment)
The digital camera you met earlier in this course can take short sequences of shots (frames) which form a very brief ‘video clip’. If the clip comprises 100 frames, the screen is 2272 pixels by 1712 pixels and 30 bits are used to represent the colour and brightness of each pixel, how many bytes would this video clip occupy if it was uncompressed? How many would it occupy if each individual frame in the clip was compressed with JPEG at a compression ratio of 20? How many would it occupy if instead MPEG was used on the whole clip, at a compression ratio of 50?
You saw in Activity 18 that a single frame requires 14 586 240 bytes. One hundred frames therefore require 1 458 624 000 bytes if they are not compressed – over 1400 megabytes or 1.4 gigabytes!
With a JPEG compression ration of 20 this requirement would be reduced to 72 931 200 bytes; with a MPEG compression ratio of 50 this requirement would be reduced to 29 172 480 bytes.
If you were thinking of emailing the video clip described in Activity 20 to a friend, you and your friend would both be very grateful indeed for compression techniques!