Video

This document assumes at least some basic understanding of how TV works. It deals primarily with the things that both analogue and digital TV have in common. It does not provide an in depth explanation of how things work. Instead, it provides just enough information to explain some of the differences between various TV standards, using a test card as an example.
Some images are clickable, providing a 768x576 or 1920x1080 version.

TV

SDTV and TV in general.

Colour bars

Colour bar at 75% brightness. This adds a red, green and a blue image.
The green image has one green and one black bar. The red image has two red and two black bars. The blue image four blue and four black bars;

 Green component of colorbar
 Red component of colorbar
 Blue component of colorbar

This yields the following eight bar colour image;

 Colorbar 75%

Note: Some 75% colour bar test card generators add a 100% brightness horizontal white bar. And some have the vertical white bar at 100%.

When colour TV was introduced a good black and white representation of the colour signal was required. After all, most people would watch colour transmissions on a black and white TV. And since the human eye is most sensitive green and least to blue, the black and white signal consists of 29.9 % red, 58.7 % green and 11.4 % blue (these are often rounded to 0.30, 0.59 and 0.11) (note that 0.30 + 0.59 + 0.11 = 1 or 100%);

 Y Component of colorbar

The left most bar in the black and white image is of course, also at 75% brightness.
Note that in the back and white representation of the colour image, green is brighter than magenta (purple). A lot of black and white photos of colour TVs get this wrong!

Signals

Signals related to the above colour bar. You may find oscillograms similar to these in analogue TV service manuals.
All seven graphs below are to the same scale.

Red, Green and Blue

Red signal of colorbar Green signal of colorbar Blue signal of colorbar
For black, these signals are zero.

Y

This is in fact the signal of the above black and white image:
Y = 0.299 * Red + 0.587 * Green + 0.114 * Blue.
Y signal of colorbar
For black, this signal is zero.
Note: The graph does not include horizontal retrace.

R-Y, G-Y and B-Y

These are Red minus back and white, Green minus back and white and Blue minus back and white:
If you flip the Y-graph upside down and add it to the R, G and B graphs above you get the graphs below;
R-Y signal of colorbar G-Y signal of colorbar B-Y signal of colorbar
Of these B-Y has the largest and G-Y the smallest amplitude.
Note that these signals can have both positive and negative values. And for pure grey tones, including black and white, these signals are zero.

U, V, Pb and Pr

The U and Pb signals are B-Y with a reduced amplitude;
U = 0.492 * (B-Y). And Pb = 0.564 * (B-Y).
The V and Pr signals are R-Y with a reduced amplitude;
V = 0.877 * (R-Y). And Pr = 0.713 * (R-Y).
U and V are specific to PAL (See terminology confusion below).
Pb and Pr on the other hand are generic. And the basis of a lot of modern TV systems.

I and Q

I and Q are specific to NTSC (See terminology confusion below).
Derived from B-Y and R-Y;

 I = -0.27 * (B-Y) + 0.74 * (R-Y)
 Q =  0.41 * (B-Y) + 0.48 * (R-Y)

Derived from U and V;

 I = -0.545 * U + 0.839 * V
 Q =  0.839 * U + 0.545 * V
Recreate RGB

Both analogue and digital colour television transmit the Y, B-Y and R-Y signals in one form or an other. The G-Y signal is calculated at the receiving end:

If:

 Y = k * R + l * G + m * B

Than:

 k * (R-Y) + l * (G-Y) + m * (B-Y) = 0.

Or:
          k             m
 G-Y = - ─── * (R-Y) - ─── * (B-Y)
          l             l

And substituting k, l and m for 0.299, 0.587 resp 0.114;

          0.299             0.114
 G-Y = - ─────── * (R-Y) - ─────── * (B-Y)
          0.587             0.587

Which yields:

 G-Y = - 0.509 * (R-Y) - 0.194 * (B-Y)

A lengthy explanation here.

We could derive B-Y from G-Y and R-Y. Or R-Y from G-Y and B-Y. But since Y mostly consist of green, on average B-Y and R-Y will have a bigger amplitude than G-Y. So, from a signal to noise ratio perspective, it makes more sense to derive G-Y from B-Y and R-Y.

