Introduction to the three modes (listener, caller, rendezvous) of the encoder SRT protocol

1. Background
SRT stands for Secure Reliable Transport. This video transport protocol allows live streaming under challenging networks.
SRT is an open source low latency video transport protocol. It has three main features, secure, reliable, and low latency. In terms of security, SRT supports AES encryption to secure end-to-end video transmission. In terms of reliability, SRT guarantees the stability of transmission by forward correction technology (FEC). In terms of low latency, since SRT is built on the improved UDT protocol, it solves the problem of high transmission latency of UDT protocol and the complex transmission timing problem of UDP network communication, and can achieve support for real-time transmission of high-throughput files and ultra-clear videos.
In the eyes of the general public, RTMP is the de facto standard for live Internet video. The RTMP protocol has not been updated for a long time, and the standard was abandoned after its last update in 2012.The RTMP standard does not support new Codecs such as HEVC or AV1. This has led to a fragmentation of manufacturers and an inability to interoperate, which is why common playback such as VLC is unable to play H265 RTMP streams. Now there are more than 250 companies and organizations in the SRT consortium, supported by VLC, GSTREAMER, FFMPEG, OBS, VIMX, etc. In the foreseeable future, SRT will definitely replace RTMP.
SRT open source code can be found at GitHub - Haivision/srt: Secure, Reliable, Transport

2. The three handshake modes of SRT

2.1 Introduction to handshaking modes

To establish a communication stream, SRT uses a handshaking mechanism in which each device identifies itself as a caller or listener. in some cases, two devices can simultaneously negotiate an SRT session in what is called rendezvous mode. You should be aware of these handshaking modes if you are configuring an SRT stream:

SRT Model What it can do
caller will Source or Objectives The device is set as the initiator of the SRT flow session.
caller Equipment must know listener IP address of the listener and the port number of its listener
listener Set the device to wait for a request to start an SRT streaming session.
listener The device only needs to know that it should listen for SRT streams on a specific port
Rendezvous Allows two devices to start an SRT session on the same port, both source and destination must be in rendezvous mode.

As shown in Figure 1 above, when the encoder is set to listener mode, it can allow the receiver (or decoder) to receive the SRT stream; as shown in Figure 2 above, when the encoder is set to caller mode, the encoder can only send SRT stream to one receiver (or decoder); as shown in Figure 3 above, when the encoder is set to Rendezvous mode, the encoder can only send SRT stream to one receiver (or decoder). The design goal of this mode is to do NAT penetration without port mapping, requiring both encoder and decoder to use the same port, and both must be set to rendezvous mode; the original design of rendezvous mode is to realize two encoders and decoders in different NATs without the intervention of NAT/firewall network administrators. However, due to the complexity of the network, the ideal is very rich, but the reality is very skeletal; especially in China, various NATs are nested, and the routers we use to access the Internet do not even have a public IP, but mostly the intranet IP of each operator, so the basic conditions for intranet penetration do not exist.

2.2 listener mode
2.2.1 Configure the encoder to send in listener mode

As shown in the figure below, login to the encoder background, select Output Settings → SRT Settings → fill in SRT listener parameters → Save. SRT listener parameters.
Mode: Select listener from the list box.
IP: 127.0.0.1.
Port: The listening port of SRT listener mode, this port should tell the receiving/decoding side, this example uses 9001.
Delay: parameter to control buffering, in milliseconds, default is 50.

2.2.2 vMix configuration for caller mode to receive
After the encoder is set up according to 2.2.1, it can be received by vMix. Assuming the IP address of the encoder is 192.168.1.217, the configuration of vMix is shown below.

Enter the SRT parameter in the input box as shown in the upper right corner of step 2 above.
Stream type: SRT (caller); since the encoder is set to listener mode, vMix must be set to caller mode.
Hostname: Enter the IP address of the encoder; for this example, the IP address of the encoder is 192.168.1.217, so enter 192.168.1.217 in this input box.
Port: Enter the port on which the encoder is configured to listen to the SRT listener, in this case 9001.
Delay: The SRT buffer in milliseconds, which can be different from the encoder’s SRT delay parameter.

2.2.3 OBS configuration for caller mode to receive
After the encoder is set up according to 2.2.1, it can be received by OBS, assuming that the IP address of the encoder is 192.168.1.217, and the configuration of OBS is shown as follows.

Unlike vMix, OBS can only receive SRT streams from the encoder with a URL address in the following format: srt://encoder IP:SRT listening port?mode=caller&latency=ms; according to the 2.2.1 encoder configuration, we have to enter the URL as srt://192.168.1.217:9001? mode=caller&latency=50.

2.3 caller mode
2.3.1 Configure the encoder to send in caller mode
As shown in the figure below, login to the encoder backend, select Output Settings–>SRT Settings–>Fill in the SRT caller parameters–>Save. SRT caller parameters.
Mode: Select caller from the list box.
IP: IP address of the receiving end/decoding end, the IP of the receiving end in this example is 192.168.1.195, so fill in 192.168.1.195.
Port: The SRT listener listening port of the receiver/decoder. This example uses 9001.
Delay: parameter to control buffering, in milliseconds, default is 50.

