WEBVTT
Kind: captions
Language: en-US

00:00:04.400 --> 00:00:09.120
This is the quality at which you are currently&nbsp;
watching this video. Or, at least, an&nbsp;&nbsp;

00:00:09.120 --> 00:00:14.720
approximation. If you're seeing the text “1080P”,&nbsp;
then you might be watching at either 720p,&nbsp;&nbsp;

00:00:14.720 --> 00:00:21.040
or indeed 1080p, depending on whether the text is&nbsp;
striped. But if you instead see the word “LOWER”,&nbsp;&nbsp;

00:00:21.040 --> 00:00:25.280
then you’re likely watching this at one of&nbsp;
the lower resolutions. And, if you check&nbsp;&nbsp;

00:00:25.280 --> 00:00:30.480
the timeline near the current part of the video,&nbsp;
you should see an entirely different bit of text.

00:00:30.480 --> 00:00:34.400
Now, depending on the device you're using and&nbsp;
the properties your display, some of these&nbsp;&nbsp;

00:00:34.400 --> 00:00:39.040
effects might not be as clear as the rest. And,&nbsp;
if you're watching this well into the future,&nbsp;&nbsp;

00:00:39.040 --> 00:00:44.480
some of the tricks used here might be broken&nbsp;
for one reason or another, so let's not waste&nbsp;&nbsp;

00:00:44.480 --> 00:00:50.480
time with crude demonstrations and instead take a&nbsp;
look at how all of this works in the first place.

00:00:51.040 --> 00:00:56.080
We'll start by taking a look at YouTube's list&nbsp;
of quality settings. Each entry is named after&nbsp;&nbsp;

00:00:56.080 --> 00:01:01.360
its resolution. But, for 720 and 1080p,&nbsp;
there's an additional number showing the&nbsp;&nbsp;

00:01:01.360 --> 00:01:06.080
frame rate. For all of the other entries,&nbsp;
their frame rate is half of the maximum,&nbsp;&nbsp;

00:01:06.080 --> 00:01:11.280
which in this case is 30. In case you don't know&nbsp;
what these terms mean, here's a quick refresher:&nbsp;&nbsp;

00:01:11.280 --> 00:01:16.000
the resolution represents the amount of&nbsp;
pixels on the screen, while the frame rate&nbsp;&nbsp;

00:01:16.000 --> 00:01:21.360
represents the amount of times that those&nbsp;
pixels are updated every second. Of course,&nbsp;&nbsp;

00:01:21.360 --> 00:01:26.400
this isn't entirely accurate due to factors&nbsp;
like bit rate and refresh rate, but in general,&nbsp;&nbsp;

00:01:26.400 --> 00:01:31.840
resolution refers to image quality, while&nbsp;
frame rate refers to smoothness of motion.

00:01:31.840 --> 00:01:37.280
Now, remember, our goal is to make one video&nbsp;
file show something different based on which&nbsp;&nbsp;

00:01:37.280 --> 00:01:43.040
setting you have selected, and these two factors&nbsp;
are pretty much the only way to distinguish that.&nbsp;&nbsp;

00:01:43.040 --> 00:01:48.080
More specifically, the video file gets uploaded&nbsp;
to YouTube at the highest possible quality, and&nbsp;&nbsp;

00:01:48.080 --> 00:01:54.400
gets compressed the further down you go. Normally,&nbsp;
video compression removes detail from the video,&nbsp;&nbsp;

00:01:54.400 --> 00:02:01.520
but our goal is to somehow make it so that new&nbsp;
information is added when the quality is reduced.

00:02:01.520 --> 00:02:05.760
To get an idea for how something like this&nbsp;
could work, let's look at the simplest example,&nbsp;&nbsp;

00:02:05.760 --> 00:02:09.200
which focuses on just the frame&nbsp;
rate for now. As mentioned before,&nbsp;&nbsp;

00:02:09.200 --> 00:02:15.440
a clip that started at 60 frames per second gets&nbsp;
cut down to just 30 at lower quality settings.&nbsp;&nbsp;