B-Y and R-Y are usually transmitted with a smaller bandwidth than Y: A typical Y bandwidth is 4.2 to 6 MHz. For B-Y and R-Y it's usually 1.3 MHz. And a Q signal has an even smaller bandwidth. About 0.5 MHz.
This reduces the total amount of information roughly by half while retaining a lot of the small details in the image.
One of the consequences of this is, that the Y signal can change much faster than the B-Y and R-Y signals.

At the receiving end R, G and B are recreated from Y, B-Y and R-Y.
Using Y, U and V (Used in vintage TVs);

 B-Y = 2.033 * U
 R-Y = 1.140 * V
 G-Y = - 0.509 * (R-Y) - 0.194 * (B-Y)
 R = R-Y + Y
 G = G-Y + Y
 B = B-Y + Y

Using Y, I and Q (Used in vintage TVs);

 B-Y = - 1.107 * I + 1.704 * Q
 R-Y =   0.965 * I + 0.621 * Q
 G-Y = - 0.509 * (R-Y) - 0.194 * (B-Y)
 R = R-Y + Y
 G = G-Y + Y
 B = B-Y + Y

Or using Y, Pb and Pr (Current);

 B-Y = 1.773 * Pb
 R-Y = 1.403 * Pr
 G-Y = - 0.509 * (R-Y) - 0.194 * (B-Y)
 R = R-Y + Y
 G = G-Y + Y
 B = B-Y + Y

An electronic circuit that does arithmetic like above is called a matrix. In it's most basic form a few resistors is all it takes.

Due to the limited bandwidth of B-Y and R-Y, these are not exact copies of the original R, G and B signals.
For instance, note the little spikes at the bar boundaries of the recreated red and green signals. Which were not present in the original signals;
Recreated Red signal of colorbar Recreated Green signal of colorbar Recreated Blue signal of colorbar
The image below zooms in on the second spike in green, which is at the yellow - cyan boundary. And besides green, it also shows Y and G-Y. The centre of the fall in Y coincides exactly with the centre of the rise in G-Y;
Detail of recreated Green signal of colorbar
G-Y by rises exactly by the same amount as the drop in Y. So the green signal (G = G-Y + Y) starts and ends with exactly the same value. However, Y changes about four times faster than G-Y. Which causes a little Z-like structure in the green signal. The same effect causes the spikes in red.
The rises on the other hand, have little dents. Which only becomes apparent when you zoom in on the little details.
The image below zooms in on the blue signal during the same yellow to cyan transition:
Detail of recreated Blue signal of colorbar
The falls have steep bits. Which are all but invisible, even if you zoom in.

In the black parts the spikes drop below zero. And in a 100% brightness colour bar the spikes on the bright parts peek above 100%.
The spikes are very small and an analogue system can easily deal with these. But in a digital system we have to add a little margin, clip the spikes away or do both.

Note that these spikes are not caused by ringing or overshoot in filters. Overshoot in video signals results in ugly images, so filters are designed is such a way that there is very little overshoot, let alone ringing. So this has nothing to do with the Gibbs phenomenon either.

Of course, the exact nature of these artefacts depend on the image content and the way the signals are processed.

Values

The colour bar above has a brightness of 75%. The table below is based on 100%;

 Colorbar 100%

100% Brightness colour bar signals
Sig
nal
Bar colour
White Yellow Cyan Green Mag Red Blue Black
R  1  1  0  0  1  1  0  0
G  1  1  1  1  0  0  0  0
B  1  0  1  0  1  0  1  0
Y  1  0.886  0.701  0.587  0.413  0.299  0.114  0
R-Y  0  0.114 -0.701 -0.587  0.587  0.701 -0.114  0
G-Y  0  0.114  0.299  0.413 -0.413 -0.299 -0.114  0
B-Y  0 -0.886  0.299 -0.587  0.587 -0.299  0.886  0
φ °  NA  173  293  225   45  113  353  NA
U  0 -0.436  0.147 -0.289  0.289 -0.147  0.436  0
V  0  0.100 -0.615 -0.515  0.515  0.615 -0.100  0
φuv  NA  167  283  241   61  103  347  NA
Pb  0 -0.500  0.169 -0.331  0.331 -0.169  0.500  0
Pr  0  0.081 -0.500 -0.419  0.419  0.500 -0.081  0
φp  NA  171  289  232   52  109  351  NA

