Introduction
ZLMediaKit is a high-performance, cross-platform streaming media server framework written in C++11. It provides a unified server that handles nearly every streaming protocol used in production — from traditional RTSP/RTMP to modern WebRTC and SRT — making it suitable for live broadcasting, video surveillance, and real-time communication systems.
What ZLMediaKit Does
- Receives and distributes live streams across multiple protocols simultaneously
- Converts between protocols on-the-fly (e.g., RTSP input to HLS/WebRTC output)
- Records streams to MP4 or HLS segments for later playback
- Provides a RESTful API for stream management and server control
- Supports cluster deployment with origin-edge architecture
Architecture Overview
ZLMediaKit is built on an event-driven, multi-threaded networking framework (ZLToolKit). Each incoming stream is demuxed into a protocol-agnostic internal frame queue, then remuxed on demand into any output protocol requested by viewers. This design enables zero-copy protocol conversion. The server manages sessions via a thread-pool model with lock-free queues for high concurrency.
Self-Hosting & Configuration
- Compile from source with CMake on Linux, macOS, or Windows
- Docker images available for quick deployment
- Configure listening ports and protocol options in config.ini
- Enable HTTPS/WSS with your own TLS certificates
- Set up hook URLs for stream publish/play authentication callbacks
Key Features
- Multi-protocol: WebRTC, RTSP, RTMP, HLS, HTTP-FLV, SRT, GB28181 in one binary
- Sub-second latency with WebRTC and HTTP-FLV delivery
- On-the-fly transcoding-free protocol conversion
- RESTful API for programmatic stream management
- Cluster support with configurable origin-edge relay
Comparison with Similar Tools
- Nginx-RTMP — RTMP-only module; ZLMediaKit handles many more protocols natively
- SRS (Simple RTMP Server) — similar goals but ZLMediaKit adds GB28181 and broader WebRTC
- Janus — WebRTC gateway focus; ZLMediaKit covers traditional streaming protocols too
- MediaSoup — WebRTC SFU library; ZLMediaKit is a full-featured standalone server
- Wowza — commercial streaming server; ZLMediaKit is free and open source
FAQ
Q: Can it handle thousands of concurrent viewers? A: Yes, its event-driven architecture and edge-relay support allow scaling to large audiences.
Q: Does it support recording? A: Yes, streams can be recorded as MP4 files or HLS segments with configurable retention.
Q: Is GPU transcoding supported? A: ZLMediaKit focuses on protocol conversion without transcoding. For transcoding, pair it with FFmpeg.
Q: What is GB28181 support? A: GB28181 is a Chinese national standard for video surveillance systems. ZLMediaKit can ingest and serve streams from GB28181-compliant cameras.