Directives - rstular/srt-live-server GitHub Wiki

Table of Contents

Core

srt

syntax: srt {...}
context: root
The block which holds all SRT settings.

log_file

syntax: log_file filename
context: srt
Location of the logfile to use. Default is logs/srt_server.log.

log_level

syntax: log_level level
context: srt
Specifies the minimum log level of messages to be logged. Must be one of TRACE, DEBUG, INFO, WARNING, FATAL or OFF. Default is INFO.

log_level info;

pidfile

syntax pidfile filename
context: srt
Location of the PID file. Default is /tmp/sls/srt_server.pid.

worker_threads

syntax: worker_threads num_threads
context: srt
The number of SRT server worker threads. Default is 1.

worker_threads 1;

worker_connections

syntax: worker_connections num_connections
context: srt
The maximum number of connections each thread can handle simultaneously. Default is 300.

worker_connections 300;

stat_post_url

syntax: stat_post_url url
context: srt
The HTTP endpoint to post statistics to. Does not POST statistics if endpoint is unspecified. Default is unspecified.

stat_post_url http://192.168.31.106:8001/sls/stat;

stat_post_interval

syntax: stat_post_interval interval
context: srt
The interval between individual POSTs of statistics (in seconds). Default is 5 seconds.

stat_post_interval 5;

server

syntax: server {...}
context: srt
Declares SRT server instance.

rtmp {
    server {
    }
}

Server

listen

syntax: listen port
context: server
Port on which to listen for connections.

server {
    listen 8080;
}

backlog

syntax: backlog value
context: server
Defines how many sockets may be allowed to wait until they are accepted (excessive connection requests are rejected in advance). Default is 128 connections.

latency

syntax: latency value
context: server
Defines the latency of the SRT protocol (in ms). Default is 20ms.

domain_player

syntax: domain_player srt_domain
context: server
The play SRT domain, used by players connecting to SLS. SRT domain is not to be confused with a regular Domain Name - for example, live is a valid domain_player value. Default is live.sls.

domain_publisher

syntax: domain_publisher srt_domain
context: server
The publish SRT domain, used by publishers connecting to SLS. SRT domain is not to be confused with a regular Domain Name - for example, uplive is a valid domain_publisher value. Default is uplive.sls.

idle_streams_timeout

syntax: idle_streams_timeout timeout
context: server
If no data is received from a client for the duration of the timeout value, the server will discard the client. The timeout is specified in seconds. Default is 10s.

on_event_url

syntax: on_event_url http://[server_ip]/on_event?method=on_connect|on_close&role_name=%s&srt_url=%s&remote_ip=%s&remote_ip=%d
context: server
The webhook which will be called on on_connect and on_close events. If the webhook does not return 200 OK status code when executing the on_connect webhook, the connection will be refused by the server. Webhook is not active if the URL is not specified. Default is unspecified.

app

syntax: app {...}
context: server
Creates a SRT application.

server {
    listen 8080;
    app {
    }
}

App

app_player

syntax: app_player name
context: app
The app name of the player endpoint. The streaming (playing) endpoint follows the RTMP convention: srt://domain/app_player/stream_name.

app_publisher

syntax: app_publisher name
context: app
The app name of the publisher endpoint. The streaming (publishing) endpoint follows the RTMP convention: srt://domain/app_publisher/stream_name.

relay

syntax: relay {...}
context: app
Configure a SRT relay within a SRT app.

app {
    relay {
    }
}

Relay

type

syntax: type loop|all|hash
context: relay
Set the mode of the relay. The relay supports 3 modes:

  • loop mode: the relay will connect to upstream endpoints one-by-one, until a successful connection is established.
  • hash mode: the relay will be chosen based on the hash of the stream name. This means that a stream will always reach the same upstream server.
  • all mode: broadcast to all available upstreams.

reconnect_interval

syntax: reconnect_interval: interval
context: relay
The reconnect interval (in seconds) when a connection with an upstream server fails.

idle_streams_timeout

syntax: idle_streams_timeout: timeout
context: relay
If the relay receives no data from an upstream server for the duration of the timeout (specified in seconds), the server will discard the relay. Value -1 disables the timeout.

upstreams

syntax: upstreams: url1 [url2 url3 ...]
context: relay
The space-separated list of URLs of upstream relays. In an upstream URL, {stream_name} indicates the dynamic stream name, which will be inserted instead of the {stream_name} placeholder text.

Access

allow

syntax: allow play|publish address|all
context: app
The IP addresses to allow access (playing/publishing) to a specific SRT app. If there are multiple directives present in the configuration file, they are processed sequentially.

deny

syntax: deny play|publish address|all
context: app
See allow for description.

HLS

record_hls_path_prefix

syntax: record_hls_path_prefix path_prefix
context: srt
The directory to contain HLS recordings of received streams. The full recording path will be: <record_hls_path_prefix>/$listen/$domain_publisher/$app_publisher/$stream_name After the publisher stops, a VOD will be generated in: <record_hls_path_prefix>/$listen/$domain_publisher/$app_publisher/$stream_name/vod.m3u8.

record_hls_path_prefix /tmp/mov/sls;

record_hls

syntax: record_hls on|off
context: app
Whether to record to a HLS stream or not. Default is off.

record_hls_segment_duration

syntax: record_hls_segment_duration duration
context: app
The duration of HLS TS segments (in seconds). Default is 10s.