Video from upload to play
Every stage between a creator pressing upload and a viewer pressing play.
When you finish, you should be able to say
Walk the media pipeline end to end with the numbers for storage and egress.
The route
6 blocks (4 fundamental, 1 senior, 1 staff), then the practice problem.
- Upload large files without touching your serversFundamental
- Keep large blobs out of the databaseFundamental
- Process uploads in parallelStaff
- Stream video to any connectionSenior
- Serve static bytes from the edgeFundamental
- Let browsers and proxies cacheFundamental
- Video Streaming Platform (YouTube / Netflix)
Next, step 1 adds Upload service, Object storage (outlined). A box fills in when you tick “I can explain this” on the block that introduces it; plain boxes come from the problem itself.
Large files should never pass through your API servers; this is how they bypass them.
Uploads stream through API servers, which become a bandwidth bottleneck.
Say it like this: API servers should never carry upload bytes, so the client asks for short-lived pre-signed URLs and sends the file straight to object storage in resumable parts, and the server only validates and records the result.
Adds to the design: Upload service, Object storage
Check yourself: How do you know the upload is complete and not corrupt?
The complete call is the only signal. The server assembles the parts, compares the stored size and checksum with what the client declared, and probes the file header to confirm it is the type claimed. Until that passes, the video row stays in uploading and nothing downstream runs.
Where the bytes live, and the properties that make it the right home.
Images, videos and uploads bloat the database and the app servers.
Say it like this: Bytes that are written once and read many times belong in object storage, which gives me eleven nines of durability and effectively unlimited capacity behind a plain HTTP interface, so my database and app servers never touch a blob.
Adds to the design: Object storage
Check yourself: Why not store files in the database?
Every replica, backup and cache would carry the bytes, and the database is optimised for small rows with indexes and transactions, not multi-gigabyte sequential reads. Object storage is built for exactly that shape and costs ten to fifty times less per gigabyte.
Transcoding as a DAG of parallel tasks with retries per chunk.
Transcoding a long video or processing a large file takes hours on one worker.
Say it like this: A two-hour upload would take hours on one encoder, so I split it at keyframes into chunks and run the encodes as a DAG of parallel tasks with per-task retries, which turns wall-clock time into a few minutes and makes a failure cost one chunk instead of the whole file.
Adds to the design: Transcoding workers, Transcode queue
Check yourself: Why cut at keyframes, and what is a GOP?
A group of pictures starts with a keyframe that can be decoded on its own, followed by frames that reference it. Cutting anywhere else leaves a chunk whose first frames depend on data in the previous chunk, so each chunk must begin at a keyframe to be encoded independently.
How the player picks quality per segment, and why segments exist.
One video file either buffers on slow links or wastes bandwidth on fast ones.
Say it like this: Connections vary by the second, so I transcode into a ladder of renditions, cut each into short segments, and let the player pick the bitrate per segment from the manifest based on the bandwidth it measures.
Adds to the design: Transcoding workers, Viewer player
Check yourself: How does the player decide which bitrate to request next?
It estimates available bandwidth from the last few segment downloads, smoothed to avoid reacting to noise, and looks at how many seconds are buffered. With a full buffer it can risk a higher rendition; with a draining buffer it steps down even if the last sample looked fine. The rule is usually: pick the highest bitrate that is some fraction, say 80%, of the estimate.
Segments are immutable and popular, which makes them the ideal thing to cache at the edge.
Users far from your servers wait on round trips for images, scripts, video segments.
Say it like this: Latency to users is dominated by distance, so I serve every static and cacheable byte from a CDN edge near them and let the origin handle only misses and dynamic requests.
Adds to the design: Origin shield, CDN edge
Check yourself: What can you cache on a CDN besides images and video?
Anything identical for every requester with the same key: API responses for public data, anonymous HTML, redirect responses, even 404s. The test is whether a response can be shared. If it depends on the user, keep it private or cache only the shared fragments.
The headers that let browsers and CDNs cache correctly for a year.
Clients re-download unchanged resources on every visit.
Say it like this: Most of what a client fetches has not changed, so I version static assets by content hash and cache them for a year, and give everything else a validator so the client can revalidate with a 304 instead of re-downloading.
Adds to the design: CDN edge
Check yourself: What is the difference between no-cache and no-store?
Putting it together
How the blocks above combine into one design for Video Streaming Platform. The numbers on the boxes are the steps that introduce each part.
The video platform, assembled from the path Each number is a step of this path; a box with two numbers is shaped by both blocks. The ring colour is the block's category, as on the route map. Boxes without a number come from the problem itself. Point at a step below, or at a bubble, to see where it appears.
Creators upload straight to object storage with pre-signed multipart URLs, a queue-driven worker fleet encodes chunks in parallel into five renditions, and viewers stream segments from the CDN, which almost never goes back to the origin. API servers never touch video bytes.
How each block shows up in the design
- 1. Upload large files without touching your servers: the upload service creates the metadata row and returns pre-signed multipart URLs, and the creator app PUTs 5 to 50 MB parts straight to object storage in parallel, so 500 TB a day of ingest never passes through an API server.
- 2. Keep large blobs out of the database: originals, segments and manifests live in object storage under keys like v/video_id/rendition/seg_n.m4s, while the metadata database holds only small rows; lifecycle rules move originals to cold storage after transcoding and abort abandoned multipart uploads.
- 3. Process uploads in parallel: completing the upload enqueues a job, the orchestrator splits the file at GOP boundaries into 10 to 30 s chunks, and stateless workers encode one chunk and rendition each, turning about 50 core-minutes per 10-minute video into one or two minutes of wall-clock time.
- 4. Stream video to any connection: the workers produce five renditions from 240p to 1080p with segments cut at the same keyframes, and the player measures each segment's download speed and switches rendition at the next 4 s boundary without a glitch.
- 5. Serve static bytes from the edge: viewers fetch manifests and segments from the nearest CDN edge, misses go through an origin shield so each segment is fetched from storage once per region, and a hit rate of at least 95% keeps origin egress under 5% of the roughly 10 Tbps peak.
- 6. Let browsers and proxies cache: segments are immutable and cached for a year because a re-encode writes new keys, while manifests are cached for minutes because renditions can be added later; private videos use signed URLs the edge validates.
- ★
Video Streaming Platform (YouTube / Netflix)
Now run the timed practice. The blocks above should appear in your answer without prompting; if one does not, that is the one to reread.
The same parts on other clouds
The diagrams above name AWS services as one concrete example. Every part has a close equivalent elsewhere. In an interview, name the role first, such as “a managed Redis cache”, then the product you would pick.
| AWS | Used here as | Google Cloud | Microsoft Azure | Open source and others |
|---|---|---|---|---|
| Amazon EC2 Auto Scaling | Upload service, Upload API, API, HTML / stats API | Compute Engine managed instance groups | Virtual Machine Scale Sets | Kubernetes Deployment with a HorizontalPodAutoscaler, Nomad |
| Amazon Aurora | Metadata DB | AlloyDB for PostgreSQL, Cloud SQL | Azure Database for PostgreSQL or MySQL | PostgreSQL, MySQL, CockroachDB |
| Amazon S3 | Object storage, Bucket: standard, Infrequent access, Archive, Origin / object store | Cloud Storage | Blob Storage | Cloudflare R2, MinIO, Ceph |
| Amazon EC2 | Transcoding workers, Probe + split, Encode 1080p, Encode 720p, Encode 480p / 360p, Side tasks, Package | Compute Engine | Azure Virtual Machines | DigitalOcean Droplets, any VM or bare metal |
| Amazon SQS | Transcode queue | Pub/Sub, Cloud Tasks | Service Bus queues, Queue Storage | RabbitMQ, ActiveMQ |
| Amazon CloudFront | Origin shield, CDN edge, CDN, Edge PoP | Cloud CDN, Media CDN | Azure Front Door | Cloudflare, Fastly, Akamai |
| Amazon DynamoDB | Metadata DB | Firestore, Bigtable | Cosmos DB | ScyllaDB, Apache Cassandra |
| AWS Step Functions | Orchestrator | Workflows | Logic Apps, Durable Functions | Temporal, Apache Airflow |