Mhonn YbañezSRE, DevOps, AI Engineer
 Today I Learned
Read the full page

How does Zoom send video to everyone in a meeting in real time?

Posted
Tags
networking, system-design, scaling

Sending a copy of my video to every person doesn't scale, and mixing everyone into one grid on a server costs too much CPU and adds delay. Zoom uploads one copy to a router that only forwards packets, and each laptop builds its own grid. Most of the heavy work lands on the many laptops instead of the few servers.

A KodeKloud short on how Zoom works showed up while I was browsing. I'm on video calls all the time and never wondered how ten live videos reach ten people with almost no delay.

The question I had

How does Zoom send everyone's video to everyone else in real time?

What I found

Option 1: everyone sends to everyone

Say 10 people have their cameras on. The simplest way is for my laptop to send my video directly to each of the other nine. That means uploading nine copies at once. If one copy needs 1.5 megabits per second, nine copies need about 13.5 megabits of upload, which many home connections can't do. With 50 people it is 49 copies. This only works for very small calls.

Option 2: a server mixes one grid

What if everyone uploads one copy to a server, and the server does the rest? It can open all 10 videos, arrange them into one grid, and send that single video to everyone. The upload problem is gone. But now the server has to decode 10 videos and encode a new one for every meeting. That takes a lot of CPU and adds delay.

Option 3: a server that only forwards

This is what Zoom does. My laptop sends my video to one Zoom server. That server doesn't decode anything or combine anything. It works out who needs my video and forwards the packets to them. Forwarding packets is very cheap compared to processing video, so one server can handle a lot of meetings. Zoom calls this server a multimedia router.

So who makes the grid? My own laptop. It receives the nine videos, decodes them, and arranges them on my screen. The heavy work happens on laptops, not on Zoom's servers.

Everyone sends to everyoneServer mixes one gridServer forwards packets
My uploadNine copiesOne copyOne copy
Server workNoneDecode every video, encode a new oneForward packets only
DelayLowHigherLow
Who builds the gridMy laptopThe serverMy laptop

If I read it right, options 2 and 3 have industry names: a server that mixes is called an MCU, and a server that only forwards is an SFU. A multimedia router is an SFU.

But does everyone get the same video?

If the router only forwards, how does someone watching me in full screen get a sharp picture while someone on weak Wi-Fi gets a small one? My laptop sends several quality levels of my video at the same time, and my audio goes separately as its own stream. The short describes three: sharp, medium, and small. Someone watching me full screen asks the router for the sharp one. Someone seeing me as a small tile, or on weak Wi-Fi, asks for the small one. The router doesn't change any video. It just forwards the version each person asked for.

I can't confirm exactly how Zoom does this. It might be separate copies or layers inside one stream, but the idea is the same.

Which router, and which protocol

When I click join, the app first talks to Zoom's servers, which check the meeting ID and passcode. Then, roughly, they pick a data center close to me and a router in it that isn't too busy.

The video itself travels over UDP. With TCP, if one packet is lost, everything behind it waits until it is sent again. In a live call, a frame that arrives a second late is useless, so it is better to move on to the next one. (That is simplified. Real systems also use some error correction and ask for fresh frames.) If a network blocks UDP, Zoom falls back to TCP. I wrote about the difference between the two in client-server communication patterns.

When the network gets bad

The app keeps measuring my connection. First it lowers the video quality. If that isn't enough, it gives up the video and protects the audio, because I can follow a meeting without seeing faces but not without hearing people. That is why my video freezes while I can still hear everyone.

Takeaway

The server does the cheap work, forwarding, and the laptops do the expensive work, decoding and building the grid. That is how one server handles lots of meetings. Whenever I design something with many senders and many receivers, I should ask which side can afford the heavy part.