Video Math

There has been a lot of confusion in marketing literature concerning video compression. Most of the confusion stems from a misunderstanding of the math and the terms involved in compression calculations. What follows is a reasonably accurate method for correlating various ways of describing video compression. NOTE: This method may not allow accurate comparison with some manufacturer's hardware specifications, as their calculations have been found to be inaccurate by up to twenty five percent.

 

 

NOTE: This area contains legacy material from previous Drastic Technologies websites. It is provided for reference only, and contains information, products and links that may no longer exist and which are no longer supported by Drastic. For current Drastic Technologies products, please see our main site here:

http://www.drastic.tv

Video Math

Aside from the basic math problems involved with compression calculations, the situation is further complicated by the different encoding methods used by various manufacturers. The following formulas are based on the broadcast specification known as the CC1R 601 recommendation. If the compression engine in question uses 4:1:1 or R170A as the basis for encoding, it then becomes far more difficult to make a comparison between that engine and true broadcast-quality compression engines. Essentially, that kind of compression engine doesn't encode video at a high enough bandwidth to make it worthwhile.

 


What Is A Meg, What is a Gig . . .

For solving simple calculations, a megabyte (MB) and a megabit (Mb) are usually assumed to be one million bytes or one million bits respectively. This is not the case. Because the lowest level a computer's digital logic operates on is base 2 (On or Off) basis, a megabyte is actually 220 bytes and a megabit is actually 220 bits. 220 may be calculated as:

2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 1,048,576 (decimal)

1 megabyte = 1,048,576 Bytes (assuming 8 bits per byte, the following is also true) 1 megabyte = 8,388,608 Bits

Because of the 48,576 discrepancy between one million and one meg, the preceding values must be used when calculating compression factors, drive usage and data throughput.

Since a megabyte is 220 , a gigabyte is 1024 times a megabyte or 230. This may be calculated as above giving the result:

1 gigabyte = 1,073,741,824 Bytes (assuming 8 bits per byte, the following is also true) 1 gigabyte = 8,589,934,592 Bits

If this is the case, the error between one billion and one gig is 73,741,824 making it important to use the actual value of a gig when solving compression equations.


CCIR 601 Uncompressed Video (Method One)

Resolution - 720 x 486 x 29.97 frames per second (Fps) (720 x 243 x 59.94 fields per second - fps)

Sample Size - 8 bits per byte data representation

Sampling - 4:2:2 (or every two horizontal pixels = 2 Y : 1 Cr : 1 Cb)

Frame Rate - 29.97 Frames Per Second

Therefore:

Luminance (Y) 720 x 486 x 29.97 Fps = 10,487,102.4 bytes per second

x 8 bits per byte = 83,896,819.2 bits per second

Chrominance R (Cr) 360 x 486 x 29.97 Fps = 5,243,551.2 bytes per second

x 8 bits per byte = 41,948,409.6 bits per second

Chrominance B (Cb) 360 x 486 x 29.97 Fps = 5,243,551.2 bytes per second

x 8 bits per byte = 41,948,409.6 bits per second

Total = 20,974,204.8 bytes per second

= 167,793,638.4 bits per second

To convert these values into megabytes and megabits, divide them by 220 (1,048,576):

CCIR 601 Megabytes/second 20,974,205 / 1,048,576 = 20.00256062 (Roughly 20 MB/s)

CCIR 601 Megabits/second 167,793,638 / 1,048,576 = 160.020483 (Roughly 160 Mb/s)

CCIR 601 Uncompressed Video (Method Two)

One Line 720 pixels (Y) + 360 pixels (R-Y) = 1440 samples (bytes) per line

One Frame 486 lines per frame x 1440 bytes per line = 699,840 bytes per frame

One Second 699,840 x 29.97 Fps = 20,974,204.8 bytes per second

8 bits per Byte 20974,204.8 x 8 = 167,793,638.4 bits per second

To convert these values into megabytes and megabits, divide them by 220 (1,048,576):

CCIR 601 Megabytes/Second 20,974,205 / 1,048,576 = 20.00256062 (Roughly 20 MB/s)

CCIR 601 Megabits/Second 167,793,638 / 1,048,576 = 160.020483 (Roughly 160 Mb/s)

As you can see, both methods resolve to the same values. For the remainder of this addendum, the following will be true:

Video Data Rate In Bytes = 20 MB/s = 20.00256062 bytes per second

