Skip to content
System Design Explorer
Company architectureintermediate

YouTube System Design

Upload, transcode and stream more than 500 hours of video a minute

By Ankur NayakReviewed

How a video platform turns every upload into a ladder of resolutions and codecs and streams it worldwide: videos are split into chunks transcoded in parallel on Google's custom video chips (VCUs), stored in cloud storage, and delivered through a CDN to players that switch quality as bandwidth changes. Popular videos get more processing.

Open in Studio· edit a copy
Video uploaded
500+ hours/min
VCU efficiency
20–33x
Resolutions
144p to 4320p
VCUs per host
20
YouTube system design architecture diagramComponents: Creator, Upload Service, Video Work Scheduler, Transcoding (VCU (custom ASIC)), Cloud Storage, Metadata (Vitess) (MySQL), CDN, Google Global Cache, Viewer's Player. Connections: Creator to Upload Service (upload); Upload Service to Cloud Storage (original); Upload Service to Video Work Scheduler (processing graph); Upload Service to Metadata (Vitess) (title, channel); Video Work Scheduler to Transcoding (steps); Transcoding to Cloud Storage (variants); Cloud Storage to CDN (video files); CDN to Google Global Cache (fill); Google Global Cache to Viewer's Player (chunks); CDN to Viewer's Player (chunks).CreatorClientUpload ServiceAPI gatewayVideo Work SchedulerSchedulerTranscodingVCU (custom ASIC)Cloud StorageObject storageMetadata (Vitess)MySQLCDNCDNGoogle Global CacheCDNViewer's PlayerClient

Requirements

Functional

  • Upload videos of any length and format
  • Transcode each video into many resolutions and codecs
  • Stream videos to any device, adapting quality to the network
  • Support live streams as well as uploaded videos
  • Store video metadata: titles, channels, view counts

Non-functional

  • Handle hundreds of hours of new video every minute
  • Keep transcoding cost low for the long tail of rarely watched videos
  • Start playback fast and avoid buffering
  • Survive hardware failures without losing uploads

In depth

Video at warehouse scale

More than 500 hours of video are uploaded to YouTube every minute, according to YouTube's 2021 post on its video infrastructure. Each upload must be turned into many versions, at different resolutions and in different codecs, and streamed to viewers on every kind of device and network. The heavy part, transcoding, is unusually well documented: Google described its custom video chip and the system around it in a 2021 ASPLOS paper, "Warehouse-scale video acceleration: co-design and deployment in the wild".

Upload, metadata and recommendations aren't documented at the same level, so this page keeps them simple and marks them as inferred.

The platform in one picture

The paper's functional diagram of a video sharing platform is a straight line: Creator → Transcoding → Cloud Storage → Content Delivery Network → Viewer. Videos are computed and saved to the cloud storage system, then served as needed. Everything interesting happens in how each stage scales.

Why so many versions?

Viewers' bandwidth varies wildly, and lower resolutions mean smaller files that can be upscaled on the device. So each video is encoded into a ladder of resolutions (for 16:9 video, from 144p through 240p and up to 2160p and 4320p) and the player uses adaptive bitrate (ABR) streaming: it requests a lower resolution when bandwidth drops and a higher one when it recovers. The paper names H.264, VP9 and AV1 as the popular codecs.

Doing that for every upload is enormous work, and it grows with resolution: higher-resolution videos need far more compute.

Chunking and parallel transcoding

The video processing platform is built to run as much in parallel as possible. A video is split into chunks, closed Groups of Pictures, that can each be processed independently. A video becomes a graph of steps placed in a global work queue; each step is scheduled on machines in the data centre, and the results are reassembled into playable videos.

Each chunk can be transcoded in two ways. Single-output transcoding (SOT) reads a chunk, decodes it and encodes one output. Multiple-output transcoding (MOT) decodes the chunk once and then scales and encodes every output variant in parallel, for a 1080p input producing 1080p, 720p, 480p, 360p, 240p and 144p. MOT is generally preferred because it avoids redundant decodes; SOT is used when memory or latency require it.

Video is usually processed geographically close to the uploader, but the global scheduler can send it further away when local capacity is unavailable.

The VCU: a chip for video

