How YouTube Has Solved the Problem of Lag on Videos

4 min read · 8 years ago


How YouTube Has Solved the Problem of Lag on Videos image killing lag on YouTube with sliced bread 300x157How YouTube Has Solved the Problem of Lag on Videos

In an age when people can go to the moon, video call someone on the other side of the planet and make a movie with a mobile phone, how is it possible that lag time still exists with online video? YouTube, believe it or not, are aware that this is a serious problem and that it simply doesn’t make sense.

Behind the scenes, they have been working on reducing the amount of time between clicking play on a video… and when it actually decides to start playing. Similarly, they are hoping to stop that dreaded moment when a video pauses mid-way through to allow the download to catch up with your viewing progress.

If you could click on a video and it started playing with 200 milliseconds, you would perceive it as instant. John Harding, core engineering team leader at YouTube, says this is their goal. With LoveFilm, Netflix or similar, we don’t mind waiting for a programme or movie to download – because the content is usually of a substantial length. However, when it comes to YouTube videos, which are generally much smaller, lag time just seems unacceptable and frankly outdated.

YouTube’s sliced bread

Previously, on YouTube, an uploaded video would be copied into a number of different resolutions (360p, 480p, 720p, and 1080p). Each version was one whole file. If your Internet connection struggled to cope with a higher resolution version, you could toggle to a lower resolution – however, you would still be downloading one big file.

In April 2012 YouTube introduced Sliced Bread. Now, when a video gets uploaded it is still copied at different resolutions but there is an extra clever element – each copy, like a loaf of bread, is sliced into smaller chunks. This means that YouTube can serve your video by the slice and change the resolution dynamically, depending on how your Internet connection is performing. It may mean that you notice slight changes in resolution, but this is far less distracting than the dreaded interruption of a pause. If YouTube sees that your Internet connection is fast, it will give you slices of the high quality 1080p loaf. When it is slower, it will serve up a slice of lower quality bread.

YouTube claims that sliced bread has reduced re-buffering of videos by 40%. Good news. But it is going to get better as YouTube prepare to take us to the next level.

Here it is explained in a Gizmodo video:

GIZMODO – A Faster YouTube P. 1 from Gizmodo on Vimeo.

Parallel processing and pre-loading

As things currently stand, when you click on a YouTube video a number of things happen. Firstly, the watch page loads (the webpage the video is on). Secondly, the javascript that controls the page is downloaded. Finally the video player, and then the video itself start downloading. By this point, you can stream the video and watch it – if you haven’t already switched channel, so to speak.


Step one to speeding up playback is to download all of the elements in parallel so that the entire process takes less time. This would be an improvement, but the results aren’t life-changing.

Do less

YouTube believe that it is in transitioning from one video to another that you start to see significant reductions. So, for example, if you have watched one video and therefore have downloaded the video player etc, why should you need to download those things all over again? This amounts to a waste of time and contributes to the current delays. The future plan is that when you click to play another video, the page will download, the video will be requested immediately and the video will stream straight away – because the player is already loaded up from the previous video.

YouTube analyses user behaviour and they say that in general, people don’t just watch one video on YouTube and then leave. The educated assumption is that most viewers will click on ‘related’ or ‘suggested’ videos. So, what YouTube plans to do, is to pre-download the first slices of some of those related/suggested videos. Therefore, when (if!) you click on one of them, it will play instantly because it had a head start. This is great if YouTube can actually accurately predict the videos you click to play next.

Mobile video

In the settings of YouTube’s android app, there is new page for pre-loading, Essentially, if you tick the boxes, the app will pre-cache videos from channels you are subscribed to and from your Watch Later List. This means that if you decide to watch a video on your phone when you have a poor connection, these videos will play almost instantly. It is even possible to skip to different points in the video – no reloading.

This is a leap forward and will be welcome by everyone. The downside is that you do, of course, need some sort of connection to the Internet to watch the videos back (so no watching them the next time you are out of range). This is because YouTube need to perform at least one check to make sure you are still accessing the content. Also, in order to feed ads to you, YouTube need you to be connected to the Internet. This is no minor point.

It is exciting to know that these things are happening behind the scenes. This mobile pre-loading feature should be extended to iOS mobile devices very soon.

More Social articles from Business 2 Community: