Skip to content

SRT Playback

Flussonic supports playing SRT streams.

SRT protocol offers three modes: Caller, Listener, and Rendezvous. Flussonic acts as a Listener during a playback. It waits for a connection and, as soon as it is established, it starts to communicate with the Caller.

SRT port is usually configured per stream, i.e. one SRT stream per port. Nevertheless, Flussonic provides you with the way to set up a single SRT port for multiple streams. For example, if you use SRT for restreaming only, it may come in handy. We will introduce you to both ways further.

One SRT stream per port

To configure an SRT port to play a single SRT stream, use srt_play configuration in the stream settings like so:


stream example_stream {
  input fake://fake;
  srt_play {
  port 9998;
  }
}

To play the stream, use the following URL:

  • srt://FLUSSONIC-IP:SRT_PORT

where:

  • FLUSSONIC-IP is an IP address of your Flussonic server.

  • SRT_PORT is an SRT port, specified for playback.

Thus, for our example_stream the link will look as follows: srt://localhost:9998.

Using the srt_play you allow to play the SRT stream over a specified port.

You can also define an SRT port for a particular stream not only for a playback, but also for publishing.

To learn more about publishing SRT streams to Flussonic, see Publishing SRT stream.

To configure a single SRT port to publish and play a stream, use srt PORT_NUMBER option in the stream settings:


stream example_stream {
  input publish://;
  srt 9998;
}

In the example above we publish some SRT stream to example_stream over port 9998 and we can also play this stream over the same port, using the following URL format:

  • srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::m=request

where:

  • m=request is a playback mode.

streamid is used here to specify the mode m= to play the stream example_stream as it is not obvious now whether we are going to publish the stream or to play it.

So the URL for our stream is srt://localhost:9998?streamid=#!::m=request.

Besides using one SRT port for one stream, thus, allowing playback for a particular stream, Flussonic provides you with the way to use one port for multiple SRT streams.

One SRT port to play multiple streams

To enable one SRT port for playback only for any number of streams, use srt_play as a global setting:


srt_play {
  port 9998;
}
stream example_stream {
  input fake://fake;
}

To play example_stream over the 9998 SRT port, use the following URL:

  • srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::r=STREAM_NAME

where:

  • r=STREAM_NAME is a stream name.

So in our case the URL looks as follows: srt://localhost:9998?streamid=#!::r=example_stream.

Let us consider one more example. Say you publish an SRT stream to Flussonic over a specified publishing port, and then you need to play it along with other streams. So the example configuration looks as follows:


srt_play {
  port 9998;
}
stream example_stream {
  input fake://fake;
}
stream another_stream {
  input publish://;
  srt_publish {
    port 8888;
  }
}

The URL for another_stream is different from the URL for the example_stream stream, and looks as follows:

  • srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::r=STREAM_NAME,m=request

where:

  • m=request is a playback mode.

  • r=STREAM_NAME is a stream name.

So the resulting URL for our example: srt://localhost:9988?streamid=#!::r=another_stream,m=request.

The summary is tabulated in the table below for your convenience:

Playback URL Configuration Description URL example
srt://FLUSSONIC-IP:SRT_PORT stream example_stream {
input fake://fake;
srt_play {
port 9988;
}
}
Allows playing only one stream per port.
Supported by most players.
srt://localhost:9988
srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::m=request stream example_stream {
input publish://;
srt 8888;
}
Allows publishing and playing a stream over the same SRT port. srt://localhost:8888?streamid=#!::m=request
srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::r=STREAM_NAME srt_play {
port 9999;
}
stream example_stream {
input fake://fake;
}
Allows playing several streams over the same SRT port. srt://localhost:9999?streamid=#!::r=example_stream
srt://FLUSSONIC-IP:SRT_PORT?streamid=#!::r=STREAM_NAME,m=request srt_play {
port 9988;
}
stream example_stream {
input fake://fake;
}
stream another_stream {
input publish://;
srt_publish {
port 8888;
}
}
Having a specified publishing port for the stream allows playing the stream over a globally defined SRT port. srt://localhost:9988?streamid=#!::r=another_stream,m=request

Flussonic allows you to manage the playback by setting the parameters.

Parameters for an SRT playback

Here is a list of parameters to manage SRT playback:

Parameters Description Example
minversion x.y.z The minimum SRT version that is required from the peer. minversion 1.3.0.
version x.y.z Required SRT version. version 1.3.0
connect_timeout milliseconds Connection timeout (in milliseconds). connect_timeout 1500
enforcedencryption 1/0 If set to 1, 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. Default is set to 1. enforcedencryption 0
passphrase string Password for the encrypted transmission. Its length can vary from 10 to 79 characters. passphrase 9876543210
linger seconds The time (in seconds) that the socket waits for the unsent data when closing. Default is set to -1 (auto). linger 2
latency microseconds Packet delivery delay (in microseconds). Used to absorb bursts of missed packet retransmissions. latency 1000000 (latency equals to 1 second)

Example with passphrase:


stream example_stream {
  input fake://fake;
  srt_play {
    passphrase 0987654321;
    port 9998;
  }
}

The URL will look like this:

  • srt://FLUSSONIC-IP:9998?passphrase=0987654321&streamid=#!::m=request