A Brief Dive into Video Compression — -Part 1: RGB

Derek Prestegard
3 min readSep 5, 2018

--

I’ve always enjoyed video. In particular, I’m often drawn to the magic of compression.

Just how effective is it? When contemplating this (and many other things), I find it’s helpful to start from the end result and work backwards.

At the very end of the image pipeline, your phone / computer / TV / other display creates images by combining red, green, and blue light. There are different ways to do this (LCD, OLED, Plasma, CRT, etc…), but at the end of the day we’re dealing with red green and blue — hence “RGB”.

Note how mixing all 3 colors makes white, and no colors makes black. https://commons.wikimedia.org/wiki/File:AdditiveColor.svg
RGB components in an LCD. https://commons.wikimedia.org/wiki/File:RGB_pixels.jpg

At the beginning of the pipeline, we also use RGB to capture images with camera sensors (and use RGB to render CGI). Hence, the beginning and the end of the image pipeline is generally RGB. However, in this world with no compression, RGB is quite large.

How large is it?

Thankfully this is pretty easy to calculate. For a simple example, we will use so-called “8 bit video”. HOLD UP, don’t abandon hope at the first sign of technobabble. Skip the below if you don’t want to math.

We call it “8 bit video” because each of the RGB components of each dot on your display (a pixel) is resented digitally with 8 bits. Sometimes we use 10, 12, or even 16 bits per component, but we’ll sidestep this for now.

8 bits means each value can go from 0–255 (because 2⁸ is 256 and computers start counting at 0, so:

Red = 0…255
Green = 0…255
Blue = 0…255

If all 3 values are 0, your pixel is black. If all 3 values are 255, your pixel is pure white. If R,G,B = 255,0,0 you have a pure red pixel. If R,G,B = 0,255,0 you have a pure green pixel and so on.

With 8 bits per component we need 24 bits for each pixel. Now we’re getting somewhere.

A typical “1080p” HD video image (aka frame) is 1920x1080 pixels aka 2,073,600 pixels. Multiply that by 24 bits, and we see it’s 49,746,400 bits for a single image.

We like our images to move, so we generally display them at a rate of 24 frames per second. Multiply the last number by 24 and we see it’s the very big scary number 1,194,393,600 bits per second. Wow. Oh, you can go ahead and QUADRUPLE THIS FOR 4K.

Welcome back. For those of you who are re-joining us, we’ve calculated that an HD movie in RGB with no compression needs about 1194 megabits per second (Mbps).

That’s quite a lot of bandwidth. It’s totally fine for an HDMI cable between your Xbox and the TV, but it’s WAY more than your Internet connection can handle. The average US broadband connection is somewhere in the neighborhood of 10–25 Mbps. In a hypothetical world, we’d need 1194 Mbps to play video uncompressed over the Internet.

Clearly we must compress this video quite a lot — maybe around 100x! Thankfully, there’s been a lot of really smart people thinking about similar issues for quite a long time.

Stay tuned!

--

--