00:02:15.440 --> 00:02:20.720
YouTube does this by simply dropping every other&nbsp;
frame. Normally, this just means that the video&nbsp;&nbsp;

00:02:20.720 --> 00:02:26.640
playback gets a bit choppier, but what if we&nbsp;
stored our video in only the dropped frames?

00:02:26.640 --> 00:02:30.480
This way, at 60 FPS, you can&nbsp;
still see the original clip,&nbsp;&nbsp;

00:02:30.480 --> 00:02:36.880
albeit with some flickering, while&nbsp;
at 30 FPS, it disappears entirely.

00:02:36.880 --> 00:02:41.040
Creating a video file with such specific&nbsp;
conditions is also not a straightforward&nbsp;&nbsp;

00:02:41.040 --> 00:02:45.920
process. After all, if I were to simply weave&nbsp;
together individual frames in a video editor,&nbsp;&nbsp;

00:02:45.920 --> 00:02:49.600
it would take me hours to&nbsp;
cover just a minute of footage.

00:02:49.600 --> 00:02:53.120
Naturally, the solution was to&nbsp;
write some code – in this case,&nbsp;&nbsp;

00:02:53.120 --> 00:02:58.240
that's a Python script that takes two images as&nbsp;
an input, and produces an interleaved video as&nbsp;&nbsp;

00:02:58.240 --> 00:03:02.800
the output. Scripts like these were very&nbsp;
important throughout this project. And,&nbsp;&nbsp;

00:03:02.800 --> 00:03:07.360
frankly, every other project on this&nbsp;
channel has relied heavily on programming,&nbsp;&nbsp;

00:03:07.360 --> 00:03:12.720
which is something that you, too, can master&nbsp;
with the sponsor of this video, Boot.dev.

00:03:12.720 --> 00:03:17.280
I've always said that the best way to learn&nbsp;
how to code is to build real projects,&nbsp;&nbsp;

00:03:17.280 --> 00:03:21.360
and that's exactly what Boot.dev&nbsp;
offers – it's not just theory,&nbsp;&nbsp;

00:03:21.360 --> 00:03:26.640
it's not just boring lectures and tutorials,&nbsp;
you get to do the dirty work hands-on.

00:03:26.640 --> 00:03:29.920
They've got courses in anything&nbsp;
from JavaScript and Python for&nbsp;&nbsp;

00:03:29.920 --> 00:03:33.600
when you need quick-and-dirty&nbsp;
solutions, to memory-constrained C,&nbsp;&nbsp;

00:03:33.600 --> 00:03:36.960
like the kind I used to make the&nbsp;
world's smallest Minecraft server.

00:03:36.960 --> 00:03:42.320
Every course is hand-crafted by human experts,&nbsp;
and there's a Discord community full of real&nbsp;&nbsp;

00:03:42.320 --> 00:03:47.680
humans ready to help if you ever get stuck. Or&nbsp;
you can also just look at the example solution&nbsp;&nbsp;

00:03:47.680 --> 00:03:52.560
on every challenge. After all, the point&nbsp;
isn't to memorize what characters to write.&nbsp;&nbsp;

00:03:52.560 --> 00:03:58.720
What's important is learning how to actually build&nbsp;
software, and that can only be done through trial&nbsp;&nbsp;

00:03:58.720 --> 00:04:05.840
by fire. This isn't a boot camp with "one simple&nbsp;
trick", it's real learning with real results.

00:04:05.840 --> 00:04:10.160
And, look, you don't have to take my&nbsp;
word for it – Boot.dev is free to try.&nbsp;&nbsp;

00:04:10.160 --> 00:04:14.480
Pretty much all of their actual content is&nbsp;
readily available, it's just the interactive&nbsp;&nbsp;

00:04:14.480 --> 00:04:18.800
stuff that's behind a paid membership. If you do&nbsp;
decide that you want to get serious about this,&nbsp;&nbsp;