Video Data Rate In Bits = 160 Mb/s = 160.020483 bits per second

Video Ratio = 1:1 = 20 MB/s : 20 MB/s = 20/20

CCIR Uncompressed Video For PAL

Note: The calculations above will be valid for PAL video with the following changes:

PAL Video Rate is 25 Frames Per Second (50 fields) instead of 29.97

PAL Horizontal Resolution is 576 lines per frame instead of 486

One Line 720 pixels (Y) + 360 pixels (R-Y) + 306 pixels (B-Y) = 1440 samples (bytes) per line

One Frame 576 lines per frame x 1440 bytes per line = 829,440 bytes per frame

One Second 829,440 x 25 Fps = 20,736,000 bytes per second

8 Bits Per Byte 20,736,000 x 8 = 165,888,000 bits per second

To convert these values into megabytes and megabits, divide them by 220 (1,048,576):

CCIR 601 Megabytes/second 20,736,000 / 1,048,576 = 19.7753063 (Roughly 20 MB/s)

CCIR 601 Megabits/second 165,888,000 / 1,048,576 = 158.203125 (Roughly 158 Mb/s)


CD Quality Uncompressed Audio

Sample Size - 16 bit (2 byte) data representation

Channels - 2 channels

Sampling Rate - 44,100 Samples Per Second

Therefore:

One Channel - 2 bytes per sample x 44,100 samples per second = 88,200 bytes per second

Total Data Rate - 88,200 bytes per second x 2 channels = 176,400 bytes per second

Total Bit Rate - 176,400 bytes per second x 8 bits per byte = 1,411,200 bits per sample

For the remainder of this addendum, the following will be true:

Audio Data Rate In Bytes = 0.17 MB/s = 176,400 bytes per second

Audio Data Rate In Bits = 1.41 Mb/s =1,411,200 bits per second

Audio Ratio = 1:1=0.17 MB/s : 0.17 MB/S= 0.17/0.17


Total Audio and Video Data Rate

The total data rate or throughput is simply the audio and video throughputs added together. For the remainder of this addendum one video channel and two audio channels are assumed and the following will be true for uncompressed data:

Total Data Rate in Bytes = 20 MB/s + 0.17 MB/s = 20.2 MB/s (21,150,605 bytes/second)

Total Data Rate in Bits = 160 Mb/s + 1.41 Mb/s = 161 Mb/s (169,204,838 bits/second)

Total Ratio = 1:1 = 20.2 Mb/S: 20.2 Mb/S = 20.2 / 20.2


Compression As Megs Per Second

When compression is described as megabytes or megabits per second it can be difficult to correlate between different compression vendor's math methods. Assuming the throughput is calculated as above (which is a very large assumption in most cases), the following formulae may be used to convert between descriptions.

MegaByte<=>MegaBit

1 megabyte = 8 megabits (most current compression technologies work with 8 bit samples)

e.g. 6 megabytes per second == 48 megabits per second

MegaByte => Compression Ratio

The ratio of a megabyte or megabit throughput can be calculated by dividing the appropriate value for uncompressed video by the specified data rate.

e.g. 8 megabytes per second = 8,388,608 bytes per second

Uncompressed Video = 20,974,205 bytes per second

The Ratio is 20,974,205 / 8,388.608 = 2.500320077

The Ratio is 2.5:1

Megabyte per second => Minutes Per Gig

To convert megabytes per second to minutes per gigabyte, express the date rate as megabytes per minute, then divide 1024 megabytes/gigabyte by the data rate in megabytes per minute.

e.g. convert 20 MB/s to minute per gigabyte (no audio)

20 MB per second x 60 seconds per minute = 1200 MB per minute

1024 MB per gigabyte / 1200 MB per minute = 0.853 minutes per gigabyte

e.g. convert 20.2 MB/s to minute per gigabyte (plus audio)

20.2 MB per second x 60 seconds per minute = 1212 MB per minute

1024 MB per gigabyte / 12120 MB per minute = 0.845 minutes per gigabyte


Compression As a Ratio

When a manufacturer specifies a compression ratio without any other supporting data, you should be wary. Depending on how the manufacturer calculated the size of uncompressed video, how the numbers were rounded, and how the compressed stream was measured, the ratio may be anywhere from fairly accurate to completely absurd. Whenever possible, find out the data rate in megabytes per second and calculate the ratio yourself. If the data rate is unavailable, make sure it was calculated based on 4:2:2 CCIR 601 encoding practices and that the frame/field size and rate match the above.

