# Video upload - one file in, seven encodes out

> Why a durable receipt for a 500 MB upload and a video that plays everywhere are two separate promises. Every upload gets the full ladder eagerly, and the 500…

Source: https://tierslate.com/templates/youtube-upload

Video & media · System design · core · 11 step walkthrough · 5 tables

Why a durable receipt for a 500 MB upload and a video that plays everywhere are two separate promises.

**Own this board: 400 credits.** The first act plays on the page. Owned once with credits, never a subscription.

## What this board gets wrong on purpose

The tension: Every upload gets the full ladder eagerly, and the 500 MB master is kept forever on top of it. Most videos on a service like this are watched fewer than ten times, so the 1080p AV1 rung - which costs 7.4 of the 14 core-minutes each source minute burns, more than every other rung combined - is usually encoded for nobody. The honest alternative is to encode 360p now and the rest on first demand, which cuts the compute bill by more than half and makes the first viewer of a cold video wait. Nothing on this board can tell those two videos apart at upload time, because the only signal that separates them - whether anyone watches - arrives after the money is already spent.

## Practise this as an interview

Take Video upload - one file in, seven encodes out as a timed system design interview on a blank board - on your own, with the requirements to check yourself against, or with a candidate you invite.

## Start here

### Why this design

Video upload is the interview question about promises that pull in opposite directions: an immediate, durable receipt for a 500 MB file over a flaky connection, and a video that eventually plays on every device. It probes whether you can split a system at the point where the client goes away, make an upload resumable rather than merely retryable, and price an asynchronous pipeline whose cost lands before the video has earned a single view. Every product that accepts large user files - video, podcasts, design assets, backups - faces the same split.

### What you will learn

- How a resumable session works: 100 chunks of 5 MiB, each a PUT with Content-Range, and the server - never the client - answering "resume from byte N".
- Why the creator is told "done" when the master is durable, not when anything plays, and why "Processing" is the gap between two writers of one state field.
- Why the source is cut on keyframes into ~6 second segments, so 200 machines encode one film in parallel.
- Where the money goes: 14 core-minutes per source minute, 7.4 of them on the 1080p AV1 rung - $13.6M a year of compute before anyone presses play.
- Why the renditions (624 MB) are bigger than the master (500 MB), and why CMAF packaged once serves both DASH and HLS from the same bytes.

### How to read this board

1. Diagram first, top band: WHILE THE CREATOR IS WATCHING - creator, uploader, upload edge, the upload API hex and its session store. It ends at the master store, because that is where the client is told "done".
2. Then DURABLE - AND ON THE BILL on the right: the master store and the video record that both halves write.
3. Then below the fold, AFTER THE CONNECTION CLOSED - WHERE THE MINUTES GO: the job queue, segmenter, rendition fan-out and its three rung boxes, plus the frame sampler; then PACKAGE AND PUBLISH. Press play for the eleven step walkthrough.
4. Then the pages in order: 1 · Requirements, 2 · Capacity estimation (the transcode fleet is the real capacity question), 3 · Storage estimation, 4 · Availability, 5 · How it works, 6 · Deployment plan.
5. Finally DATA MODEL - WHAT GENERATE SQL READS, below the pages: one row per video, per rendition, per job attempt, and a session row deleted once the master is durable.
6. The conversation to have: the whole ladder is encoded eagerly for every upload and the master is kept forever, while most videos are watched fewer than ten times. Encoding 360p now and the rest on first demand halves the compute bill and makes the first viewer of a cold video wait - argue that trade with the numbers on pages 2 and 3.

## 1 · Requirements

A creator uploads one file. The service owes them two things that pull in opposite directions: an immediate, durable receipt, and a video that eventually plays everywhere. Everything below follows from separating those two promises.

### Functional

- Upload one video file of up to 256 GB and receive a durable receipt before any encoding has started.
- Survive a lost connection: an interrupted upload resumes from the last byte the server acknowledged, not from zero.
- Transcode every accepted upload into a ladder of renditions and package it for both DASH and HLS.
- Extract a poster frame and a scrub-bar storyboard sprite from the source.
- Expose the state of a video - uploading, processing, ready, failed - and the reason for a failure.
- Retain the master so the whole catalogue can be re-encoded when a better codec arrives.

### Non-functional

- Upload API availability 99.9 percent monthly. A chunk PUT must be retryable without corrupting the session.
- Time to first playable rendition: p50 under 90 seconds, p95 under 8 minutes. Full ladder p95 under 30 minutes.
- Master durability 11 nines. A lost master is content loss that no backup of the database can undo.
- No accepted byte is ever silently dropped: an upload either becomes a master object or is reported missing.
- Cost per uploaded minute is a tracked, alarmed figure, because it is the dominant variable cost of the product.

### Questions to ask before designing this

- What is the size DISTRIBUTION of uploads, not the average? The mean drives storage, the p99 drives chunking and timeouts, and on a video product they are an order of magnitude apart.
- Is the ladder fixed or per-title? Per-title encoding moves the compute bill by 20 to 30 percent and adds a complexity-analysis pass before any encode starts.
- How long must a resumable session stay resumable? Seven days of resumability is seven days of half-uploaded objects you are paying to store and may never complete.
- Do we also have to ingest live? If yes, the segmenter and packager are shared with a system that cannot buffer, and that constraint reaches back into this board.
- What happens to a master after five years - archive tier, or delete it and keep the top rendition as the new source?
- Is the top rung a paid feature? If it has revenue attached, the eager-versus-lazy encoding argument has a different answer.
- Who is allowed to delete a video, and does delete mean the renditions, the master, or both? The answer decides whether the storage curve can ever go down.

## The rest of this board

This page publishes the question. The answer - 5 more written pages, an 11-step narrated walkthrough and a 5-table schema - is the board itself, and it opens in Tierslate.

- 5 written pages
- 11 walkthrough steps
- 5 tables (34 columns)

5 pages behind this one:

- Capacity estimation
- Storage estimation
- Availability
- How it works
- Deployment plan

## Related system design templates

- [Image CDN system design](https://tierslate.com/templates/image-cdn) - Why the cache key is the design, and why egress and the long tail of misses set the bill, not CPU.
- [Live streaming system design](https://tierslate.com/templates/live-streaming) - Why segment length sets latency, resilience and cost at once, and what each second removed costs.
- [Streaming playback system design](https://tierslate.com/templates/netflix-streaming) - Why streaming is a bandwidth problem, solved by placing the bytes inside the network before anyone asks.
- [Transcoding pipeline system design](https://tierslate.com/templates/video-transcoding) - Why one number, the size of a segment, sets the cost, latency and failure behaviour of the whole pipeline.
- [File upload system design](https://tierslate.com/templates/file-upload) - How presigned URLs send uploads straight to object storage, and what the server still has to check afterwards.
- [Music streaming system design](https://tierslate.com/templates/music-streaming) - Why audio is small enough to prefetch, and why play counts and royalties are the hard ledger underneath.
- [Short video feed system design](https://tierslate.com/templates/short-video-feed) - Why a short-video feed is ranking plus prefetch, and why the first second of video decides retention and cost.
- [Video calls system design](https://tierslate.com/templates/video-conferencing) - Why a group call forwards streams through an SFU, and how bandwidth estimation keeps a bad link from ruining the call.

All 100 system design templates: https://tierslate.com/templates (Markdown: https://tierslate.com/templates.md)
