SRT Protocol
SRT (Secure Reliable Transport) is an open-source low-latency transport protocol developed by Haivision. It provides secure, reliable data transmission over unreliable networks, making it particularly suitable for remote contribution, broadcast-grade ingest, and other scenarios with high network jitter resilience requirements.
Basic Information
Section titled “Basic Information”| Property | Value |
|---|---|
| Default Port | 6000 |
| Transport Layer | UDP (SRT protocol layer) |
| Publish | ✅ Supported |
| Subscribe | ✅ Supported |
| Latency | 120ms+ (configurable) |
| Feature Flag | srt |
Configuration
Section titled “Configuration”Feature Activation
Section titled “Feature Activation”[features]srt = ["dep:plugin-srt", "plugin-srt/srt", "srt-tokio"]Configuration File
Section titled “Configuration File”srt: enable: true listen_addr: ":6000" latency_ms: 120 max_bandwidth: 0 passphrase: null| Option | Type | Default | Description |
|---|---|---|---|
enable | bool | true | Whether to enable the SRT plugin |
listen_addr | string | ":6000" | Listen address |
latency_ms | u32 | 120 | Transport latency (milliseconds) |
max_bandwidth | u64 | 0 | Maximum bandwidth (bytes/sec, 0=unlimited) |
passphrase | Option | null | Encryption passphrase (10-79 characters) |
Latency Tuning
Section titled “Latency Tuning”latency_ms is the core SRT parameter that controls the buffer latency from sender to receiver:
- Low-latency scenarios (LAN):
60-120ms - City-level transport:
120-500ms - Cross-country transport:
500-2000ms
Encrypted Transport
Section titled “Encrypted Transport”SRT supports AES encryption, configured via passphrase:
srt: passphrase: "my-secret-key-12345"The passphrase must be between 10 and 79 characters. Both the publisher and subscriber must use the same passphrase.
Publishing
Section titled “Publishing”Publishing with FFmpeg
Section titled “Publishing with FFmpeg”# Basic publishffmpeg -re -i input.mp4 -c copy -f mpegts "srt://localhost:6000?streamid=publish/live/test"
# Publish with encryptionffmpeg -re -i input.mp4 -c copy -f mpegts \ "srt://localhost:6000?streamid=publish/live/test&passphrase=my-secret-key-12345"
# Specify latency parameterffmpeg -re -i input.mp4 -c copy -f mpegts \ "srt://localhost:6000?streamid=publish/live/test&latency=200000"
# Camera capture and publishffmpeg -f v4l2 -i /dev/video0 \ -c:v libx264 -preset ultrafast -tune zerolatency \ -c:a aac -b:a 128k \ -f mpegts "srt://localhost:6000?streamid=publish/live/camera"Publishing with OBS
Section titled “Publishing with OBS”- Go to Settings → Stream
- Select Custom for the service
- Enter the server URL:
srt://your-server:6000?streamid=publish/live/test - Click Start Streaming
StreamID Format
Section titled “StreamID Format”SRT uses the streamid parameter to distinguish between publishing and subscribing:
- Publish:
streamid=publish/{streamPath} - Subscribe:
streamid=subscribe/{streamPath}orstreamid=play/{streamPath}
Subscribing
Section titled “Subscribing”Subscribing with FFplay
Section titled “Subscribing with FFplay”ffplay "srt://localhost:6000?streamid=subscribe/live/test"Recording with FFmpeg
Section titled “Recording with FFmpeg”ffmpeg -i "srt://localhost:6000?streamid=subscribe/live/test" -c copy output.mp4Subscribing with VLC
Section titled “Subscribing with VLC”- Open VLC, select Media → Open Network Stream
- Enter URL:
srt://localhost:6000?streamid=subscribe/live/test - Click Play
Cross-Protocol Forwarding
Section titled “Cross-Protocol Forwarding”Streams published via SRT can be played back through other protocols:
# SRT publishffmpeg -re -i input.mp4 -c copy -f mpegts \ "srt://localhost:6000?streamid=publish/live/test"
# Subscribe via RTMPffplay rtmp://localhost:1935/live/test
# Subscribe via HTTP-FLVffplay http://localhost:8080/flv/live/test.flv
# Subscribe via HLSffplay http://localhost:8080/hls/live/test/index.m3u8SRT vs RTMP
Section titled “SRT vs RTMP”| Feature | SRT | RTMP |
|---|---|---|
| Transport Layer | UDP | TCP |
| Latency | Configurable (120ms+) | 1-3 seconds |
| Lossy Network Resilience | Strong (FEC + ARQ) | Weak |
| Encryption | AES encryption | No built-in encryption |
| Firewall Friendly | Moderate (UDP) | Good (TCP) |
| Tool Support | FFmpeg/OBS/vMix | Widespread |
SRT significantly outperforms RTMP on lossy networks. It is recommended to use SRT instead of RTMP in the following scenarios:
- Remote contribution over the public internet
- Mobile network publishing
- Environments with unstable network quality