# SRS — Simple Realtime Server for Live Streaming > High-performance RTMP/HLS/WebRTC streaming server written in C++ for live broadcasting and video conferencing. ## Install Save as a script file and run: # SRS — Simple Realtime Server for Live Streaming ## Quick Use ```bash docker run -d --name srs -p 1935:1935 -p 1985:1985 -p 8080:8080 ossrs/srs:5 # Publish a stream with FFmpeg: ffmpeg -re -i input.mp4 -c copy -f flv rtmp://localhost/live/stream # Play via HLS: http://localhost:8080/live/stream.flv ``` ## Introduction SRS (Simple Realtime Server) is a real-time video streaming server that supports RTMP, HLS, HTTP-FLV, SRT, WebRTC, and GB28181 protocols. It is designed for live broadcasting, video conferencing, and low-latency streaming scenarios at scale. ## What SRS Does - Ingests live streams via RTMP, SRT, or WebRTC and distributes them in multiple formats - Transcodes and remuxes streams on the fly using built-in or FFmpeg-based pipelines - Provides an HTTP API and web console for managing streams, clients, and server state - Supports edge-origin clustering for horizontal scaling across multiple servers - Records live streams to disk in FLV or HLS segment format ## Architecture Overview SRS is a single-process, multi-coroutine C++ server built on the ST (State Threads) library for high-concurrency I/O. It handles protocol negotiation, media demuxing, and format conversion internally. For clustering, edge servers pull streams from origin servers on demand. The HTTP API exposes real-time metrics and stream lifecycle hooks that can trigger external callbacks. ## Self-Hosting & Configuration - Deploy with Docker using `ossrs/srs:5` or compile from source on Linux/macOS - Configure via a single `srs.conf` file with declarative blocks for each protocol - Enable WebRTC by setting the candidate IP and UDP port range in the config - Use the built-in HTTP callback system to integrate with authentication and billing services - Scale horizontally by deploying edge nodes that pull from origin servers ## Key Features - Sub-second latency with WebRTC and HTTP-FLV delivery - Protocol conversion between RTMP, HLS, HTTP-FLV, SRT, and WebRTC in a single server - Edge-origin architecture for CDN-like stream distribution - Built-in DVR for recording live streams to files - Lightweight single-process design that handles thousands of concurrent connections ## Comparison with Similar Tools - **Nginx RTMP Module** — Adds RTMP to Nginx but lacks WebRTC and SRT; SRS is purpose-built for streaming - **MediaMTX** — Go-based multi-protocol server; SRS has a longer track record and richer clustering support - **Janus** — Focused on WebRTC signaling and media; SRS covers broader ingest-to-delivery workflows - **Owncast** — Self-hosted live streaming with chat UI; SRS is a lower-level server without a viewer frontend ## FAQ **Q: Can SRS handle WebRTC for video calls?** A: Yes. SRS supports WebRTC publishing and playback, making it suitable for low-latency interactive streaming. For multi-party conferencing, you may need a selective forwarding unit (SFU) layer. **Q: What is the expected latency for live streams?** A: HTTP-FLV and WebRTC deliver sub-second latency. HLS latency is typically 3-10 seconds depending on segment length settings. **Q: Does SRS support GPU transcoding?** A: SRS itself does not transcode with GPU, but it can forward streams to an FFmpeg process configured with hardware acceleration. **Q: How many concurrent viewers can SRS handle?** A: A single SRS instance on modern hardware can serve thousands of concurrent connections. For larger scale, use the edge-origin clustering model. ## Sources - https://github.com/ossrs/srs - https://ossrs.io --- Source: https://tokrepo.com/en/workflows/srs-simple-realtime-server-live-streaming-2ba9e3c2 Author: Script Depot