DEV Community

Stephane Bhiri
Stephane Bhiri

Posted on • Originally published at vajracast.com

SRT Streaming Setup Guide: From Zero to Production

Why SRT

SRT (Secure Reliable Transport) has become the go-to protocol for professional video transport over the internet. If you are moving video between locations, SRT gives you reliability, encryption, and observability that RTMP cannot match.

Understanding SRT Modes

Listener Mode (Server)

The listener opens a port and waits for incoming connections:

srt://your-server:9000?mode=listener
Enter fullscreen mode Exit fullscreen mode

Use when running a centralized gateway, accepting streams from multiple sources, or your server has a public IP.

Caller Mode (Client)

The caller initiates the connection:

srt://remote-server:9000?mode=caller
Enter fullscreen mode Exit fullscreen mode

Use when you are an encoder sending to a server, behind NAT, or pushing to a specific destination.

Step 1: Choose Your Ports

SRT uses UDP. Convention is port 9000+, one port per listener. Ensure firewall allows UDP inbound.

Step 2: Configure Latency

The latency parameter controls the buffer size for error recovery:

Network Condition Recommended Latency
LAN (<1ms RTT) 20-60ms
Same city (~5ms RTT) 120-200ms
Same continent (~30ms RTT) 250-500ms
Cross-continent (~100ms RTT) 500-1500ms
Satellite/Cellular 1000-4000ms

Rule of thumb: Set latency to at least 4x your round-trip time.

Step 3: Enable Encryption

SRT supports AES-128 and AES-256. Always enable over the internet:

srt://server:9000?passphrase=YourSecurePassphrase&pbkeylen=32
Enter fullscreen mode Exit fullscreen mode
  • passphrase: 10-79 characters
  • pbkeylen: 16 (AES-128), 24 (AES-192), 32 (AES-256)

Both sides must match.

Step 4: Optimize Performance

Maximum Bandwidth: maxbw=10000000 caps at 10 Mbps including retransmissions.

Overhead Bandwidth: oheadbw=25 (default 25%). Increase on lossy networks.

Connection Timeout: connect_timeout=3000 for caller mode.

Monitoring Your Stream

Key SRT metrics:

  • RTT: should be stable
  • Packet Loss Rate: below 1% is good, SRT handles up to 30%
  • Retransmitted Packets: non-zero is normal
  • Available Bandwidth: estimated path bandwidth

Common Pitfalls

  1. Latency too low: causes artifacts when SRT cannot recover packets
  2. Firewall blocking UDP: SRT uses UDP, not TCP
  3. Mismatched passphrases: connections silently fail
  4. Wrong caller/listener: both sides must agree on roles

Next Steps

  • Set up automatic failover with a backup input
  • Configure multi-destination output
  • Explore SRTLA bonding for mobile production

Full protocol comparison: SRT vs RTMP

Top comments (0)