2.3.2 vMix configuration for listener mode to receive

After the encoder is set up according to 2.3.1, it is ready to receive with vMix. If OBS has been started for 2.3.3, stop OBS first. vMix is configured as shown in the following figure.

Enter the SRT parameter in the input box as shown in the upper right corner of step 2 above.
Stream type: SRT (listener); since the encoder is set to caller mode, vMix must be set to listener mode.
Port: Enter the port that the SRT listener listens on, this port should be the same as the caller port of the encoder.

2.3.3 OBS configuration in listener mode to receive

After the encoder is set up according to 2.3.1, it is ready to receive with OBS. If vMix has been started for 2.3.2, stop vMix first. the configuration of OBS is shown in the following figure.

Unlike vMix, OBS can only receive SRT streams from the encoder with a URL address in the following format: srt://127.0.0.1:SRT listening port?mode=listener&latency=ms; according to the 2.3.1 encoder configuration, the URL we want to enter is srt://127.0.0.1:9001 ? mode=listener&latency=50.

2.4 rendezvous mode

2.4.1 Configure the encoder to send in rendezvous mode

As shown in the figure below, login to the encoder backend, select Output Settings–>SRT Settings–>Fill in the SRT rendezvous parameters–>Save. SRT rendezvous parameters.
Mode: Select rendezvous from the list box.
IP: NAT public IP address of the receiving/decoding end. This example is 121.8.34.9.
Port: SRT rendezvous port, this port must be the same as the SRT rendezvous port at the receiving/decoding end, this example is 9001.
Delay: parameter to control buffering, in milliseconds, default is 50

2.4.2 vMix configured to receive in rendezvous mode

After the encoder is set up according to 2.4.1, it is ready to receive with vMix. If OBS has been started for 2.4.3, stop OBS first. assume that the NAT public IP address of the encoder is 113.119.199.52 and vMix is configured as shown below.

Enter the SRT parameter in the input box as shown in the upper right corner of step 2 above.
Stream type: SRT (Rendezvous); since the encoder is set to Rendezvous mode, vMix must be set to Rendezvous mode.
Hostname: Enter the IP address of the encoder’s NAT public network; assume the encoder’s IP is 113.119.199.52, then enter 113.119.199.52 for this input box.
Port: SRT rendezvous port, this port must be the same as the encoder’s SRT rendezvous port, in this case 9001.

2.4.3 OBS configured for rendezvous mode to receive

After the encoder is set up as per 2.4.1, it is ready to receive with OBS. If vMix has been started for 2.4.2, stop vMix first. assume the NAT public IP address of the encoder is 113.119.199.52 and the OBS is configured as shown in the following figure.

Unlike vMix, OBS can only receive SRT streams from the encoder with a URL address in the following format: srt://encoder NAT public IP:SRT listening port?mode=rendezvous&latency=ms; according to the 2.4.1 encoder configuration, the URL we want to enter is srt://113.119. 199.52:9001?mode=listener&latency=50.

2.5 How the encoder pushes the stream to the SRT LIVE SERVER (SLS)
2.5.1 Introduction to SLS
The srt-live-server (SLS) is a low-latency open-source live streaming server based on Secure and Reliable Transport (SRT). Typically, SLS transmits over the Internet with a latency of less than 1 second. The source code is available at GitHub - Edward-Wu/srt-live-server: srt live server for low latency.
Compiling SLS is relatively simple, just follow the instructions, one thing to note is that SLS depends on SRT, so you have to compile SRT first and then compile SLS.

2.5.2 One of the encoder push flow methods
Our encoder has 2 methods to push stream, one is multi-platform push stream, and the other is channel output setting, the following is the multi-platform push stream method. is 192.168.1.122, then the push stream address is: srt://192.168.1.122:8080?streamid=uplive.sls.com/live/test. as shown in the following figure.

Note: The streamid for pushing streams and the streamid for playback are different, see the sls.conf description for details.

2.5.3 Encoder Push Streaming Method No.2
There are two methods to push the stream from our encoder, one is to push the stream from multiple platforms, and the other is to set the channel output. See the description of 2.5.2 for the URL of the push stream. As shown in the following figure.

2.5.4 How to play the stream pushed by encoder to SLS
2.5.4.1 vMix Playback
The vMix playback of SLS streams is in caller mode. Assuming that the IP of the sls server is 192.168.1.122 and the port is 8080, the vMix configuration is shown in the following figure.

Note: The streamid for pushing streams and the streamid for playback are different, see the sls.conf description for details.

2.5.4.2 OBS Playback
OBS playback of SLS streams is in caller mode, assuming the IP of the sls server is 192.168.1.122 and the port is 8080, the OBS configuration is as shown in the following figure.

image

Note: The streamid for pushing streams and the streamid for playback are different, see the sls.conf description for details.