WEBVTT

00:00:00.080 --> 00:00:06.240
video compression is a very important aspect of how video streaming websites

00:00:03.840 --> 00:00:09.360
like youtube netflix and hulu work without it you wouldn't be able to

00:00:07.440 --> 00:00:13.440
stream such high quality high frame videos like this one first some math

00:00:11.920 --> 00:00:18.400
let's say you're watching a video with a resolution of

00:00:15.759 --> 00:00:23.439
pixels that's like 2 million pixels per frame and in this case you've got 30

00:00:20.320 --> 00:00:26.160
frames per second that's a whopping 62

00:00:23.439 --> 00:00:31.359
million pixels per second if each pixel needs 24 bits or three bytes of

00:00:28.400 --> 00:00:37.360
information you're looking at 178 megabytes of data per second completely

00:00:34.800 --> 00:00:41.440
uncompressed that would be 51 gigabytes of information for a single five minute

00:00:39.600 --> 00:00:44.399
video we've got pretty fast internet here at the office but even we can only

00:00:43.280 --> 00:00:49.120
download like two and a half gigabytes in five minutes

00:00:46.800 --> 00:00:52.559
that's a long ways away from 51. fortunately a five minute high

00:00:50.559 --> 00:00:58.879
definition youtube video is not 51 gigabytes it's in fact more like 72

00:00:55.680 --> 00:01:01.199
megabytes that's like 700 times smaller

00:00:58.879 --> 00:01:07.200
how did they do that that's the magic of video compression which works mostly by

00:01:03.840 --> 00:01:08.640
minimizing redundancy in the video data

00:01:07.200 --> 00:01:12.799
now there are all sorts of different ways to compress video and lots of

00:01:10.640 --> 00:01:16.000
different video containers and codecs but i won't go into detail about that

00:01:14.400 --> 00:01:19.759
because last already covered it in this episode and frankly i still don't really

00:01:18.240 --> 00:01:24.960
understand it all even though i am employed as a video editor so don't tell

00:01:22.479 --> 00:01:29.520
Linus so here's what you need to know there are two ways to compress video

00:01:27.439 --> 00:01:35.040
spatial compression and temporal compression also known as intra-frame

00:01:32.320 --> 00:01:38.159
and interframe respectively seriously who names this stuff

00:01:36.560 --> 00:01:43.600
anyway i'm going to describe each of these in terms of the jpeg image format

00:01:40.400 --> 00:01:45.840
and the mpeg video format spatial or

00:01:43.600 --> 00:01:50.720
intra-frame compression is applied only to individual video frames to compress a

00:01:48.640 --> 00:01:55.600
video frame you can use the same process that's used to compress a still image

00:01:52.560 --> 00:01:57.360
like a jpeg when a jpeg is created color

00:01:55.600 --> 00:02:01.439
information of the image is reduced in a process called chroma sub sampling and

00:01:59.520 --> 00:02:06.640
then the image is split into sections of 8x8 pixels called macroblocks then all

00:02:04.640 --> 00:02:10.959
of this fancy stuff is done to these blocks to further reduce the file size

00:02:08.879 --> 00:02:14.959
it's easy to see this effect on an image that has been saved with a high amount

00:02:12.720 --> 00:02:18.800
of compression all those ugly looking squares are known as compression

00:02:16.640 --> 00:02:22.640
artifacts some images like this red square can be compressed more than

00:02:20.560 --> 00:02:26.800
others like this complicated photograph because the red square is very simple

00:02:24.560 --> 00:02:32.640
with a lot more redundancy so that's how a jpeg uses spatial compression now for

00:02:29.520 --> 00:02:34.239
an mpeg sometimes called a motion jpeg

00:02:32.640 --> 00:02:38.239
things are a bit more complicated than just lining up a whole bunch of jpegs

00:02:36.319 --> 00:02:44.319
one after the other to be used as video frames doing it that way would not allow

00:02:40.879 --> 00:02:46.480
for inter frame or temporal compression

00:02:44.319 --> 00:02:51.280
temporal compression works again by reducing redundancy if you go through a

00:02:49.040 --> 00:02:54.720
video like this one frame by frame you'll notice that many frames are

00:02:52.640 --> 00:02:58.800
almost completely identical that's redundancy which can be easily

00:02:56.640 --> 00:03:02.239
compressed for example for all the parts of this video that don't need to change

00:03:00.400 --> 00:03:06.000
from one frame to the next like all this whiteness around me all we need is an

