Design YouTube
YouTube looks simple: creators upload videos, viewers click play. Behind it are huge numbers: in 2020 it had 2 billion monthly active users, 5 billion videos watched per day, and 500 hours of video uploaded every minute. This chapter designs a video-sharing platform. The same ideas apply to Netflix, Hulu and others.
- 14.1Requirements and estimationUpload videos fast; smooth streaming; ability to change video quality Mobile apps, web browsers and smart TVs; international users; most…
- 14.2High-level design: the video uploading flowAt the highest level there are three parts: the client, a CDN that stores and streams videos, and API servers for everything else (feed…
- 14.3Video streaming and adaptive bitrateDownloading means copying the whole video before watching. Streaming means your device receives the video continuously and plays it…
- 14.4Video transcoding and the DAG modelA recorded video is in a raw format that takes huge space: an hour of HD video at 60 frames per second can take up hundreds of GB.…
- 14.5Video transcoding architecturePreprocessor: (1) splits the video into Group of Pictures (GOP) chunks, independently playable units of a few seconds (old clients that…
- 14.6Optimizations: speed, safety and cost⚡ Speed Parallelize uploading: the client splits the video into GOP-aligned chunks and uploads them in parallel. A failed chunk can be…
- 14.7Error handling and wrap upTwo kinds of errors: Recoverable: e.g. a video segment fails to transcode. Retry a few times; if it keeps failing and can't be recovered,…