00:04:18.800 --> 00:04:26.720
then you can use code PortalRunner, or the QR&nbsp;
code on-screen, to get 25% off for an entire year.

00:04:26.720 --> 00:04:30.720
All of this should hopefully give you an&nbsp;
idea of how something like this is even&nbsp;&nbsp;

00:04:30.720 --> 00:04:35.920
possible in the first place, but it doesn't&nbsp;
quite get us to the solution just yet.&nbsp;&nbsp;

00:04:35.920 --> 00:04:41.360
If all we're doing is interleaving frames, then&nbsp;
not only does the flicker get kind of annoying,&nbsp;&nbsp;

00:04:41.360 --> 00:04:47.600
but it also doesn't explain how we get a custom&nbsp;
message at 30 FPS. If we tried drawing something&nbsp;&nbsp;

00:04:47.600 --> 00:04:53.920
on those other frames, the 60 FPS playback would&nbsp;
now blend and blur the two shapes together.

00:04:53.920 --> 00:04:58.720
We could try to work around this by subtracting&nbsp;
the unwanted frame from the desired output,&nbsp;&nbsp;

00:04:58.720 --> 00:05:03.360
creating a sort of optical illusion that&nbsp;
cancels out certain parts of the image.&nbsp;&nbsp;

00:05:03.360 --> 00:05:06.000
But this makes the flicker even worse,&nbsp;&nbsp;

00:05:06.000 --> 00:05:10.960
and pausing the video at any point could&nbsp;
expose the image that we're trying to hide.

00:05:10.960 --> 00:05:14.960
So, clearly, this isn't the full&nbsp;
solution. And, in fact, if you go&nbsp;&nbsp;

00:05:14.960 --> 00:05:19.200
back to the demonstration at the beginning of&nbsp;
the video and step through it frame-by-frame,&nbsp;&nbsp;

00:05:19.200 --> 00:05:26.160
you'll notice that there's definitely a lot more&nbsp;
going on, especially at 1080p. To understand this,&nbsp;&nbsp;

00:05:26.160 --> 00:05:31.520
we'll have to take a look at the&nbsp;
other factor – that is, resolution.

00:05:31.520 --> 00:05:36.800
Scaling down a video might seem like a fairly&nbsp;
simple task – just reduce the amount of pixels&nbsp;&nbsp;

00:05:36.800 --> 00:05:42.240
in the frame. But what's not so simple&nbsp;
is figuring out which pixels to keep.&nbsp;&nbsp;

00:05:42.240 --> 00:05:49.840
If you're going from 1920x1080 to 640x360,&nbsp;
then that's 3 times fewer pixels per axis,&nbsp;&nbsp;

00:05:49.840 --> 00:05:55.440
or 9 times fewer total. This means that&nbsp;
a 3x3 grid of pixels would get condensed&nbsp;&nbsp;

00:05:55.440 --> 00:06:00.320
down to just one pixel. You could do this&nbsp;
by arbitrarily picking one of the pixels&nbsp;&nbsp;

00:06:00.320 --> 00:06:05.520
in the grid and drawing that, but then you're&nbsp;
effectively discarding most of the information,&nbsp;&nbsp;

00:06:05.520 --> 00:06:10.080
which might misrepresent the actual&nbsp;
contents of that area. Instead,&nbsp;&nbsp;

00:06:10.080 --> 00:06:15.840
the most common way to do this is to average the&nbsp;
color value of the whole area. This seems to be&nbsp;&nbsp;

00:06:15.840 --> 00:06:21.120
the approach that YouTube uses, and it's often&nbsp;
the best balance between speed and accuracy.

00:06:21.120 --> 00:06:25.280
But regardless of how you do it,&nbsp;
this is a destructive process&nbsp;&nbsp;

00:06:25.280 --> 00:06:31.920
with an unavoidable caveat – one output&nbsp;
can have multiple inputs. For example,&nbsp;&nbsp;

00:06:31.920 --> 00:06:37.520
a perfectly monotone kernel will obviously come&nbsp;
out to a pixel of the same color, but a noisier&nbsp;&nbsp;

