Publishing SRT streams
Flussonic supports publishing SRT streams.
SRT (Secure Reliable Transport) is a UDP-based streaming protocol. It minimizes packet loss to provide continuous playback, which is crucial for sports streaming, live events, etc.
When you publish streams to Flussonic, Flussonic acts as an SRT Listener, receiving streams.
This article describes how to configure publishing SRT streams to Flussonic Media Server.
1. Specify an SRT port in Flussonic
You can specify a port in the configuration file or in the Flussonic UI.
Note
In Flussonic UI you can specify a global port only!
In the configuration file
There are several ways to configure an SRT port to publish streams to Flussonic, depending on your application. There are global-level settings and local-level settings.
- Allow publishing and playing SRT streams over single port (global-level setting).
Specify the port in the srt PORT_NUMBER
parameter:
srt 9998;
stream mysrt {
input publish://;
}
To publish the stream use the following link:
Warning
It is crucial to keep the #!::r
symbols order when specifying the streamid
.
srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::r=STREAM_NAME,m=publish
, where:
- (required)
FLUSSONIC-IP
is an IP address of your Flussonic server. - (required)
SRT_PORT
is an SRT port. - (required)
r=STREAM_NAME
is a stream name. - (required)
m=publish
is a publishing mode.
The detailed description of the streamid
parameter can be found here.
- Allow publishing only for SRT streams. In this case you can use the specified port for publishing only (global-level setting).
Specify the port in the srt_publish { port PORT_NUMBER; }
setting:
srt_publish {
port 9998;
}
stream mysrt {
input publish://;
}
Use the following link to publish the stream:
srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::r=STREAM_NAME
, where:
- (required)
FLUSSONIC-IP
is an IP address of your Flussonic server. - (required)
SRT_PORT
is an SRT port. - (required)
r=STREAM_NAME
is a stream name.
Note
m=publish
is not required as only publishing is allowed over specified port.
- Allow publishing and playing a stream or a group of streams over single port. In this case single SRT port is used to publish and play the SRT stream or a group of streams (local-level setting).
Specify the port in the srt PORT_NUMBER
parameter in a stream or template settings:
stream mysrt {
input publish://;
srt 9998;
}
To publish the stream use the following link:
srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::m=publish
, where:
- (required)
FLUSSONIC-IP
is an IP address of your Flussonic server. - (required)
SRT_PORT
is an SRT port. -
(required)
m=publish
is a publishing mode. -
Allow publishing only for a stream or group of streams over a single port. This way only publishing is allowed for an SRT stream or a group of SRT streams (local-level setting).
Specify the port in the srt_publish { port PORT_NUMBER; }
in a stream or a template settings:
stream mysrt {
input publish://;
srt_publish {
port 9998;
}
}
To publish the stream use the following URL:
srt://FLUSSONIC-IP:SRT_PORT
, where
- (required)
FLUSSONIC-IP
is an IP address of your Flussonic server. - (required)
SRT_PORT
is an SRT port.
Warning
If you apply both global-level and local-level settings, the latter take precedence over the former ones.
Flussonic allows you to manage SRT publishing by setting some parameters.
2. Set additional parameters for SRT publishing
Here is a list of parameters you can set for srt_publish
aside from port
to manage SRT publication:
Parameters | Unit | Description | Example |
---|---|---|---|
minversion |
x.y.z | The minimum SRT version that is required from the peer. The default minversion is 1.0.0 . |
minversion 1.1.0 |
version |
x.y.z | Required SRT version. The default version is 1.0.0 . |
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 does not match or only one side is unencrypted, the connection is rejected. Default is set to true . |
enforcedencryption 0 |
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 |
linger |
seconds | The time that the socket waits for the unsent data when closing. Default is set to 180 . |
linger 2 |
timeout |
milliseconds / false | If set to false then data transmission time is unlimited. Default behavior. |
timeout 100 |
Flussonic also carries such information as agent (Flussonic version) and session ID in the URL. You do not have to specify them manually.
Let's see how to use the parameters to manage the SRT publishing. For example, let's secure an SRT port.
2.1 Specifying additional parameters: securing a global port
To secure the global port, set the password in the passphrase
parameter of the srt_publish {}
setting:
srt_publish {
port 9998;
passphrase 0123456789;
}
stream pub {
input publish://;
}
Parameters are specified in the URL query string and it looks like so:
srt://FLUSSONIC-IP:SRT_PORT?passphrase=PASSWORD&streamid=#!::r=STREAM_NAME
In our case it looks as follows:
srt://FLUSSONIC-IP:9998?passphrase=0123456789&streamid=#!::r=pub,m=publish
2.2. Specifying additional parameters: securing a stream port
To secure the port in a stream or a template settings, set the password in the passphrase
parameter of the srt_publish {}
setting:
stream pub {
input publish://;
srt_publish {
port 9998;
passphrase 0123456789;
}
}
Parameters are specified in the URL query string:
srt://FLUSSONIC-IP:SRT_PORT?passphrase=PASSWORD
For our example it looks as follows:
srt://FLUSSONIC-IP:9997?passphrase=0123456789
Specifying port in Flussonic UI
To enable publishing SRT stream using Flussonic UI you should:
Note
This way you can specify a global port only!
1) Go to Config -> Settings and specify the port in the SRT port field of the Protocols section:
2) Go to the Media tab and click the Add button next to the Streams section. Specify the name of your SRT stream in the Stream name field and set the source URL as publish://
in Source URL field. Then just click Create to save it:
3) Click on your new stream (mysrt
in the example above) and go to the Input tab. There you will find the URL for publishing that has the following structure:
srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::r=STREAM_NAME
, where:
FLUSSONIC-IP
is an IP address of your Flussonic server.SRT_PORT
is an SRT port.STREAM_NAME
is the name of your stream.
3. Start publishing the stream to Flussonic
You can use ffmpeg
to test the publishing:
/opt/flussonic/bin/ffmpeg -re -i PATH_TO_VIDEO -c copy -y -f mpegts 'srt://FLUSSONIC-IP:SRT_PORT?pkt_size=1316&streamid=#!::r=STREAM_NAME,m=publish'
, where:
FLUSSONIC-IP
is the Flussonic IP address.SRT_PORT
is an SRT port.STREAM_NAME
is the stream name.m=publish
is a publishing mode.