These are relative values. In most analogue video signals, '1' corresponds to 0.7 Volt. In which case, depending on the standard, '0' corresponds to either 0 or 0.05 Volt. And synchronisation pulses, if any, correspond to -0.3 Volt. (An exception is VGA, which has 5 Vpp sync signals.)
In the table below, '0' corresponds to 0 Volt;

100% Brightness colour bar voltages
Sig
nal
Bar colour
White Yellow Cyan Green Mag Red Blue Black
Y  0.700  0.620  0.491  0.411  0.289  0.209  0.080  0.000
Pb  0.000 -0.350  0.118 -0.232  0.232 -0.118  0.350  0.000
Pr  0.000  0.057 -0.350 -0.293  0.293  0.350 -0.057  0.000

φ, φuv and φp are;

 φ   = arctan(R-Y / B-Y)
 φuv = arctan(V / U)
 φp  = arctan(Pr / Pb)

Note that these are meaningless in case of pure grey tones. In which case B-Y, R-Y, U, V, Pb and Pr are all zero.
And if B-Y is zero (or very small) and R-Y is not, you have to do a arccot instead of a actan and work from there.
See colour circles below.

MP4 Video

A 30 second 25 fps interleaved Video of the above 75% brightness colour bar image.
Note: There is no sound.

Colour circles

A B-Y - R-Y, a U - V and a Pb - Pr colour circle. The U - V circle also shows I and Q.
The horizontal value runs from -1 at the left to 1 at the right. The vertical value runs from 1 at the top to -1 at the bottom. And Y is 1 at the centre and 0 at the rim of the circle.
All of this is a bit arbitrary, but it does show that B-Y - R-Y, U - V and Pb - Pr are different things (See terminology confusion below).

 Color circle  Color circle UV and IQ  Color circle PbPr

Note that -(B-Y) = Y-B and -(R-Y) = Y-R.
The example φ in all three images is between 0° and Magenta.
The angle between U and Q is 33°. And between U and I 123°; If you tilt your head 33° to the left, you will find that I and Q are perpendicular.
YPbPr is current: It's from the 1990's. And lives on in a digital version called YCbCr.
YUV and YIQ on the other hand are vintage: YUV is from 1962 and YIQ from 1953.

B-Y is a shade of violet.
R-Y is somewhere between red and purple.
Both -(B-Y) and -(R-Y) are shades of green.
G-Y=0 is either a shade of brown / orange (brown is in fact a dark shade of orange) or a shade of blue.
And contrast colours are always 180° apart;

Contrast colours
PrimarySecondary
Red Cyan
Green Magenta
Blue Yellow

The range of available colours is much larger than just the colours in these circles. After all, a colour isn't just determined by B-Y and R-Y, it depends on Y as well. And there are colours outside the circles. The total range of colours of all three systems is in fact, the same.

Some test cards contain a G-Y = 0. And since G-Y = - 0.509 * (R-Y) - 0.194 * (B-Y), the equivalent of G-Y = 0 is '-0.509 * (R-Y) = 0.194 * (B-Y)'. Or 'R-Y = -0.381 * (B-Y)'. Or 'B-Y = -2.624 * (R-Y)'.
The PM5544 test card shows some of these colours as follows:

 B-Y
 R-Y
 G-Y=0
-(B-Y)
-(R-Y)
 G-Y=0

As far as I can work out, the brightness of the grey background is about 50%. And the (combined) amplitude of U and V in these colours about 0.24. Other colours in the PM5544 test card are regular 75% brightness colour bar colours.
The PM5544 is probably the best (SD)TV test card ever conceived!

