Skip to content

v5_EN_SRTParams

john edited this page May 25, 2022 · 6 revisions

HOME > EN > SRT > SRT Parameters

SRT Config

There are some important parameters about stream transport in SRT. SRS support configures those parameters.
For more detail about SRT, please see SRT wiki

Note: all options in libSRT

How to config SRT

In srs config file, srt_server have indenpendent config block as below:

srt_server {
    enabled on;
    listen 10080;
    maxbw 1000000000;
    connect_timeout 4000;
    peerlatency 300;
    recvlatency 300;
    mix_correct on;
}

Srt config block is in block of srt_server. Now let's see all of the SRT parameters and what's the meaning of them.

latency

Unit: millisecond,default value 120ms.
This latency configuration configures both recvlatency and peerlatency to the same value.

  • If recvlatency is configured, the recvlatency configuration will be used;
  • If peerlatency is configured, the peerlatency configuration will be used;

recvlatency

Unit: millisecond,default value 120ms.
The recvlatency means latency from sender to receiver.
It must be bigger than RTT because the packet may retransmit serval times through the network.
Recommend config:

  • Low latency network
    If your application cares about low latency, you can configure this parameter less than 250ms.
  • Long distance, long RTT
    We must no configure small latency because of the long RTT;
    Or some important live stream, which doesn't care about low latency but requires play smooth;
    Recommend configure latency >= 3 * RTT, it include possible packet retransmit and ack or nack of the packets;

peerlatency

Unit: millisecond,default value 120ms.
The peerlatency is set by the sender side and will notify the receiver side.
If the receiver side set recvlatency also, it will get the max value of peerlatency and recvlatency.
Recommend config:

  • Low latency network
    If your application cares about low latency, you can configure this parameter to less than 250ms.
  • Long distance, long RTT
    We must not configure small latency because of the long RTT;
    Or some important live stream, which doesn't care about low latency but requires play smooth;
    Recommend configure latency >= 3 * RTT, it include possible packet retransmit and ack or nack of the packets;

tlpkdrop

true or false,default value true
The tlpkdrop means too-late Packet Drop
SRT sender side will pack timestamp in each packet, When the network is congested,
the packet will drop if latency is bigger than the configuration in both sender side and receiver side.
And on the sender side, it also will be dropped because latency is bigger than configuration.

tsbpdmode

true or false,default value true
The tsbpd mode means timestamp based packet delivery.
SRT sender side will pack timestamp in each packet. If this config is true,
the receiver will read the packet according to the timestamp in the head of the packet.

maxbw

Unit: bytes/s, default value -1(means infinite)

  • The maxbw is the max bandwidth of the sender side.
  • -1: Means the biggest bandwidth is infinity.
  • 0: Means the bandwidth is determined by SRTO_INPUTBW.
  • >0: Means the bandwidth is the configuration value.

mss

Unit: bytes, default value 1500
The max segment size of SRT, in IP layer.

connect_timeout

Unit: millisecond, default value 3000ms.
The timeout time of SRT connection. When the SRT connection is idle more than this config, it will be close.

sendbuf

Unit: bytes, default value 8192 * (1500-28).
The send buffer size of SRT.

recvbuf

Unit: bytes, default value 8192 * (1500-28).
The recv buffer size of SRT.

payloadsize

Unit: bytes, default value 1316(188x7)
Because we use MPEG-TS over SRT, and MPEG-TS packet size is n times 188 bytes.
So we must configure payload size n times 188, and the default size is 1316(188x7) bytes.

Recommend SRT config

Latency first

Delay first, allow packet loss. In case of contest live, TV content production, we always prepare a link which is stable and exclusive.
And we care about latency in those case, and allow some loss packets.
We will detect the RTT of link before we start publish, and using the result RTT to configure SRT parameters.
The recommended configuration is below

srt_server {
    enabled on;
    listen 10080;
    connect_timeout 4000;
    peerlatency RTT * 3;
    recvlatency RTT * 3;
    latency RTT * 3;
    tlpktdrop on;
    tsbpdmode on;
}

Common Live

Latency adaptive, no packet loss allowed. When we use SRT on the internet, the network is unstable with RTT jitter and non-exclusive.
In this case, we must adapt to the latency, and must not loss packets to avoid play video artifacts.
The recommended configuration is below.

srt_server {
    enabled on;
    listen 10080;
    connect_timeout 4000;
    peerlatency 0;
    recvlatency 0;
    latency 0;
    tlpktdrop off;
    tsbpdmode off;
}

Note: If you use the configuration above, but play video artifacts, please see FFmpeg patch

John 2022.5.24

Welcome to SRS wiki!

SRS 5.0 wiki

Please select your language:

SRS 4.0 wiki

Please select your language:

SRS 3.0 wiki

Please select your language:

SRS 2.0 wiki

Please select your language:

SRS 1.0 wiki

Please select your language:

Clone this wiki locally