Software transcoding on CPUs couldn't keep up. Google designed the Video (trans)Coding Unit, an ASIC whose encoder cores handle H.264 and VP9, and deployed them densely: 20 VCUs per host, many hosts per rack. Google reports 20 to 33 times better performance per cost than its previous, well-tuned CPU-based system, while meeting quality, throughput and latency requirements across video sharing, archival, live streaming and cloud gaming.

The chip alone wasn't the point; the paper's theme is co-design. The scheduler moved from a simple CPU-seconds cost model to an online multi-dimensional bin-packing scheduler that packs work by decoder and encoder capacity, horizontally scaled for the number of workers. All of it runs on Google's warehouse-scale infrastructure, with Borg managing resources across workloads.

Reliability is handled in software rather than in the chip. If a VCU errors, the work is rescheduled on another VCU or done in software, using the framework's normal retry mechanism. To stop faulty repair signals from taking out large amounts of capacity, the number of systems allowed in repair at once is capped.

Popularity changes everything

Video popularity follows a stretched power law, which the paper divides into three buckets:

  1. The very popular videos make up most watch time but a small share of transcoding and storage cost, so it's worth spending extra processing to compress them better and save bandwidth.
  2. Modestly watched videos get a moderate amount of resources.
  3. The long tail, most videos, are watched so rarely that the goal is to minimise storage and transcoding cost while keeping them playable.

Old videos can become popular later, so they may be reprocessed with the higher-popularity treatment long after upload.

Delivery

From cloud storage, videos are streamed through a content delivery network; see CDN. Google also runs Google Global Cache, caches hosted inside ISPs' networks that serve certain Google content locally and typically handle 70 to 90% of cacheable traffic. Google's page doesn't name YouTube, so the diagram marks that link as inferred.

Metadata

YouTube's metadata history has a well-known open-source footprint. Vitess was created at YouTube in 2010 to solve the scaling problems of its MySQL databases, with a proxy that routes queries to the right shard. It joined the CNCF in 2018 and graduated in 2019. How YouTube stores metadata today isn't public. See database sharding.

The trade-offs

Custom hardware delivered a step change in efficiency but took years of development, and software fallbacks are still needed. Popularity-aware processing spends compute where it saves the most bandwidth, at the cost of reprocessing videos that become popular later. MOT avoids redundant work but creates bigger tasks. Chunking makes long videos fast to process but requires reassembly.

Compare with Netflix, another video service built around a CDN, and with Google Search, another pipeline running on the same warehouse-scale infrastructure.

What to take into an interview

  • Store the original first, then process asynchronously through a work queue
  • Split videos into independent chunks and transcode them in parallel
  • Encode a ladder of resolutions and let the player adapt (ABR)
  • Spend more compute on popular videos; keep the long tail cheap
  • Serve from a CDN and caches close to viewers
  • Design for hardware failure with retries and fallbacks in software

Components

Creator

Client. Uploads a video file from a phone, a browser or a live encoder.

Upload Service

inferred

API gateway. Receives the original file and stores it before processing begins. Its internals aren't described in public sources.

Video Work Scheduler

Scheduler. Each video becomes a graph of steps placed in a global work queue. An online multi-dimensional bin-packing scheduler places steps on workers to use capacity well, usually near the uploader.

Why: VCUs are expensive; utilisation must be high data-centre-wide, not just per chip.

Borg

Scheduler. Google's warehouse-scale cluster manager, which runs the video workers alongside every other workload.

Transcoding

VCU (custom ASIC)

Worker. Workers with Video (trans)Coding Units, Google's custom chips for H.264 and VP9 encoding, 20 per host. Chunks are decoded once and encoded to every output resolution in parallel.

Why: Software transcoding on CPUs couldn't keep up with the growth of uploads and higher resolutions at an acceptable cost.

Chunker

Service. Splits the video into chunks, closed Groups of Pictures, that can each be processed independently.

Multiple-Output Transcode

Worker. Reads and decodes a chunk once, then scales and encodes every output variant in parallel (e.g. 1080p, 720p, 480p, 360p, 240p, 144p).

Single-Output Transcode

Worker. Produces one variant per task; used when memory or latency requires it.

Software Transcoder

CPU

Worker. If a VCU reports an error, the work is retried on another VCU or with software transcoding.

Assembler

Service. Joins the transcoded chunks back into playable videos for each resolution and codec.

Cloud Storage

Object storage. Holds the original and every transcoded variant, served as needed.

Metadata (Vitess)

MySQLinferred