There are also test cards with I and Q;

 Q
 I
-I

Note: I and Q are not necessary darker than U and V.

Gamma

In a valve, the anode (output) current increases roughly with the square of the grid (input) voltage. The same applies to picture tubes: The cathode ray current increases more or less with the square of the cylinder voltage. Or to be more exact, with the 2.2 power thereof;

 output = input²·²

To compensate, before being transmitted, the video signal gets a gamma correction. And since 1 / 2.2 ≈ 0.45;

 output = input⁰·⁴⁵

Different systems use different gamma values. Just about anything from 2.2 to 2.8.
Some image files contain meta information stating the gamma correction used.

To indicate that a signal is gamma a corrected an apostrophe (') is used;

 Y' = 0.299 * R' + 0.587 * G' + 0.114 * B'

Notes:
An apostrophe may absent, even though the signal or data is gamma corrected.
For reasons of compatibility with CRTs, flat screen displays use gamma correction as well.
Computer displays use a gamma that is different from TV.

Using a wrong gamma correction will cause problems with the darker shades in an image:
A gamma correction that is too strong will cause the darker shades to be too bright.
A gamma correction that is too weak will cause the darker shades to be too dark.
A gamma that is just a little bit off, still produces a nice image. Unless you're into DTP or you want your shadows exactly right.

Digital

These are usually 8-bit unsigned integers in the 0 to 255 range. Although higher resolutions are also used. Such as 10 or 12 bits.
Cb and Cr are the digital equivalents of Pb and Pr. Signed numbers derived from Pb and Pr are changed to unsigned;

Signed to Unsigned
8-bit 10-bit 12-bit
SignedUnsigned SignedUnsigned SignedUnsigned
126254 5071019 20314079
112240 448960 17923840
107235 428940 17123760
0128 0512 02048
-11216 -44864 -1792256
-1271 -5084 -203216

In 8-bit systems Y is limited to the 16 to 235 range. And Cb and Cr to the 16 to 240 range;

 Y  =  16 + 219 * Yanalogue
 Cb = 128 + 224 * Pb
 Cr = 128 + 224 * Pr

Note that in case of pure grey tones Cb and Cr are both 128.
Below a 75% brightness colour bar;

75% Brightness colour bar 8-bit digital signals
Sig
nal
Bar colour
White Yellow Cyan Green Mag Red Blue Black
R 191 191 0 0 191 191 0 0
G 191 191 191 191 0 0 0 0
B 191 0 191 0 191 0 191 0
Y 180 162 131 112 84 65 35 16
Cb 128 44 156 72 184 100 212 128
Cr 128 142 44 58 198 212 114 128

And a 100% brightness colour bar;

100% Brightness colour bar 8-bit digital signals
Sig
nal
Bar colour
White Yellow Cyan Green Mag Red Blue Black
R 255 255 0 0 255 255 0 0
G 255 255 255 255 0 0 0 0
B 255 0 255 0 255 0 255 0
Y 235 210 170 145 106 81 41 16
Cb 128 16 166 54 202 90 240 128
Cr 128 146 16 34 222 240 110 128

While recreating RGB small spikes may occur. If one is to recreate the full 0 to 255 range, these need to be clipped away in order to avoid values outside the 0 to 255 range.
If one is absolutely sure that the remote end handles this properly, one may encode Y, Cb and Cr without the 16 to 235 resp 16 to 240 limits and use 0 to 255 instead. This may cause compatibility issues though; Values 0 and 255 are reserved in colour data.
Below an 100% brightness colour bar of which the bottom half is in the 16 to 235 range;

Limited colorbar

In the bottom half of the picture, black is in fact a dark shade of grey.

JPEG Images

JPEG images use the the same system as above, but without the limited range. It uses 0 to 255 instead.
Assuming that R, G and and B are in the 0 to 255 range;

 Y  = 0.299 * R + 0.587 * G + 0.114 * B
 Cb = 128 + 0.564 * (B-Y)
 Cr = 128 + 0.713 * (R-Y)

The results are rounded to the nearest integer and limited to the 0 to 255 range.

Chroma sub sampling

The most commonly used forms of chroma sub sampling are '4:4:4' and '4:2:0'. Sometimes referred to as '444' and '420':
With 4:4:4 Cb and Cr have the same resolution as Y: For each Y sample there is a Cb and and a Cr sample.
With 4:2:0 it's 1/4: For every four Y samples, there is one Cb and one Cr sample. This reduces the total amount of information roughly by half.
So chroma sub sampling performs a function simular to the low pass filters in the B-Y and R-Y signals. And causes similar artefacts that need to be dealt with.
More on chroma sub sampling at Wikipedia: Chroma subsampling

HDTV

 HDTV Colorbar 75%

Here the Y signal is not an accurate black and white representation of the colour image;

 Y  = 0.213 * R + 0.715 * G + 0.072 * B
 Pb = 0.539 * (B-Y)
 Pr = 0.635 * (R-Y)

Note that this different from SDTV. If we want recreate RGB accurately, we need to know how YPbPr was composed;
One can actually generate a high resolution image, using the SDTV method of generating YPbPr! So we can't make assumptions based on the resolution alone!

75% Brightness HD colour bar 8-bit digital signals
Sig
nal
Bar colour
White Yellow Cyan Green Mag Red Blue Black
Y 180 168 145 133 63 51 28 16
Cb 128 44 147 63 193 109 212 128
Cr 128 136 44 52 204 212 120 128

Note: This is different from the 75% SDTV colour bar.

UHD

This is different from both SDTV and HDTV;

 Y  = 0.2627 * R + 0.678 * G + 0.0593 * B
 Pb = 0.5315 * (B-Y)
 Pr = 0.6782 * (R-Y)

Most TV standards gamma correct R, G and B before calculating Y. UHD on the other hand, can also calculate Y based on linear (non gamma corrected) R, G and B, and then do the gamma correction on Y.

Terminology confusion

PAL

Strictly speaking PAL is not a frame rate but a (now obsolete) colour TV standard.
And although PAL mostly uses 25 frames per second, there are also 30 fps versions.

NTSC

Strictly speaking NTSC is not a frame rate but a (now obsolete) colour TV standard.
And although NTSC mostly uses 30 (29.97) frames per second, there are also 25 fps versions.

YUV

Sometimes 'YUV' is used when one actually means YPbPr or YCbCr.
YUV is also used as a generic term for all Y - B-Y - R-Y derivatives. In which case one may need additional meta information in the file header or data stream in order tell what YUV really means. For instance, it might say 'Matrix coefficients: BT.470 System B/G'. Which is classic SDTV.

YPbPr and YCbCr

Sometimes 'YPbPr' is used when one actually means YCbCr.
YPbPr is analogue, YCbCr is digital.
And both can mean different things, depending on the standard used.

Standards

Some commonly used standards.
Most use the same white point. Some have different primary colours. And there are different Gammas.
sRGB is a computer display standard. BT.709 is used for HDTV and HDMI. And BT.2020 is UHD. Others are conventional TV standards.

Primary colours

Below a table with primary colours and white points. The X and Y coordinates are as in CIE 1931 color space.

Primary colours and white points
Prim
&
Wht
Standards
NTSC 1953,
BT.470 M
SMPTE 170M,
BT.601 525 lines
BT.470 B/G,
BT.601 625 lines
BT.709,
sRGB
BT.2020
XY XY XY XY XY
R 0.670.33 0.6300.340 0.6400.330 0.6400.330 0.7080.292
G 0.210.71 0.3100.595 0.2900.600 0.3000.600 0.1700.797
B 0.140.08 0.1550.070 0.1500.060 0.1500.060 0.1310.046
W 0.3100.316 0.31270.3290 0.31270.3290 0.31270.3290 0.31270.3290

NTSC 1953 has the same primary colours as BT.470 M. SMPTE 170M the same as BT.601 525 lines. BT.470 B/G the same as BT.601 625 lines. And sRGB has the same primary colours as BT.709.
And BT.2020 has a very large colour space.

Generate YPbPr

Different systems calculate Y, Pb and Pr differently.

Classic SD

 Y  = 0.299 * R + 0.587 * G + 0.114 * B
 Pb = 0.564 * (B-Y)
 Pr = 0.713 * (R-Y)

BT.709

 Y  = 0.213 * R + 0.715 * G + 0.072 * B
 Pb = 0.539 * (B-Y)
 Pr = 0.635 * (R-Y)

BT.2020

 Y  = 0.2627 * R + 0.678 * G + 0.0593 * B
 Pb = 0.5315 * (B-Y)
 Pr = 0.6782 * (R-Y)

YPbPr Overview

The table below shows the different results.

100% Brightness colour bar Y, Pb and Pr values for various standards
Colour Classic SD BT.709 BT.2020
YPbPr YPbPr YPbPr
White  1.000 0.000 0.000  1.000 0.000 0.000  1.000 0.000 0.000
Yellow  0.886-0.500 0.081  0.928-0.500 0.046  0.941-0.500 0.040
Cyan  0.701 0.169-0.500  0.787 0.115-0.500  0.737 0.140-0.500
Green  0.587-0.331-0.419  0.715-0.385-0.454  0.678-0.360-0.460
Magenta  0.413 0.331 0.419  0.285 0.385 0.454  0.322 0.360 0.460
Red  0.299-0.169 0.500  0.213-0.115 0.500  0.263-0.140 0.500
Blue  0.114 0.500-0.081  0.072 0.500-0.046  0.059 0.500-0.040
Black  0.000 0.000 0.000  0.000 0.000 0.000  0.000 0.000 0.000

In all three Y is in the 0 to 1 range and Pb and Pr in the -0.5 to 0.5 range.
However, in order to recreate RGB you need to know which standard is used. Some files contains meta information about the used standard.

Recreate RGB

sRGB uses Red Green and Blue. While the others use Y and signals derived from B-Y and R-Y in one form or an other.

Classic SD

 B-Y = 2.033 * U
 R-Y = 1.140 * V
 B-Y = 1.773 * Pb
 R-Y = 1.403 * Pr
 G-Y = - 0.509 * (R-Y) - 0.194 * (B-Y)

BT.709

 B-Y = 1.855 * Pb
 R-Y = 1.575 * Pr
 G-Y = - 0.298 * (R-Y) - 0.101 * (B-Y)

BT.2020

 B-Y = 1.8814 * Pb
 R-Y = 1.4746 * Pr
 G-Y = - 0.3875 * R-Y - 0.0875 * B-Y

Gamma

BT.470 M

This is 2.2;

 output = input⁰·⁴⁵

BT.470 B/G

This is 2.8;

 output = input⁰·³⁶

BT.601, BT.709 and BT.2020

This is a linear - 2.2 power mix.
For input values below 0.018 it's:

 output = 4.5 * input

And for 0.018 and greater it's;

 output = (1.099 * input)⁰·⁴⁵ - 0.099

Here is a bit of confusion: Apparently BT.2020 is expected to be viewed on a 2.4 gamma monitor. Which is a sRGB gamma.

sRGB

This is a linear - 2.4 power mix.
For input values below 0.0031 it's:

 output = 12.92 * input

And for 0.0031 and greater it's;

 output = (1.055 * input)⁰·⁴² - 0.055

Apparently, a lot of systems that claim to be sRGB use a gamma of 2.2 instead.

Converting YPbPr to RGB the wrong way

So what if you decode one standard as an other?
In the six images below, the bottom half is converted back to RGB the wrong way. For comparison, all images have a 4:3 aspect ratio.

Classic SD

The first image was converted back assuming it to be BT.709. And the second image was converted to BT.2020.

SD Converted to BT.709 SD Converted to BT.2020

BT.709

The first image was converted back assuming it to be SD. And the second image was converted to BT.2020.

BT.709 Converted to SD BT.709 Converted to BT.2020

BT.2020

The first image was converted back assuming it to be SD. And the second image was converted to BT.709.

BT.2020 Converted SD BT.2020 Converted to BT.709