Skip to content

SRT Egress

Mcaster supports sending video streams via SRT protocol. SRT (Secure Reliable Transport) is widely used for delivering video over the Internet or satellite networks, as it guarantees low latency while offering content delivery guarantees.

Overview

SRT Egress module allows you to push streams from Mcaster to external servers using SRT protocol. This is particularly useful for:

  • Delivering video content to remote servers
  • Broadcasting to CDN networks
  • Satellite transmission
  • Low-latency video distribution

Basic Configuration

To configure SRT egress, use the push directive in your stream configuration:

stream example_stream {
  input udp://239.0.0.1:1234;
  push srt://destination-server.com:9998 streamid="#!::r=stream-name,m=publish";
}

URL Formats

SRT push URLs can be configured in two formats:

SRT Parameters in URL Parameters

srt://SRT-HOST:SRT_PORT streamid="#!::r=STREAM_NAME,m=publish"

SRT Parameters in URL Query String

srt://SRT-HOST:SRT_PORT?streamid=#!::r=STREAM_NAME,m=publish

Where: * SRT-HOST - IP address of the destination server * SRT_PORT - SRT port number * STREAM_NAME - name of the publishing location on the destination server

Configuration Examples

Simple SRT Push

stream srt_output {
  input udp://239.0.0.1:1234;
  push srt://example.com:9998 streamid="#!::r=my-stream,m=publish";
}

SRT Push with Parameters

stream srt_secure {
  input udp://239.0.0.1:1234;
  push srt://example.com:9998?streamid=#!::r=secure-stream&passphrase=1234567890;
}

Multiple SRT Destinations

stream multi_srt {
  input udp://239.0.0.1:1234;
  push srt://server1.com:9998 streamid="#!::r=stream1,m=publish";
  push srt://server2.com:9999 streamid="#!::r=stream2,m=publish";
  push srt://server3.com:10000?streamid=#!::r=stream3&passphrase=secret123;
}

SRT Parameters

You can configure various SRT parameters for optimal performance:

Security Parameters

  • passphrase - encryption passphrase for secure transmission
  • pbkeylen - public key length for encryption

Performance Parameters

  • latency - maximum latency tolerance
  • rcvbuf - receive buffer size
  • sndbuf - send buffer size
  • mss - maximum segment size

Example with Parameters

stream optimized_srt {
  input udp://239.0.0.1:1234;
  push srt://example.com:9998?streamid=#!::r=optimized-stream&passphrase=secret&latency=120&rcvbuf=8192&sndbuf=8192;
}

Stream ID Format

The streamid parameter follows a specific format:

#!::r=STREAM_NAME,m=publish

Where: * r=STREAM_NAME - specifies the stream name on the destination server * m=publish - specifies the mode (publish for sending)

Use Cases

CDN Distribution

stream cdn_output {
  input udp://239.0.0.1:1234;
  push srt://cdn-provider.com:9998 streamid="#!::r=live-channel,m=publish";
}

Satellite Transmission

stream satellite {
  input udp://239.0.0.1:1234;
  push srt://satellite-gateway.com:9998?streamid=#!::r=broadcast&passphrase=satellite-key;
}

Remote Studio

stream remote_studio {
  input udp://239.0.0.1:1234;
  push srt://studio-server.com:9998 streamid="#!::r=studio-feed,m=publish";
}

Error Handling

SRT Egress module provides automatic error handling:

  • Automatic reconnection on connection loss
  • Retry mechanisms for failed connections
  • Error logging for troubleshooting
  • Graceful degradation when destination is unavailable

SRT Playback

Mcaster also supports playing SRT streams from the server. This allows clients to receive video streams via SRT protocol.

Basic SRT Playback Configuration

To configure SRT playback for a single stream, use the srt_play block in your stream configuration:

stream example_stream {
  input udp://239.0.0.1:1234;
  srt_play {
    port 9998;
  }
}

To play the stream, clients use the following URL format:

srt://SERVER-IP:SRT_PORT

Where: * SERVER-IP - IP address of your Mcaster server * SRT_PORT - SRT port specified for playback

For the example above, the playback URL would be: srt://localhost:9998

Combined Publish and Play

You can configure a single SRT port for both publishing and playing a stream:

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

For playback, use the following URL format:

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

Where: * m=request - specifies playback mode

The URL for this example would be: srt://localhost:9998?streamid=#!::m=request

Global SRT Playback Port

To enable one SRT port for playing multiple streams, use srt_play as a global setting:

srt_play {
  port 9998;
}
stream example_stream {
  input udp://239.0.0.1:1234;
}
stream another_stream {
  input udp://239.0.0.1:1235;
}

To play streams over the global port, use the following URL format:

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

Where: * r=STREAM_NAME - specifies the stream name

For the example above: * example_stream: srt://localhost:9998?streamid=#!::r=example_stream * another_stream: srt://localhost:9998?streamid=#!::r=another_stream

SRT Playback with Parameters

You can configure SRT playback with additional parameters:

stream secure_stream {
  input udp://239.0.0.1:1234;
  srt_play {
    port 9998;
    passphrase 0987654321;
  }
}

The playback URL with parameters:

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

URL Format Summary

Playback URL Configuration Description
srt://SERVER-IP:PORT srt_play { port PORT; } Single stream per port
srt://SERVER-IP:PORT?streamid=#!::m=request srt PORT; Combined publish and play
srt://SERVER-IP:PORT?streamid=#!::r=STREAM_NAME Global srt_play Multiple streams per port
srt://SERVER-IP:PORT?streamid=#!::r=STREAM_NAME,m=request Global srt_play + srt_publish Global port with publish streams