Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Large Scale WebRTC Broadcast

Large Scale WebRTC Broadcast

The Problem

WebRTC is a protocol that has been standardized in recent years among major browsers like Chrome, Firefox, Opera and the Android Browsers. Plugins/Native Implementations are available on IE/Edge/Safari and iOS/Android basically providing a relatively global protocol for real time media streams. However WebRTC is a P2P protocol which means that if a user wishes to broadcast his/her video to multiple users he/she needs to individually send that broadcast to each participant. This works on a small scale, but degrades quickly on a large scale due to bandwidth deterioration.

The Solution

One possible solution is to let the user stream his/her media to a server and the server in turn splits the media streams to the subscribers. There are two technical ways to do this. A Selective Forwarding Unit (SFU) which simply forwards streams, and a Multipoint Control Unit (MCU) which essentially does the same thing but lowers bandwidth usage by packaging streams together. As a server is specialized to handle heavy bandwidth/upload rates, this architecture is much more scalable, and with possible multiple layers and servers can handle possibly tens of thousands of simultaneous real time subscribers. It is also worth mentioning that as the number of users increases the need for "real time" degrades somewhat as it is no longer necessary for everyone to communicate on a conversational level which could be helpful to keep in mind.

Possible Implementations

I have narrowed down possible implementations to a list of four of the best. All of the implementations below are essentially just WebRTC gateways which basically simply take in a WebRTC stream and then does something with it, either transcoding, combining streams, adding shit, computer vision, acting like an MCU, whatever. A good place to start with understanding what it is and is not is this webrtchacks article. It is also worth mentioning that all of these possible implementations are open source and they all seem relatively active.


A Highly sophisticated WebRTC gateway. It comes with a lot of stuff built in like integrations to OpenCV, encoding/recording and of course MCU capabilites. Looks pretty easy to set up and they have tons of documentation. Including a guide to setting up a one-to-many broadcast on node


A Pretty simple implementation of a WebRTC gateway. Its more or less wrappers around WebRTC to simplify connection as well as automatically setting up the connections through their webserver (Erizo) using a node.js API to communicate with your server. The architecture is documented here. Also supports recording and possible modules on top

Jitsi Videobridge

A self described WebRTC compatible Selective Forwarding Unit. They describe themselves on being reliant on bandwidth but not on CPU. Documentation is relatively unclear and its all built in Java, although they have prebuilt modules that seem quick to implement but may be have restrictions on building on top of.


Janus is a general purpose WebRTC gateway. Its really light weight (built in C) and modular and only really supplies whats necessary to doing SFU and MCU work, and plugins can be placed on top to do things like recording. The docs however do not seem extremely extensive, although they have a bunch of examples in the github repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.