SQL database. Vitess was created at YouTube in 2010 to scale its MySQL databases, with a proxy that routes queries to the right shard. How YouTube uses it today isn't public.

Building block: Database Sharding

CDN

CDN. Streams video files from Google's data centres to viewers over the internet.

Building block: CDN

Google Global Cache

inferred

CDN. Caches inside ISPs' networks that serve certain Google content locally, handling 70–90% of cacheable traffic. Google doesn't name YouTube on that page, so the link is inferred.

Viewer's Player

Client. Uses adaptive bitrate (ABR): requests a lower resolution when bandwidth drops and a higher one when it recovers.

Request flows

Upload and publish a video

  1. A creator uploads a 1080p video.
  2. The original file is stored safely before any processing.
  3. Its title, channel and other metadata are recorded.
  4. A graph of processing steps goes into the global work queue, normally near the uploader.
  5. Chunks are transcoded in parallel on VCUs into 1080p, 720p, 480p, 360p, 240p and 144p.
  6. Every variant is written to cloud storage.
  7. The creator sees the video is ready to publish.

Watch with adaptive bitrate

  1. The player starts at a resolution its bandwidth can sustain.
  2. The CDN serves the files from Google's data centres.
  3. Where an ISP hosts a Google Global Cache, cacheable content can come from inside the viewer's own network.
  4. Bandwidth drops on a train: the player asks for 360p chunks instead of 1080p and keeps playing.

An old video goes viral

  1. A years-old, rarely watched video suddenly gets millions of views.
  2. It moves into a higher popularity bucket and can be reprocessed with more compute for better compression.
  3. The smaller, better-compressed files replace the old ones, saving bandwidth on every view.

Failure scenarios

What if: the nearest transcoding capacity is full?

Videos are usually processed close to the uploader, but the global scheduler can send work to more distant data centres when local capacity is unavailable, and it adapts to load variations and infrastructure failures.

User impact: Processing may take slightly longer; uploads aren't lost.

  • Global work queue
  • Geographic overflow
  • Software transcoding as a fallback

What if: a viewer's bandwidth collapses?

Because every video exists at many resolutions, the player can switch to smaller files mid-stream instead of stalling: lower resolutions are smaller and can be upscaled on the device.

User impact: Lower picture quality for a while instead of buffering.

  • Adaptive bitrate streaming
  • A full ladder of resolutions per video

Trade-offs

Custom hardware for transcoding

Design an ASIC (the VCU) and co-design the scheduler around it.

Pros
  • 20–33x better efficiency than optimised CPUs
  • Enables higher compression and live use cases
Cons
  • Years of hardware development
  • Software fallbacks still needed

Popularity-aware processing

Spend extra compute on popular videos and minimal compute on the long tail.

Pros
  • Most watch time gets the best compression
  • Storage and compute are saved on rarely watched videos
Cons
  • Videos that become popular later must be reprocessed

Multiple-output over single-output transcoding

Decode each chunk once and encode all variants together.

Pros
  • No redundant decodes
  • Simpler scheduling per chunk
Cons
  • Bigger tasks; SOT still used when memory or latency require it

Chunked, parallel processing

Split videos into closed-GOP chunks and transcode them in parallel.

Pros
  • Long videos finish quickly
  • Work spreads across the warehouse
Cons
  • Chunks must be reassembled; quality across chunk boundaries needs care

Frequently asked questions

How does YouTube transcode videos?

Each upload is split into chunks (closed groups of pictures) that are transcoded in parallel on Google's custom Video Coding Units. A multiple-output transcode decodes a chunk once and encodes every resolution, and the chunks are then reassembled into playable videos.

What is adaptive bitrate streaming?

Every video is stored at several resolutions, and the player picks the one its current bandwidth can sustain, switching down when the connection weakens and back up when it improves. Viewers see lower quality instead of a buffering spinner.

What database does YouTube use?

YouTube created Vitess in 2010 to scale its MySQL databases: a proxy layer that routes queries to the right shard. Vitess later became an open-source CNCF project. YouTube hasn't published how its metadata storage looks today.

What is a VCU?

The Video (trans)Coding Unit is a chip Google designed to encode H.264 and VP9 video, deployed 20 per host in its data centres. Together with a scheduler built around it, Google reported 20 to 33 times better efficiency than its previous CPU-based transcoding.

Building blocks used

Sources