00:06:37.520 --> 00:06:43.440
area with a distinguishable pattern could still&nbsp;
average out to that same color. Mathematically,&nbsp;&nbsp;

00:06:43.440 --> 00:06:48.480
this makes sense, but if you surround the&nbsp;
noisy pattern with a solid background, then&nbsp;&nbsp;

00:06:48.480 --> 00:06:54.240
even though they average to the same color, you&nbsp;
can clearly spot the pattern at full resolution.

00:06:54.240 --> 00:06:59.760
It's also worth noting that some patterns are more&nbsp;
visible than others. A checkerboard or grid might&nbsp;&nbsp;

00:06:59.760 --> 00:07:06.560
feel very noisy and contrasting close-up, but when&nbsp;
you zoom out, your eyes start to blur it together.&nbsp;&nbsp;

00:07:06.560 --> 00:07:12.720
However, regular patterns like straight&nbsp;
lines are easier to see even at small scales,&nbsp;&nbsp;

00:07:12.720 --> 00:07:17.040
because your brain is less likely&nbsp;
to filter that information as noise.

00:07:17.040 --> 00:07:22.720
And the choice between horizontal and vertical&nbsp;
lines also matters. On certain displays,&nbsp;&nbsp;

00:07:22.720 --> 00:07:26.800
changes in viewing angle can impact&nbsp;
which pixels you see. This effect&nbsp;&nbsp;

00:07:26.800 --> 00:07:32.080
is most noticeable if the offset axis is&nbsp;
perpendicular to the lines. In other words,&nbsp;&nbsp;

00:07:32.080 --> 00:07:37.520
horizontal lines permit horizontal view offset,&nbsp;
and vertical lines permit vertical view offset.

00:07:37.520 --> 00:07:41.360
I figured that it's probably far less likely&nbsp;
that you're watching this with your screen&nbsp;&nbsp;

00:07:41.360 --> 00:07:45.840
turned to the side, unless there are multiple&nbsp;
people sat around the same screen, but I'll&nbsp;&nbsp;

00:07:45.840 --> 00:07:51.440
take my chances. It is far more likely, however,&nbsp;
that you're watching this on a phone, a laptop,&nbsp;&nbsp;

00:07:51.440 --> 00:07:59.360
or a TV that isn't exactly eye-level. And, because&nbsp;
of this, I chose the vertical stripe pattern.

00:07:59.360 --> 00:08:04.320
So then, to draw an image using this trick,&nbsp;
we can take a mask of the intended shape and&nbsp;&nbsp;

00:08:04.320 --> 00:08:09.600
use it as a reference for the placement of the&nbsp;
3x3 kernels. So, again, if you're watching this&nbsp;&nbsp;

00:08:09.600 --> 00:08:14.240
at anything other than 1080p, then the&nbsp;
pattern probably just disappeared. But,&nbsp;&nbsp;

00:08:14.240 --> 00:08:20.880
if you are watching at 1080p, then you should&nbsp;
see a reasonably clear image of that same mask.

00:08:20.880 --> 00:08:26.560
Now, 3 pixels is actually a very small quantity,&nbsp;
and it's possible that even if you're watching&nbsp;&nbsp;

00:08:26.560 --> 00:08:32.160
this at 1080p, other factors like the size of your&nbsp;
browser window, or the orientation of your phone,&nbsp;&nbsp;

00:08:32.160 --> 00:08:38.320
or even the settings on your TV, might impact&nbsp;
the visibility of the pattern. To address that,&nbsp;&nbsp;

00:08:38.320 --> 00:08:42.960
I decided to combine this trick with the&nbsp;
previously mentioned frame interleaving trick,&nbsp;&nbsp;

00:08:42.960 --> 00:08:49.520
placing the original mask on every odd&nbsp;
frame to make it show up only at 60 FPS.&nbsp;&nbsp;

00:08:49.520 --> 00:08:55.360
This also reduces the flicker, because this&nbsp;
time, a part of the image is always visible.