Ratio => Megabytes Per Second

The data rate in megabytes per second can be calculated by dividing the uncompressed video data rate value by the compression ratio.

e.g. 9:1 compression

Uncompressed Video data rate = 20,974,205 bytes per second

20,974,205 bytes per second / 9 = 2,330,468 bytes per second

2,330,468 / 1,048,576 = 2.2 megabytes per second

For Megabits per second, use the formula below

2,330,468 x 8 / 1,048,576 = 17.8 Megabits per second

Ratio => Minutes Per Gigabyte (No Audio)

To convert a ratio to the amount of time that can be recorded per gigabyte of hard drive space, simply use the total amount of time available for uncompressed video per gigabyte, and multiply by the ratio. To calculate the time for uncompressed video per gig:

One gigabyte = 1,073,741,824 Bytes

Uncompressed video = 20,974,205 Bytes per second

1,073,741,824 Bytes per Gig / 20,974,205 B/s = 51.19344566 seconds per Gig

51.19344566 / 60 seconds per minute = 0.85 minutes per Gig

e.g. 6:1 compression = 6 times the storage of uncompressed

6 x 51.19344566 seconds per Gig = 307.160674 seconds per Gig

307.160674 / 60 seconds per minute = 5.1 minutes per Gig


Compression As Minutes Per Gigabyte (storage)

This calculation is normally accurate because once you buy the system it is easily checked. Simply set the hardware to its highest quality and record until you fill the drive, then divide the total number of seconds recorded by the drive's size in gigabytes and compare it to the specified number. This specification may also be used to compare overall throughput with other compression systems.

Minutes Per Gigabyte => Megabytes Per Second

To calculate the data rate in megabytes per second from minutes per gigabyte, simply convert minutes per Gigabyte to seconds per Megabyte

e.g. 4 minutes per Gigabyte * 60 seconds per minute = 240 Seconds per Gigabyte

1024 Megabytes per Gigabyte / 240 seconds per Gigabyte = 4.27 Megabyte per second

Minutes Per Gigabyte => Ratio

To calculate the compression ratio given the number of minutes per gigabyte, simply use the number of uncompressed minutes that can be stored in a gigabyte and divide that into the number specified.

One gigabyte = 1,073,741,824 Bytes

Uncompressed Video = 20,974,205 Bytes per second

1,073,741,824 / 20,974,205 = 51.19344566 seconds per Gig

51.19344566 / 60 seconds per minute = 0.85322409 minutes per Gig

e.g. 7 Minutes Per Gig = 420 seconds per Gig

420 / 51.19344566 = 8.204175253

or

7 / 0 .85322409 = 8.204175253

The ratio is 8.2:1

 

NOTE: This area contains legacy material from previous Drastic Technologies websites. It is provided for reference only, and contains information, products and links that may no longer exist and which are no longer supported by Drastic. For current Drastic Technologies products, please see our main site here:

http://www.drastic.tv

 

 

More Great Tools From Drastic:

videoQC Automated and Visual QCvideoQC - Automated and visual quality checks

Automated and visual checks ofvany broadcast/post production file to VGA, HD-SDI and HDMI. Events, single and full reference charts, waveform, vectorscope, chromaticity, and data views.

  • MXF, GXF, LXF, TS, DNG, RMF, VRW, DPX and most other files
  • HD-SDI, HDMI and DVI Output
  • Visual comparison modes and full automated checks
  • Closed caption render and line 9/21 output

MediaNXS-miniMediaNXS HD-SDI Capture/Playback

Full capture and playback of MXF, MOV, AVI, YUV, DPX and many others.  Signal analysis tools, serial control, and closed caption capture, playback and display.

  • Pullins from external VTRs from EDL or list
  • Timeline audio video editing
  • Optional VTR Emulation

4ks main button4K Waveform/Vectorscope

Provides YCbCr and RGB waveform monitor, vectorscope, histogram and data view signal analysis tools for an incoming signal.

  • Replaces expensive dedicated hardware
  • Closed captions, metadata and real time data display

editors buttonMediaReactor Plug-ins

Add Drastic's extensive file import and export to your favorite editor, viewer, MAM or compositing system. 

  • DTSentinel automated conversions
  • User-directed standalone conversions also supported