Skip to content

08. External Relay Server Installation Guide

Shinichi Hanayama edited this page Jan 17, 2025 · 1 revision

External relay server linking is enabled for some subscription plans, but is currently open to all plans, including free plans, on a trial basis.

The SRC-Link Control Panel can be linked to a relay server installed externally. his makes it possible to host and receive video even in environments where UDP ports cannot be opened under NAT routers or FW, or global IPs cannot be disclosed.

The relay server itself is not included in the product. It must be installed separately by the user.

This document describes how to install the open source software srtrelay and work with the SRC-Link Control Panel.

Pros

  • No need to open the host's UDP port
  • Host's public IP is not exposed to guests
  • May solve rare host/guest connection compatibility problems

Cons

  • Increased stream delay due to relaying the stream on an external server. At least twice as much as a direct connection.
  • Encryption is not supported (srtrelay specifications)

System Requirements

The easiest installation method is to use Docker (and Docker Compose). This document explains how to install using Docker + Docker Compose.

Docker Desktop includes Docker Compose. For Docker CLI, you need to install the Docker Compose plugin separately.

How to install the Docker Compose plug-in

The server on which srtrelay is installed must have a high-speed Internet connection with a public IP and be accessible from public.

Download config files

Download the docker-compose.yaml and the srtrelay-config.toml file to any folder (both in the same folder).

Open srtrelay-config.toml with a text editor and edit the following lines

...
[auth.http]
# Streams are authenticated using HTTP POST calls against this URL
# Should be compatible to nginx-rtmp on_publish/on_subscribe directives
url = "https://api.src-link.live/srtrelay/v1/auth/xxxxxx"

The authentication URL including the xxxxxxxx part is displayed in the receiver's “External Relay Server” edit field, Replace the above URL and save it.

Basically, no editing is required except above, but some tuning may be necessary depending on your environment, which will be discussed later.

Launching Containers

Below, open the command line and go to the folder where you downloaded the config files and work with it.

docker compose up -d

This will launch the srtrelay container on Docker.

If you want to check the logs, run docker compose logs srtrelay -f.

To exit, run docker compose down in the folder containing docker-compose.yaml.

Set address to SRC-Link Control Panel

Relay servers are made available by adding them to the receiver in the SRC-Link Control Panel.

Open the Edit Receiver page, click on “Add External Relay Server” to add an input field, and enter the address and port as shown below.

  • Address: example.jp (replace with your server's IP address or DNS name)
  • Port: 1337

Click “Save” to save the receiver settings.

Adding Downlink Inputs to Sources in OBS Studio

Add an “SRC-Link Downlink Input” to the scene in OBS Studio.

After selecting the receiver, slot, and source, check the “Use Relay Server” checkbox (This checkbox is only available if the receiver has at least one relay server registered and if you have a subscription with an external relay server enabled.)

Press “OK” to close the input settings.

If the relay server is correctly started with the above settings, The guest will connect to the host's OBS Studio via the relay server.

Through a relay server, hosts can receive video without worrying about opening ports or exposing their public IPs.

Tuning

Change the port from 1337

The port on which the relay server accepts connections is set to 1337 by default. If you want to change this port, edit the following xxxx in docker-compose.yaml.

...
  ports:
    - "xxxx:1337/udp"

After editing the file, run docker compose down followed by docker compose up -d to restart the container.

The accepted port is changed to the port specified by xxxx.

Turn off SRC-Link Control Panel authentication.

In the default configuration, authentication is performed via the SRC-Link Control Panel, and only guests who are registered members can connect to the relay server.

There may be cases where you do not want to use authentication for some reason (for example, you cannot communicate with the authentication server, or you want to use it elsewhere).

You may not want to use authentication for some reason (e.g., you cannot communicate well with the authentication server, or you want to make it available to anyone who knows the address).

In this case, edit the [auth] section of srtrelay-config.toml as follows

...
[auth]
# Choose between available auth types (static and http)
# for further config options see below
#type = "http"

Comment out the line with type = “http”.

After editing the file, run docker compose down followed by docker compose up -d to restart the container.

Unstable streaming

Depending on the network environment between the relay server and the guest, or relay server and the host, there may be cases where the stream is not stable.

In that case, edit srtrelay-config.toml and set the latency and buffer size.

  • latency = 200 - Increasing latency improves protocol stability (which in turn increases stream delay). A recommended value is about 2.5 times the round trip time (ping). Normally, the same latency value should be set on the client (OBS Studio) side.
  • buffersize = 384000 - The buffer size is a value that determines the maximum acceptable delay for the client. Since it is in bytes, the acceptable time varies depending on the stream bit rate. If the stream delay exceeds the acceptable size, the client is disconnected.

After editing the file, run docker compose down followed by docker compose up -d to restart the container.