Skip to content

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.

SRT offers three modes: Caller, Listener, and Rendezvous. Flussonic acts as Caller while ingesting and pushing, and as a Listener while playing and publishing. Rendezvous mode is not yet implemented in Flussonic.

There are few ways of configuring SRT publishing, depending on whether a port is defined as global or within stream settings.

You can specify an SRT port for publishing in the configuration file or in the Flussonic UI.

Global port is a port defined outside of stream settings. It acts as a main listening port for SRT streams.

Stream port is a port specified within settings of a particular stream.

Now let's have a look at the ways to configure SRT publishing.

In the configuration file

You can enable SRT publishing over a global port or a stream port in the configuration file.

Global port

Specify the global port and configure a stream for publishing in the configuration file (/etc/flussonic/flussonic.conf):


srt 9998;
stream mysrt {
  url publish://;
}

or with srt_publish:


srt_publish {
  port 9998;
}

stream mysrt {
  url publish://;
}

URL for publication over some SRT port looks as follows:

  • srt://SRT-SOURCE:SRT_PORT?pkt_size=1316&streamid=#!::r=STREAM_NAME,m=publish

Warning

It is crucial to keep the #!::r symbols order when specifying the streamid.

Warning

Stream name in streamid is required. This way you indicate Flussonic what stream to publish over the global port.

Then a URL for publication over port 9998 in our example:

  • srt://FLUSSONIC-IP:9998?pkt_size=1316&streamid=#!::r=mysrt,m=publish

You can test the publications of the streams with the help of ffmpeg.


/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'

Use the following URL format when publishing from OBS:


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 name of your stream.

OBS srt

Stream port

You can specify a port for publishing SRT stream using srt_publish option within stream settings:


stream pub {
  url publish://;
  srt_publish {
    port 9998;
  }
}

In the example above we set a 9998 port for publishing an SRT stream. URL will look like this:

Note

Stream name in streamid is not required.

  • srt://FLUSSONIC-IP:9998?pkt_size=1316&streamid=#!::m=publish

Let's have a look at the following example of SRT publication using ffmpeg.


/opt/flussonic/bin/ffmpeg -re -fflags +genpts -stream_loop -1 -i PATH_TO_VIDEO -c copy -y -f mpegts 'srt://FLUSSONIC-IP:9998?pkt_size=1316&streamid=#!::m=publish'

Flussonic allows you to manage SRT publishing by setting some parameters.

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 0xXXYYZZ or x.y.z The minimum SRT version that is required from the peer. Default minversion is 0x010000 or 1.0.0. minversion 1.1.0.
version 0xXXYYZZ or x.y.z Required SRT version. Default version is 0x010000 or 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.

You can also specify m= and r= parameters in streamid:

  • s= is a source id. Flussonic uses it as one of the identifiers of a publish session.
  • password= is a password for the authorization in a publish session.

Let's see how to use the parameters to manage the SRT publishing. For example, let's secure an SRT port.

Secured global port


srt_publish {
  port 9998;
  passphrase 0123456789;
}

stream pub {
  url publish://;
}

In the example above we configured a secured 9998 port.

The URL format for publication will look like this:

  • srt://SRT-SOURCE:SRT_PORT?pkt_size=1316&passphrase=PASSWORD&streamid=#!::r=STREAM_NAME,m=publish

In our case it looks as follows:

  • srt://SRT-SOURCE:9998?pkt_size=1316&passphrase=0123456789&streamid=#!::r=pub,m=publish

Secured stream port


stream pub {
  url publish://;
  srt_publish {
    port 9998;
    passphrase 0123456789;
  }
}

General URL structure:

  • srt://SRT-SOURCE:SRT_PORT?pkt_size=1316&passphrase=PASSWORD&streamid=#!::m=publish

For our example it is as follows:

  • srt://SRT-SOURCE:9998?pkt_size=1316&passphrase=0123456789streamid=#!::m=publish

In Flussonic UI

To enable publishing SRT stream using Flussonic UI you should:

Note

This way you can only specify a global port.

  1. Go to Config -> Settings and specify the port in the SRT port field of the Protocols section:

UI srt field

  1. Go to Media tab and click Add button next to the Streams section. Specify the name of your SRT stream in Stream name field and set the source URL as publish:// in Source URL field. Then just click Create to save it:

UI srt pub location

  1. 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#!::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 that you specified at stage 2. In our example, it is called mysrt.

UI srt pub URL

This way you define a global listening port for the SRT.

Now you know how to enable a publication of an SRT stream in Flussonic.