Using SRT protocol
SRT (Secure Reliable Transport) is an open source video transport protocol based UDP transport protocol. It provides low latency and smooth delivery of the content. SRT minimizes packet loss while reducing the video quality to provide continuous playback, which is crucial for sports streaming, live events, etc. However, unlike TCP, SRT packet loss is possible if necessary to ensure low latency.
Thus, SRT combines the advantages of UDP and TCP: the ability to resend lost packets and to guarantee a low delay. There are two basic ways to achieve this:
- Track the receiver lagging relative to the transmitter in a certain time window and resend lost packets during this window. This method is well suited for delivering video over the Internet.
- Send redundant packets, i.e. send some data from neighboring packets with each packet. This method is best used for satellite signal delivery, because individual bits may well be lost in satellite networks while either the entire packet is lost or the whole packet arrives intact on the Internet.
SRT in Flussonic
Setting up the reception and transmission of streams via SRT in Flussonic is performed in standard ways. The main task is to correctly form the URL of the stream. Below is the general information needed to do this, and on the next pages in the section you will find configuration examples and URL examples.
SRT modes
SRT protocol offers three modes: Caller, Listener, and Rendezvous. Flussonic supports the following modes:
- SRT publication. Flussonic acts as Listener while awaiting to get the stream from the Caller.
- SRT ingest. Flussonic acts as Caller by initializing the connection and requesting the stream from the source.
- SRT push. Flussonic acts as Caller because it is the source of the stream forcefully sent to another server.
- SRT playback. Flussonic acts as Listener waiting for the request from the Caller to send the stream.
The mode is stated in the stream's URL using the streamid
parameter.
Streamid
Transmitting an SRT stream requires specifying the streamid
parameter that is a string of maximum 512 characters set on the socket before the connection. This string is a part of a callback that is sent by the Caller and registered by the Listener. Based on this information the Listener can accept or reject the connection, select the desired data stream, or set an appropriate passphrase for the connection.
Its format is #!::
optionally followed by the parameters:
r=
— stream namem=
— mode expected for the connection:publish
(if the Caller wants to send the stream data) orrequest
(if the Caller wants to receive the stream)password=
— a password for the authorization in a publish session (not recommended, better use thepassphrase
URL parameter instead because it is expected by most of clients)
During SRT sessions between two Flussonics, the following parameters are automatically added to streamid
:
s=
— the identifier of a sessiona=
— Flussonic version
Example: streamid="#!::r=my-stream,m=publish"
.
See also developer's guide.
SRT port
When ingesting or pushing over SRT, the port and streamid
settings are set on the side of the client application which generates the stream URL. When setting up publishing and playing, the stream URL is defined by Flussonic, so it is important to choose the right way to specify the port for streams. Flussonic offers flexible configuration of SRT ports for transmitting and receiving video. The way you choose to specify the port will affect the form of streamid
that you will need to use to receive or transmit streams. There are the following setting options:
-
Set a separate SRT port for each stream or group of streams (i.e. template). This is the best option supported by most third-party clients. You can use the
srt
option in the stream configuration if the same port will be used for playback and publishing, orsrt_play
andsrt_publish
if the ports for playback and publishing are different. Specifying the stream name in ther=
parameter is optional, because it is already set in the configuration. If you usesrt
, be sure to specify the connection mode in them=
parameter ofstreamid
. -
Set a global port for all modes of receiving and transmitting all SRT streams on your server. This method is more suitable for testing purposes, as it is not supported by third-party clients. You can set the port at Config - Settings in the UI.
Corresponding global option in the configuration file is
srt
.You can also set separate global ports for playback
srt_play
and publishingsrt_publish
. This can only be done in the config file. This mode is also not supported by most clients.If you use
srt
, be sure to specify the connection mode in them=
parameter ofstreamid
, while this option is not required when you usesrt_play
orsrt_publish
because the connection mode is already known for the specified port. Specifying the stream name inr=
is mandatory because it is not clear which stream you want to access when using a global port. -
Set the range of ports for publishing and playing streams in the
listeners
directive. This method is used in conjunction withconfig_external
when it is necessary to determine the name of a stream from its SRT port. Learn more in the API schema.
Warning
If you set both global and local port settings simultaneously, the local port settings take precedence and are applied first.
A summary table of streamid
values for different connection modes, depending on how the port is specified:
Local srt |
Local srt_play /srt_publish |
Global srt |
Global srt_play /srt_publish |
|
---|---|---|---|---|
Publishing* | "#!::m=publish" | streamid is not required |
"#!::r=stream_name,m=publish" | "#!::r=stream_name" |
Push | "#!::m=publish" | streamid is not required |
"#!::r=stream_name,m=publish" | "#!::r=stream_name" |
Playback | "#!::m=request" | streamid is not required |
"#!::r=stream_name,m=request" | "#!::r=stream_name" |
Ingest | "#!::m=request" | streamid is not required |
"#!::r=stream_name,m=request" | "#!::r=stream_name" |
Note
*
streamid
specifies the mode that characterize the source, so m=publish
is specified for publishing even though Flussonic is in Listener mode, and m=request
for capturing even though Flussonic acts as Caller.
SRT parameters
In any mode of receiving or transmitting streams via SRT Flussonic supports the following parameters:
Parameters | Unit | Description | Example |
---|---|---|---|
minversion |
x.y.z | The minimum SRT version that is required from the peer. | minversion=1.1.0 |
version |
x.y.z | Required SRT version. | version=1.3.0 |
enforcedencryption |
boolean | If set to true , both connection parties must have the same password set (including empty, in other words, with no encryption). If the password doesn’t match or only one side is unencrypted, the connection is rejected. Set to true by default. |
enforcedencryption=false |
passphrase |
string | Password for the encrypted transmission. Its length should be not less than 10 and not more than 79 characters. Default value is an empty string ("" ) |
passphrase=9876543210 |
timeout |
seconds | If set to -1 then data transmission time is unlimited. Default behavior. |
timeout=1 |
linger |
seconds | The time socket waits for the unsent data when closing. Set to 180 by default. |
linger=1 |
connect_timeout |
seconds | Connection timeout. Equals to 0 by default. |
connect_timeout=2 |
latency |
milliseconds | Packet delivery delay. Used to absorb bursts of missed packet retransmissions. Default value is set to 120 . |
latency=100 |