SRS (Simple Realtime Server): a solid open source media server if RTMP ingest is your starting point

SRS has been around for years and is still actively developed. MIT licence, written in C++, and a lot of people run it as the RTMP entry point of their setup.

Official site: Log in or register to see this link
Source: Log in or register to see this link

What you get

  • RTMP in and out
  • HLS and HTTP-FLV output
  • WebRTC, both for publishing and for playing
  • SRT
  • an HTTP API for stats and for kicking clients
  • callbacks (on publish, on play and so on) that hit your own URL, which is how you add authentication

Quick start with Docker

docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 ossrs/srs:5

Publish to rtmp://SERVER/live/livestream, then play http://SERVER:8080/live/livestream.m3u8 or the .flv version of the same address. Port 1985 is the API, try /api/v1/streams/ on it.

Where it fits

Compared with the old nginx-rtmp module, SRS is maintained, has WebRTC and has a proper API. Compared with MediaMTX it is heavier but gives you more control over a busy RTMP ingest, including forwarding to other servers and edge mode, where a second SRS pulls from the first one only when somebody asks for a stream.

Notes from the config

The callbacks are the feature to learn first. With on_publish pointing at a small script of your own you can check a stream key against a database and refuse the publish with a non-zero answer. Without that, anyone who knows the address can push to your server.

HLS settings live under hls in the vhost. hls_fragment is the segment length and it only works well when your encoder sends keyframes at an interval that divides it. If segments come out with odd lengths, fix the keyframe interval at the encoder, not here.

Do not expose the API port to the internet. Bind it to localhost or firewall it.

If you run SRS in production, which version are you on and did the move from 4 to 5 give you any trouble?