00:08:55.360 --> 00:09:02.400
But it still doesn't solve our earlier problem of&nbsp;
getting an image to show up exclusively for lower&nbsp;&nbsp;

00:09:02.400 --> 00:09:08.480
resolutions. Right now, we can get a pattern to&nbsp;
show up for 1080p, but at any other resolution,&nbsp;&nbsp;

00:09:08.480 --> 00:09:14.160
nothing shows up. That's because, again,&nbsp;
downscaling is a destructive process. We're&nbsp;&nbsp;

00:09:14.160 --> 00:09:20.320
actively losing information at lower settings. So,&nbsp;
to make a custom image show up at a lower quality,&nbsp;&nbsp;

00:09:20.320 --> 00:09:26.000
we'd have to find a way to somehow reveal&nbsp;
new patterns by dropping information.

00:09:26.000 --> 00:09:30.320
At first, I tried creating a field of&nbsp;
high-contrast white noise, where some&nbsp;&nbsp;

00:09:30.320 --> 00:09:36.080
kernels contained one white pixel more than the&nbsp;
rest. The idea was that, when this is scaled down,&nbsp;&nbsp;

00:09:36.080 --> 00:09:40.880
the noise would average out, and the result&nbsp;
would be a clean image. And while yes,&nbsp;&nbsp;

00:09:40.880 --> 00:09:47.200
that did work, you can also clearly see the&nbsp;
pattern at 1080p. The brain is just very good&nbsp;&nbsp;

00:09:47.200 --> 00:09:52.480
at finding such patterns, even though the&nbsp;
difference is just one pixel per kernel!

00:09:52.480 --> 00:09:57.520
So, okay, let's take a step back and approach&nbsp;
the problem from a different angle. What&nbsp;&nbsp;

00:09:57.520 --> 00:10:03.120
characteristics are unique to low-quality images?&nbsp;
Sure, you could talk about pixel count and&nbsp;&nbsp;

00:10:03.120 --> 00:10:09.200
whatnot, but more generally, high-quality images&nbsp;
are sharper than their low-quality counterparts.&nbsp;&nbsp;

00:10:09.200 --> 00:10:15.280
We can express this more formally as the&nbsp;
frequency of details decreasing as you go down.

00:10:15.280 --> 00:10:20.000
For example, think back to the times that you've&nbsp;
seen a weird-looking cloud in the sky and thought:&nbsp;&nbsp;

00:10:20.000 --> 00:10:23.760
"hey, if I squint hard enough, it&nbsp;
kinda looks like a puppy!" And,&nbsp;&nbsp;

00:10:23.760 --> 00:10:28.720
if you only had the blurred version of that&nbsp;
picture, you might as well associate that with&nbsp;&nbsp;

00:10:28.720 --> 00:10:34.480
a child's painting of a dog, whereas at full&nbsp;
quality, it's obvious that these are clouds.

00:10:34.480 --> 00:10:39.840
The point is, that is an example of a case&nbsp;
where lower image quality actually reveals&nbsp;&nbsp;

00:10:39.840 --> 00:10:44.960
more information. Applying this to our problem,&nbsp;
you can imagine that if our pattern had some&nbsp;&nbsp;

00:10:44.960 --> 00:10:49.120
blurry text in the background, it would be&nbsp;
harder to make it out than the much more&nbsp;&nbsp;

00:10:49.120 --> 00:10:54.640
clearly visible foreground pattern. And,&nbsp;
the brain is lazy, so it'll almost always&nbsp;&nbsp;

00:10:54.640 --> 00:10:59.920
choose to interpret the thing that it sees&nbsp;
first. But, if you remove the high-frequency&nbsp;&nbsp;

00:10:59.920 --> 00:11:05.440
foreground pattern, it has no choice but&nbsp;
to focus on the low-frequency background.

00:11:05.440 --> 00:11:10.640
Of course, this optical illusion isn't as strong&nbsp;
as the rest, so you do have to be a bit clever&nbsp;&nbsp;

