Uploaded November 2026 | Updated November 2026, 4 days ago
A lakh views, twenty terabytes of video, and only about one terabyte comes from the main server. How?
You upload a video from your phone, and people all over the world watch it without buffering, even on a slow network. What happens in between?
The problem: the original file is very heavy, and every viewer has a different network and screen. One file for everyone is too big for some and too poor for others.
Four steps:
1. Encode: a codec like H.264, VP9 or AV1 compresses the video. It does not store every frame in full, mostly it writes down what changed from the frame before. Newer codecs give the same quality in fewer bits, but take much longer to encode.
2. Quality ladder: encode the same video at several resolutions and bitrates, from 144p up to 1080p or 4K.
3. Segments: chop every quality into pieces of a few seconds and write a manifest (HLS, DASH) saying which pieces live where. The player can change quality on every piece and jump into the middle of a video.
4. CDN: pieces live in origin storage and edge servers cache copies close to viewers' cities. Example maths: about 200 MB per view x 1 lakh views = 20 TB. If 95 % of requests are served from the edge cache, only about 1 TB comes from the origin.
The catch: a CDN is a cache, not storage. Popular videos stay at the edge, old videos with a couple of views a day get pushed out and come from a regional cache or the origin, a little slower. Encoding costs real money, so a common pattern is a fast, cheap codec first and a re-encode with a more efficient codec once a video gets popular.
Coming up next in System Design Interview: design all of YouTube, from the upload to the view count. Comment and tell me: what quality do you usually watch videos at? Follow for the full series.
kgptalkie.com
#shorts #SystemDesign #CDN #VideoEncoding #HLS #Backend #BackendEngineering #DistributedSystems #SoftwareEngineering #SystemDesignConcepts #SystemDesignInterview #KGPTalkie
A lakh views, twenty terabytes of video, and only about one terabyte comes from the main server. How?
You upload a video from your phone, and people all over the world watch it without buffering, even on a slow network. What happens in between?
The problem: the original file is very heavy, and every viewer has a different network and screen. One file for everyone is too big for some and too poor for others.
Four steps:
1. Encode: a codec like H.264, VP9 or AV1 compresses the video. It does not store every frame in full, mostly it writes down what changed from the frame before. Newer codecs give the same quality in fewer bits, but take much longer to encode.
2. Quality ladder: encode the same video at several resolutions and bitrates, from 144p up to 1080p or 4K.
3. Segments: chop every quality into pieces of a few seconds and write a manifest (HLS, DASH) saying which pieces live where. The player can change quality on every piece and jump into the middle of a video.
4. CDN: pieces live in origin storage and edge servers cache copies close to viewers' cities. Example maths: about 200 MB per view x 1 lakh views = 20 TB. If 95 % of requests are served from the edge cache, only about 1 TB comes from the origin.
The catch: a CDN is a cache, not storage. Popular videos stay at the edge, old videos with a couple of views a day get pushed out and come from a regional cache or the origin, a little slower. Encoding costs real money, so a common pattern is a fast, cheap codec first and a re-encode with a more efficient codec once a video gets popular.
Coming up next in System Design Interview: design all of YouTube, from the upload to the view count. Comment and tell me: what quality do you usually watch videos at? Follow for the full series.
kgptalkie.com
#shorts #SystemDesign #CDN #VideoEncoding #HLS #Backend #BackendEngineering #DistributedSystems #SoftwareEngineering #SystemDesignConcepts #SystemDesignInterview #KGPTalkie










