# How Chandrayaan-3 Redefined YouTube Records - Uncover the Blueprint for Crafting Your Ultimate Live Video Streaming Service!

***Read Time: 5 mins 55 secs (Know that your time is invaluable to me!)***

Hey friend!

Today we’ll be talking about

- **Chandrayan-3 Landing Broke Youtube Record - Let’s Learn To Design A Live Video Streaming Service**
  - The Context
  - Top 3 Most Viewed Live Streams on YouTube
  - Global Record For Concurrent Live Stream Views
  - Functional Requirements
  - Non-functional Requirements
  - Challenges
  - Live Streaming Service for a Single User
  - Designing For More Than 2 Crore Concurrent Users

---

---

## How Chandrayaan-3 Redefined YouTube Records - Uncover the Blueprint for Crafting Your Ultimate Live Video Streaming Service!

![Chandrayaan 3 moon landing youtube live stream record break ibai spain isro most watched Chandrayaan-3 Successful Landing Creates YouTube History, Becomes Most Watched Livestream Ever](https://substackcdn.com/image/fetch/$s_!Kqtq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64063a20-93ba-4d0a-8666-1dcc8acf4c00_720x540.jpeg)

### The Context

On August 23, 2023, a historic moment unfolded as the Indian Space Research Organisation (ISRO) shattered records on YouTube for the most-watched live event.

The live stream of the Chandrayaan-3 lunar landing captured the attention of millions worldwide, amassing an **astounding 8 million concurrent viewers and cementing its position as the most-viewed event on the platform**.

### Top 3 Most Viewed Live Streams on YouTube

***🥇Rank: 1

Youtube Stream**: [ISRO – Chandrayaan 3 Mission Soft Landing](https://www.youtube.com/live/DLA_64yz8Ss?feature=share)**

Peak Real-time Views**: 8.06 million*

***🥈Rank: 2

Youtube Stream**: [CazéTV – World Cup 2022 QF Brazil vs Croatia](https://www.youtube.com/watch?v=88jWB1TBw0s)**

Peak Real-time Views**: 6.1 million*

***🥉Rank: 3

Youtube Stream**: [CazéTV – Brazil vs. South Korea 2022 World Cup](https://www.youtube.com/watch?v=ipb1eF0JsIU)**

Peak Real-time Views**: 5.2 million*

The event that united the 1.4 Billion-strong nation, was watched live on multiple platforms and streams - hence splitting the viewers.

If YouTube had exclusive rights to the stream, then the record could have been at least 3-4x bigger.

I am saying this because another event that united India was the reason for a global record for concurrent viewers on a live stream.

The final of the Indian Premier League 2023 had 32 million viewers watching the match concurrently on the JioCinema platform. This is outlandish.

### Global Record For Concurrent Live Stream Views

***🥇Rank: 1

Streaming Service and Event**: JioCinema, CSK vs. GT IPL 2023 Final**

Peak Concurrent Viewers**: 32 million*

***🥈Rank: 2

Streaming Service and Event**: Disney Hotstar, 2019 CWC Final between NZ and ENG**

Peak Concurrent Viewers**: 25.3 million*

***🥉Rank: 3

Streaming Service and Event**: JioCinema, CSK vs. RCB IPL 2023**

Peak Concurrent Viewers**: 24 million*

I cannot stop marveling at the scale at which services like JioCinema, YouTube, or Hotstar+AWS+Akamai are operating.

The engineers who work on these solutions must be so proud to see the world enjoying the fruits of their labors.

Working on problems at this scale is what most engineers ( at least I) yearn for.

So what does it take to build a Live Streaming Service like JioCinema or Hotstar? Let's find out.

### Functional Requirements

- Stream live sports(or any event) videos to global audiences on any device, any bandwidth, with low latency
- Users should be able to like and comment in real-time
- Store the entire video for later replay

### Non-functional Requirements

- There should be no buffering, i.e., streaming without any lag
- Reliable system
- High Availability
- Scalability

## Challenges

1. Latency - keeping the delay as little as possible
2. Scale - millions of users concurrently watching
3. Multiple devices - different resolutions and bandwidths

## Live Streaming Service for a Single User

![image.png](https://substackcdn.com/image/fetch/$s_!jaav!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e9a2232-5840-4330-898c-7cdd969a77f7_2164x723.jpeg)

There are 4 entities to streaming

- Publishing - capturing the live feed
- Transforming - converting into multiple formats
- Distributing - transporting the video to the client
- Viewing - Watching the feed on the UI

![image.png](https://substackcdn.com/image/fetch/$s_!aITQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F642da414-07d0-4c28-8347-01fd05a1e456_2344x1104.jpeg)

## Publishing

![image.png](https://substackcdn.com/image/fetch/$s_!WZnC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc123f54a-0907-4771-bc52-9fa2f3b50002_1801x462.jpeg)

The first step in the publishing process is to acquire the camera feed. In the case of sporting events, the camera feed is usually backhauled to a central production facility via a satellite link or a dedicated high-speed Internet line.

The popular protocol used to deliver video feed to a streaming server is RTMP.

Real-Time Messaging Protocol (RTMP) is a TCP-based protocol designed to maintain persistent, low-latency connections while transmitting content from the source (encoder) to a hosting server.

The camera feed is pushed to an RTMP Encoder Server through HDMI. The encoder server converts the incoming video to the desired bitrate and codec - usually H.264 for video and AAC audio.

The encoder then sends the encoded video to the cloud server using RTMP.

## Transforming

One of the challenges in live streaming is streaming to different types of devices like mobiles, desktops, smart TVs, etc. For this, the ingested video, which is usually 8K/4K, is converted into different formats. This process of video conversion is called transcoding.

![image.png](https://substackcdn.com/image/fetch/$s_!PY1c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8e1af969-7ce9-483e-b427-ab5df72c61bd_1649x364.jpeg)

Essentially, the incoming RTMP stream is chunked into multiple bitrates for adaptive bitrate streaming.

It takes An 8K/4K video input stream and converts it into lower bitrate streams such as HD at 6Mbps, 3Mbps, 1Mbps, 600 kbps, etc.

The streaming server also pushes all the versions of the video to Amazon S3-like storage for later payback.

## Transporting

The transcoder sends the chunked videos to a Delivery/Media server.

The web player on the client makes a connection with the media server and requests the live video. The media server, which in this case is more like an edge server, responds with the stream of the relevant video format the player requested.

![image.png](https://substackcdn.com/image/fetch/$s_!6bzE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46877aa-bc30-4cf4-999f-f013e4d6f3fc_2641x808.jpeg)

---

---

### Designing For More Than 2 Crore Concurrent Users

Let's scale this to 20M+ users

Hypothetical scenario

- Event: Cricket Match India vs Pakistan
- Location: Adelaide, Australia

Let's focus on 2 workflows

1. Ingestion: Video Feed to Distribution
2. Playback: Player to Distribution servers

Ingestion is a CPU-intensive process and for easy streaming over the network, the RTMP stream needs to be converted into one-second chunks each for multiple bitrates.

Let's revisit the Transcoder Server with this illustration

![image.png](https://substackcdn.com/image/fetch/$s_!_Snj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6c26f9f-36eb-4602-9821-f8d18b096496_2554x1307.jpeg)

A global sports event streaming company can either own its data centers (DCs) across the globe in strategic locations or outsource the infrastructure to a vendor like AWS.

Either way - all data centers have streaming servers positioned to take in the incoming feed.

The video production team at the Adelaide Cricket Stadium initiates the stream and connects with the streaming server API in the nearest Data Center in Sydney. They get a stream ID from the streaming server.

The servers transcode the video into multiple formats and bitrates and push the chunked videos to multiple host servers of multiple data centers across the globe.

By 'caching' the video segments to multiple DCs, the load on the source server is definitely managed - but this is good enough for a few hundred users only.

But, in a high-stake match like India vs Pakistan, the traffic could surge dramatically at specific moments in the match.

Too many requests, on a few DCs, can stampede the system, causing lag, dropout, and disconnection from the stream.

### The “Thundering Herd” problem

![image.png](https://substackcdn.com/image/fetch/$s_!wesA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5ce30e94-87d4-4b5d-89aa-a413c4982f10_2571x1333.jpeg)

This is where CDN comes in.

Instead of having clients connect directly to the live stream server, they are routed to the CDN edge servers.

CDN edge servers can either Pull the data from the source data centers or the data centers can Push the video segments to the CDN servers across the globe.

When a player connects with a CDN server, The segment request is handled by one of the HTTP proxies at the CDN PoP that checks to see whether the segment is already in an edge cache.

If the segment is in the cache, it’s returned directly from there. If not, the proxy issues an HTTP request to the regional DC cache. If the segment is not in the DC cache, then it needs to request to the server handling that particular stream at the origin.

This way 90% of the requests are handled by CDN servers eliminating the load on the client.

---

---

### My Popular Blog Articles

- **[https://zahere.com/how-discord-stores-trillions-of-messages](https://zahere.com/how-discord-stores-trillions-of-messages)**
- **[https://zahere.com/how-to-build-a-redis-like-database-in-csharp](https://zahere.com/how-to-build-a-redis-like-database-in-csharp)**
- **[https://zahere.com/http-everything-you-must-know](https://zahere.com/http-everything-you-must-know)**
- **[https://zahere.com/the-case-for-headless-cms-how-a-decoupled-architecture-can-boost-your-core-web-vitals-scores](https://zahere.com/the-case-for-headless-cms-how-a-decoupled-architecture-can-boost-your-core-web-vitals-scores)**
- **[https://zahere.com/microkernel-architecture-how-it-works-and-what-it-offers](https://zahere.com/microkernel-architecture-how-it-works-and-what-it-offers)**
- **[https://zahere.com/the-tricky-business-of-building-microservices-how-to-keep-your-architecture-from-becoming-a-distributed-monolith](https://zahere.com/the-tricky-business-of-building-microservices-how-to-keep-your-architecture-from-becoming-a-distributed-monolith)**