00:11:10.640 --> 00:11:16.320
in how you use it. The word "LOWER" was chosen&nbsp;
deliberately, because it aligns perfectly with&nbsp;&nbsp;

00:11:16.320 --> 00:11:20.960
the characters in the foreground text.&nbsp;
"L" is very similar in shape to "1",&nbsp;&nbsp;

00:11:20.960 --> 00:11:26.400
just with an extra leg, "O" is the same shape&nbsp;
as "0", "W" fits in the lower half of the "8",&nbsp;&nbsp;

00:11:26.400 --> 00:11:32.000
"E" can be rounded down to fit mostly within the&nbsp;
second "0", and "R" is again the same shape as&nbsp;&nbsp;

00:11:32.000 --> 00:11:37.680
"P", just with an extra leg. When layered on&nbsp;
top of the line pattern on only even frames,&nbsp;&nbsp;

00:11:37.680 --> 00:11:46.080
it becomes nearly invisible at 1080p, but at&nbsp;
360p, it is the only visible thing remaining.

00:11:46.080 --> 00:11:50.640
Now all that's left to discuss is how I&nbsp;
got the timeline to show something that's&nbsp;&nbsp;

00:11:50.640 --> 00:11:54.560
completely different from any frame in&nbsp;
the video. While the techniques we've&nbsp;&nbsp;

00:11:54.560 --> 00:11:58.720
talked about so far have been rooted&nbsp;
in optical illusions and steganography,&nbsp;&nbsp;

00:11:58.720 --> 00:12:03.920
this next part involves an exploit&nbsp;
hidden in the video file itself.

00:12:03.920 --> 00:12:07.920
You see, while putting together this&nbsp;
video, I ran a lot of tests on an alt&nbsp;&nbsp;

00:12:07.920 --> 00:12:13.280
account to determine how exactly YouTube handles&nbsp;
different kinds of video files. Specifically,&nbsp;&nbsp;

00:12:13.280 --> 00:12:17.360
I was looking for a way to make the&nbsp;
60 FPS and 30 FPS streams capture a&nbsp;&nbsp;

00:12:17.360 --> 00:12:22.720
completely different set of frames. For&nbsp;
example, if you uploaded a 90 FPS video,&nbsp;&nbsp;

00:12:22.720 --> 00:12:28.400
there would technically be enough room to&nbsp;
assemble two distinct 60 and 30 FPS clips&nbsp;&nbsp;

00:12:28.400 --> 00:12:34.880
with no overlap. So, I was basically hoping to&nbsp;
find some way to "trick" YouTube into doing this.

00:12:34.880 --> 00:12:41.200
Unfortunately, what I found indicates that YouTube&nbsp;
first transcodes the video to 60 FPS or below,&nbsp;&nbsp;

00:12:41.200 --> 00:12:46.400
and then takes every other frame from the result&nbsp;
of that. This guarantees that the low-quality&nbsp;&nbsp;

00:12:46.400 --> 00:12:52.000
and high-quality video streams both contain the&nbsp;
same content, and it's also probably much cheaper&nbsp;&nbsp;

00:12:52.000 --> 00:12:57.120
for YouTube to reprocess their compressed&nbsp;
version instead of the original material.&nbsp;&nbsp;

00:12:57.120 --> 00:13:04.400
But there is one place where they do seem to&nbsp;
be using the original clip – the timeline.

00:13:04.400 --> 00:13:09.760
You see, the average MP4 file doesn't just&nbsp;
contain screenshots of every video frame. No,&nbsp;&nbsp;

00:13:09.760 --> 00:13:11.840
that would take up far too much space,&nbsp;&nbsp;

00:13:11.840 --> 00:13:19.600
so instead, videos consist of three types&nbsp;
of frames: I-frames, P-frames, and B-frames.

00:13:19.600 --> 00:13:22.880
I-frames are what you would&nbsp;
traditionally consider a "full frame",&nbsp;&nbsp;

00:13:22.880 --> 00:13:27.200
or a "keyframe". They contain full&nbsp;
image data for the entire screen,&nbsp;&nbsp;

