Mediasoup Setup: What is it, How to Install, Which Systems are Used? Detailed Guide
1. What is Mediasoup?
Mediasoup is a Node.js-based, very high-performance SFU (Selective Forwarding Unit) server library for WebRTC-based, real-time media broadcasts (video, audio).
It is used in applications such as conferences, live broadcasts, p2p, and webinars.
2. Mediasoup Usage Areas
-
Video conferencing systems
-
Online education platforms
-
Live sports / event broadcasts
-
Remote business meeting systems
-
Camera surveillance systems
3. Mediasoup Installation with Docker
Installation with Docker eliminates dependency complexity thanks to encapsulation:
Requirements:
-
Docker Engine
-
Docker Compose
Installation Steps:
-
Create the necessary folder structure:
mkdir mediasoup-docker && cd mediasoup-docker
git clone https://github.com/versatica/mediasoup-demo.git
cd mediasoup-demo
-
Edit environment variables (in the
.envfile) -
Open ports:
3000,40000-40100/udp -
Start:
docker-compose up --build
Advantages:
-
Fast installation
-
Portability
-
Easy upgrade
4. Node.js (Manual) Installation
Requirements:
-
Node.js 16+
-
Python 3
-
C++ compiler (Linux:
build-essential, Windows:windows-build-tools)
Installation Steps:
git clone https://github.com/versatica/mediasoup-demo.git
cd mediasoup-demo
npm install
npm run worker:build
npm start
Advantages:
-
Docker is not required
-
More control
5. Which Installation Method to Use on Which Servers?
| Operating System | Preferred Installation | Notes |
|---|---|---|
| Ubuntu 20.04+ | Docker & Manual | Most stable performance, most common environment |
| Debian 11+ | Docker | Fewer dependency issues |
| CentOS/Rocky | Manual | iptables issues may occur in Docker |
| Windows Server | Docker (WSL2) | Native support is weak, WSL2 is recommended |
| macOS | Manual | Suitable for development, not suitable for production |
6. Advantage - Disadvantage Comparison
| System | Advantages | Disadvantages |
|---|---|---|
| Ubuntu | Community support, package support, stability | - |
| CentOS | Stable, RHEL-based infrastructure | Some dependency issues may occur |
| Windows | Easy testing environment with WSL2 | Performance degradation may occur, no native support |
| macOS | Ideal for developers | Not suitable for server environment |
7. Conclusion and Recommendations
-
Ubuntu 20.04+ and Docker should be preferred for a scalable Mediasoup broadcasting system.
-
Manual Node.js installation offers more flexibility in development environments.
-
Mediasoup provides the best results in terms of both quality and latency in live broadcasting and conference applications.
8. Extra: Usage with TURN Server (Coturn)
Mediasoup requires a TURN server for clients behind NAT. With Coturn installation, UDP/443 port must be opened.
Prepared by Eka Yazılım ve Bilişim Sistemleri.