00:03:04.400 --> 00:03:11.360
instruction for those parts of the frame which says don't change anything like

00:03:08.640 --> 00:03:16.239
jpeg the mpeg standard breaks a video frame into 8x8 pixel macro blocks and

00:03:14.400 --> 00:03:20.159
each macro block receives instructions on what to do with the pixels they

00:03:17.920 --> 00:03:24.640
already have there are instructions for staying exactly the same for moving

00:03:22.560 --> 00:03:29.200
rotating changing color changing completely and so on video frames with

00:03:27.280 --> 00:03:33.920
instructions like this are called p frames and they use about half as much

00:03:31.360 --> 00:03:37.599
data as an iframe which is pretty much just a jpeg

00:03:35.519 --> 00:03:43.040
there are also b frames which are predictions or interpolations between i

00:03:40.560 --> 00:03:46.879
and p frames b frames use a quarter as much data as an iframe so they really

00:03:44.959 --> 00:03:51.040
save a lot of space this is all pretty easy to see on a video file that has

00:03:48.799 --> 00:03:54.640
been saved in an extremely low quality setting like what you're seeing right

00:03:52.480 --> 00:03:58.560
now again all these awful square thingies are called compression

00:03:56.159 --> 00:04:02.879
artifacts furthermore sometimes a video file will be corrupted or missing some

00:04:00.799 --> 00:04:06.239
data when that happens you get an effect like this one

00:04:04.159 --> 00:04:09.920
this particular effect is caused by a missing iframe which would have cleared

00:04:08.319 --> 00:04:14.799
away the old image to make room for a new one without the iframe the list of

00:04:12.159 --> 00:04:19.280
changes in the following b and p frames are applied to the wrong image so now

00:04:17.280 --> 00:04:24.240
you know why a video sometimes looks weird or gets all blocky those artifacts

00:04:21.919 --> 00:04:28.720
are a result of the video compression being either too high or else some kind

00:04:26.639 --> 00:04:32.880
of error in the coding or transmission of the video data now listen if none of

00:04:30.960 --> 00:04:37.360
that made any sense everything i've said can be broken down to one thing

00:04:35.120 --> 00:04:42.800
bit rate the bit rate is the amount of data or bits that are being used every

00:04:40.080 --> 00:04:46.639
second if a video has a low bid rate it will be low resolution and or low

00:04:44.960 --> 00:04:51.600
quality with lots of compression artifacts if a video has a high bitrate

00:04:49.199 --> 00:04:56.479
it will be high quality and or high resolution so the more bits you have to

00:04:54.160 --> 00:05:00.639
work with the better the video will look there's just no getting around that even

00:04:58.320 --> 00:05:05.520
with the best compression methods video compression is a balancing act between a

00:05:02.720 --> 00:05:10.000
good looking video or a small file size you can't have both but if compromise is

00:05:07.840 --> 00:05:13.759
not your style maybe you'll like fractal design now i'm sure you've all grown

00:05:12.080 --> 00:05:19.039
accustomed to embarrassing torturous events happening to line us in these

00:05:15.440 --> 00:05:19.039
spots let's look at them now

00:05:20.160 --> 00:05:26.080
behind in this manner

00:05:24.000 --> 00:05:29.520
speaking of mean fractal design is that buying up all of my advertising

00:05:27.600 --> 00:05:34.560
inventory so i was a little nervous about doing this ad i am however

00:05:32.000 --> 00:05:38.560
relieved to say that josh has granted me a reprieve i guess Linus is the one he

00:05:36.720 --> 00:05:43.039
wants to torture so we're using this spot to thank all of you the viewers who

00:05:40.880 --> 00:05:46.720
went to the survey page and responded so positively to our previous fractal

00:05:44.800 --> 00:05:50.400
design ads as fast as possible that they've decided to continue sponsoring

00:05:48.479 --> 00:05:54.639
this show so thanks to you guys and thanks to fractal design the company

00:05:52.240 --> 00:05:58.080
whose cases power supplies and fans bring all of the boys to all of the

00:05:56.240 --> 00:06:01.919
yards be sure to check back over the next few weeks to learn just what that

00:06:00.000 --> 00:06:06.080
reference might mean thanks for watching this episode of fastest possible give us

00:06:04.000 --> 00:06:11.759
a like or a dislike leave a comment subscribe do it subscribe and we'll see

00:06:09.039 --> 00:06:11.759
you next time