00:13:27.200 --> 00:13:32.400
and are thus the least common type found in the&nbsp;
average video file. P-frames, on the other hand,&nbsp;&nbsp;

00:13:32.400 --> 00:13:38.720
contain only the differences from the last frame.&nbsp;
This naturally enables far better compression, but&nbsp;&nbsp;

00:13:38.720 --> 00:13:44.560
also means that they cannot stand on their own.&nbsp;
And finally, B-frames can contain information from&nbsp;&nbsp;

00:13:44.560 --> 00:13:51.360
both past and future frames. These compress even&nbsp;
better, but are a lot more complicated to decode.

00:13:51.360 --> 00:13:54.880
If you're a YouTube engineer looking&nbsp;
to extract a representative timeline&nbsp;&nbsp;

00:13:54.880 --> 00:14:00.320
preview as cheaply as possible, it might&nbsp;
be tempting to simply extract the I-frames&nbsp;&nbsp;

00:14:00.320 --> 00:14:06.880
without doing any actual video processing. But&nbsp;
you also shouldn't trust these I-frames fully.&nbsp;&nbsp;

00:14:06.880 --> 00:14:12.480
It is entirely possible to create a video that&nbsp;
consists of just P-frames, with only a single&nbsp;&nbsp;

00:14:12.480 --> 00:14:18.240
I-frame at the very beginning. So, if it seems&nbsp;
like the I-frames are particularly unreasonable,&nbsp;&nbsp;

00:14:18.240 --> 00:14:23.920
it makes sense to re-encode the video first. Of&nbsp;
course, I can't know for certain that this is the&nbsp;&nbsp;

00:14:23.920 --> 00:14:29.040
process that YouTube uses, but my testing&nbsp;
indicates that it's likely pretty close.

00:14:29.040 --> 00:14:34.320
So, as you might suspect, the key to exploiting&nbsp;
this is to create a high-framerate video,&nbsp;&nbsp;

00:14:34.320 --> 00:14:39.120
and insert unique I-frames among the frames&nbsp;
that are going to be dropped when it gets&nbsp;&nbsp;

00:14:39.120 --> 00:14:44.880
re-encoded to 60 FPS. If the new I-frames&nbsp;
are sensible enough, YouTube may choose&nbsp;&nbsp;

00:14:44.880 --> 00:14:50.960
to extract them directly, before they get&nbsp;
completely removed from the final video.

00:14:50.960 --> 00:14:56.240
Now, if I'm making this process sound fragile,&nbsp;
well, that's because it is. If any of these&nbsp;&nbsp;

00:14:56.240 --> 00:15:00.880
tricks fails over time, I'm willing to bet&nbsp;
that this will be the first one to go. All&nbsp;&nbsp;

00:15:00.880 --> 00:15:06.480
it takes is for YouTube to re-encode the video&nbsp;
once. Even just using YouTube's built-in editing&nbsp;&nbsp;

00:15:06.480 --> 00:15:11.760
tool might ruin it, so here's hoping I don't&nbsp;
have to blur or cut anything out of this video.

00:15:11.760 --> 00:15:15.840
Anyway, now you know how I set up&nbsp;
that demonstration at the beginning,&nbsp;&nbsp;

00:15:15.840 --> 00:15:20.400
but, to be clear, this isn't the&nbsp;
only way to do it. Technically,&nbsp;&nbsp;

00:15:20.400 --> 00:15:26.720
there is a way to show two completely different&nbsp;
video streams, but it comes with a few caveats.

00:15:26.720 --> 00:15:30.880
Let's come back to that frame interleaving method&nbsp;
from earlier – the problem with this one was&nbsp;&nbsp;

00:15:30.880 --> 00:15:36.720
that the 60 FPS stream would invariably&nbsp;
contain frames from both clips. However,&nbsp;&nbsp;

00:15:36.720 --> 00:15:42.240
assuming a 60 Hz display, the viewer can&nbsp;
choose to filter out half of the frames&nbsp;&nbsp;

