Big Transformation in Video changing from Analog to Digital with many formats, what are the most Popular? CODEC
GIUSEPPE PANZA
Electrical / Power Electronics / System Engineering/MSc Electronics Engineering
Previous article: INTRO to Digital Video Formats
"The Most Popular Video Formats are Compressed, and then Decompressed on the final destination a device that interact with humans. The main reason is that a raw video file can be extremely large. This can make it impractical for storage or streaming. However, a video CODEC compresses this data by removing redundant or unnecessary information to reduce the file size. Then during playback, the CODEC reverses this process."
CODEC explained without Mathematic
Let us create a litle example to explain in simple term what is a CODEC. The following Image it is going to be digitized in a format with a 1.85∶1 aspect ratio, for instance 185 x 100 = 18500 pixels. With a RGB format, typical Pixel for a RGB Image with 24 bits resolution = 8 bits for Red, 8 bits for Green, 8 bits for Blue. See the following figure:
Now let us assume that every pixel will require 3 bytes of 8 bits each. Then Image total bytes (8 bits) for the above image will be 140 x 100 x 3 = 55,000 bytes. That will be the file size for one frame without considering additional overhead for format selected. CODEC will reduce or compress this file to small size keeping all the basic information that will be used to decompress it at the destination without losing information. Let us assume an imaginary Compression algorithm: that include the following information:
Image Size:
Frame per second:
Frame Start
Row # First Pixel Info, The Next Pixel where the info Change and so on.
Frame Start
Row # First Pixel Info, The Next Pixel where the info Change and so on.
End file.
For instance if this is apply to the image above: in this example considering rows 1, 2, 3, 10, 16, 26, 90 and 100. Same can be done for all the rows (exercise for the readers)
Image Size: 18500 = two bytes 4844H
Row 1: First Pixel = White= 3 bytes =FFFFFFH (because the whole row is white no need for additional info. 01H 01H FFH FFH FFH Total bytes required 5
Row 2: Same as the first Raw: 02H 01H FFH FFH FFH Total bytes required 5
领英推荐
Row 3: 03H 01H FFH FFH FFH Total bytes required 5
Row 10: first pixel white: FFFFH until column 72=48H; next pixel will be gray: A6A6A6H only one pixel the rest of pixels white: FFFFH until the end
0AH 01H FFH FFH FFH 48H A6H A6H A6H 47H FFH FFH FFH total bytes 13 (no compressed = 560 bytes )
Row 16: first pixel white:FFFFH until column 34=22H; change to green:33CC33H until column 37:25H then white:FFFFH until column 50:32H then change gray:A6A6A6H until column 98:62H the change to white:FFFFH
10H 01H FFH FFH FFH 23H 33H CCH 33H 26H FFH FFH FFH 33H 33H CCH 33H 63H A6H A6H A6H total bytes: 21
Row 24 : 18H 01H FFH FFH FFH 46H A6H A6H A6H 47H FFH FFH FFH total bytes required 13 (no compressed = 560 bytes )
Row 90: 19H 01H FFH FFH FFH 46H A6H A6H A6H 49H FFH FFH FFH total bytes required 13
Row 100: 1AH 01H FFH FFH FFH 45H A6H A6H A6H 4AH FFH FFH FFH total bytes required 13
and so on, let us assume the the average numbers of byte for row is 20 bytes x 140 columns = the total for the image is 2,800 instead of 55,000
Conclusion: only save the position and color of the pixel that change. And the differences between frames
The decompression section apply the reverse method to reconstruct the full image.
Now imagine that a video is a sequence of images or frames such as 30 frame per seconds: If you recorded a video with the same image for 1 minutes, the video file without compression will be:
55,000 bytes per image (frame). x 30 (frames per sec) x 60 (sec per minutes)= 99,000,000 bytes the compressed file will be 2800 x 30 x 60 = 5,040,000. instead 99,000,000.
Compression Ratio: Compressed Image/Original Image: 5,040,000/99,000,000 = 0.051
All the frames are identical, therefore only need to save one frame for one minute of video: 2800 Bytes instead. This is without considering overhead information: frame per second, video duration, etc.
Compression Ratio: Compressed Image/Original Image: 2,800/99,000,000 = 0.0000293
Next Article: Mathematical Method for Image Processing