Skip to content

OpenIRL/srt-live-server

Repository files navigation

SRT Live Server

Overview

SRT Live Server (sls) is a low latency streaming server that is using SRT (Secure Reliable Transport). This fork includes a secure REST API with authentication, SQLite database storage, and rate limiting for production use.

Features

  • SRT Protocol Support: Low latency streaming with SRT
  • Secure REST API: Authentication with API keys and rate limiting
  • SQLite Database: Persistent storage for stream IDs and configuration
  • Access Logging: Complete audit trail of API usage
  • Docker Support: Easy deployment with docker-compose
  • Dynamic end-to-end Latency: Latency can be determined by the client

Quick Start with Docker

  1. Clone the repository:
git clone https://github.com/OpenIRL/srt-live-server.git
cd srt-live-server
  1. Start with docker-compose:
docker-compose up -d
  1. Check the logs for the admin API key:
docker-compose logs | grep "admin API key"

You'll see something like:

Generated default admin API key: AbCdEfGhIjKlMnOpQrStUvWxYz123456
IMPORTANT: Save this key securely. It will not be shown again.

Configuration

Ports

  • 4000/udp: Publisher port (SRT input)
  • 4001/udp: Player port (SRT output)
  • 8080/tcp: HTTP API port

API Usage

See API.md for complete API documentation.

Quick Examples

  1. Add a stream mapping:
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"publisher":"studio","player":"live"}' \
  http://hostname:8080/api/stream-ids
  1. List all streams:
curl -H "Authorization: Bearer YOUR_API_KEY" \
  http://hostname:8080/api/stream-ids
  1. Get stream statistics:
curl http://hostname:8080/stats/live

The stats endpoint returns publisher metrics. When using SRTLA (link aggregation), per-peer connection stats are included:

{
  "status": "ok",
  "publisher": {
    "bitrate": 8000,
    "throughput": 8300,
    "rtt": 15.5,
    "buffer": 2920,
    "dropped_pkts": 30,
    "uptime": 3600,
    "latency": 3000,
    "peers": [
      {
        "connection_id": "a3f2b1c0",
        "bitrate": 5000,
        "throughput": 5200,
        "jitter": 1.2,
        "uptime": 3600
      },
      {
        "connection_id": "7e4d9f12",
        "bitrate": 3000,
        "throughput": 3100,
        "jitter": 4.8,
        "uptime": 3580
      }
    ]
  }
}
Field Description
connection_id Anonymized identifier per SRTLA connection (stable per session)
bitrate Usable payload bitrate in kbps for this connection (updated every 1s)
throughput Total network throughput in kbps including retransmissions; publisher.throughput is the sum across all connections
jitter Smoothed network jitter in milliseconds (RFC 3550 EWMA, lower = more stable)
uptime Connection uptime in seconds

The peers array is only present when SRTLA connections are active.

Deprecated: The legacy=1 query parameter returns the old stats format (under publishers.live, without peers) for compatibility with older clients such as NOALBS < 2.14.0. It is deprecated and will be removed in a future release — migrate to the default format above. Responses to legacy=1 requests include a Deprecation: true header.

Streaming URLs

Publisher (Input)

srt://hostname:4001?streamid=publisher_id

Player (Output)

srt://hostname:4000?streamid=player_id

Security Considerations

  1. Change Default API Key: The default admin key should be changed immediately
  2. Use HTTPS: In production, use a reverse proxy with SSL/TLS
  3. Network Security: Restrict API access to trusted networks
  4. Regular Backups: Backup the SQLite database regularly
  5. Monitor Logs: Check access logs for suspicious activity

Test video feed:

Create publisher and player id using the api:

curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"publisher":"publisher_id","player":"player_id"}' \
  http://hostname:8080/api/stream-ids
ffmpeg -re -f lavfi -i testsrc2=size=640x360:rate=25 -f lavfi -i sine=frequency=1000:sample_rate=48000 -c:v libx264 -preset ultrafast -tune zerolatency -c:a aac -f mpegts "srt://hostname:4001?streamid=publisher_id"

Receive it with OBS or VLC: srt://hostname:4000?streamid=player_id

Support

For issues and feature requests, please use the GitHub issue tracker.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

SRT Live Server for low latency streaming

Resources

License

Stars

12 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors

Languages