00:15:42.240 --> 00:15:47.920
by doubling the playback speed. But,&nbsp;
there are two major issues with this.

00:15:47.920 --> 00:15:52.880
First, that 60 Hz clause is a pretty big&nbsp;
assumption. Many of you are likely watching this&nbsp;&nbsp;

00:15:52.880 --> 00:15:58.720
on way faster displays, so doubling the playback&nbsp;
rate wouldn't change which frames you see. But,&nbsp;&nbsp;

00:15:58.720 --> 00:16:03.440
perhaps more importantly, it also doesn't&nbsp;
actually remove any frames from the video.&nbsp;&nbsp;

00:16:03.440 --> 00:16:08.720
All it does is simply doubles the time step&nbsp;
between frames. So not only is it impossible to&nbsp;&nbsp;

00:16:08.720 --> 00:16:13.040
guarantee that you're starting on the correct&nbsp;
frame, it's also possible for the time step&nbsp;&nbsp;

00:16:13.040 --> 00:16:18.800
to de-sync if the playback ever stutters,&nbsp;
thus randomly changing which clip you see.

00:16:18.800 --> 00:16:23.360
Here, I'll let you see for yourself – in&nbsp;
just a moment, if you're watching at 30 FPS,&nbsp;&nbsp;

00:16:23.360 --> 00:16:28.400
you'll see a 30-second speedrun of the&nbsp;
map "Ceiling Catapult" from Portal 2.&nbsp;&nbsp;

00:16:28.400 --> 00:16:35.200
But, if you're watching at 60 FPS and 60 Hz at 2x&nbsp;
playback rate, you might see the same run sped up,&nbsp;&nbsp;

00:16:35.200 --> 00:16:40.640
or you might see a 15-second run of "Pit&nbsp;
Flings". Or some combination of the two. And,&nbsp;&nbsp;

00:16:40.640 --> 00:16:45.606
if you're watching at any other configuration,&nbsp;
you'll likely see a flickering mess.

00:16:45.606 --> 00:16:47.365
You've been warned.

00:17:15.280 --> 00:17:17.600
Thanks to Burger40 for the gameplay clips.

00:17:17.600 --> 00:17:22.880
Now, obviously, this approach is a lot closer to&nbsp;
what you might expect from this kind of project,&nbsp;&nbsp;

00:17:22.880 --> 00:17:28.000
but the general inconsistency and hardware&nbsp;
assumptions are the main reasons why I ended&nbsp;&nbsp;

00:17:28.000 --> 00:17:33.520
up going with an otherwise far more complicated&nbsp;
and less flashy demonstration for the intro.

00:17:33.520 --> 00:17:38.160
I also tried uploading at 4K, at high&nbsp;
frame rates, and a bunch of other stuff,&nbsp;&nbsp;

00:17:38.160 --> 00:17:42.240
so I'm pretty confident that I haven't&nbsp;
missed anything major. If you think I have,&nbsp;&nbsp;

00:17:42.240 --> 00:17:45.840
let me know in the comments. Oh, but&nbsp;
do check the pinned comment first – I&nbsp;&nbsp;

00:17:45.840 --> 00:17:49.360
always try to post the answers to&nbsp;
the most common questions there.

00:17:49.360 --> 00:17:54.160
So, if you found any of this interesting, please&nbsp;
consider subscribing – this is exactly the kind&nbsp;&nbsp;

00:17:54.160 --> 00:17:58.800
of stuff we like to do around here. And, if you&nbsp;
happen to be looking for a tutor or consultant&nbsp;&nbsp;

00:17:58.800 --> 00:18:05.120
on your personal projects, you can now pay&nbsp;
me money to book my time at learn.p2r3.com.

00:18:05.120 --> 00:18:09.440
Or, if you instead want to learn how to&nbsp;
code with expertly crafted hands-on courses,&nbsp;&nbsp;

00:18:09.440 --> 00:18:13.040
check out Boot.dev by using&nbsp;
the link in the description.

