How to Setup SRT Caller Mode in FFmpeg

This article provides a direct guide on configuring FFmpeg to use Secure Reliable Transport (SRT) in caller mode. You will learn the correct URI syntax, how to push or pull a stream, and how to apply critical parameters such as latency, stream IDs, and encryption passphrases to ensure a stable low-latency transmission.

Understanding SRT Caller Mode

In SRT terminology, the caller initiates the connection handshake to a remote endpoint acting as a listener. Unlike traditional RTMP where the client always pushes to a server, an SRT caller can either send (publish) or receive (consume) media streams. The only requirement is that the destination IP address and port belong to an active SRT listener.

Basic Syntax

FFmpeg uses the srt:// protocol scheme. Caller mode is specified via the mode=caller query parameter. If no mode is specified in the URL, FFmpeg defaults to caller.

The standard URL structure is:

srt://<remote_listener_ip>:<port>?mode=caller

Always encapsulate the SRT output URL in quotation marks in your terminal to prevent shell interpreters from breaking on the ? and & characters.

Sending a Stream as a Caller

To push a live video feed or local file to an SRT listener (such as an ingest server, OBS, or another FFmpeg instance), use FFmpeg to encode or copy your media into the MPEG-TS container format:

ffmpeg -re -i input.mp4 -c:v libx264 -preset veryfast -b:v 3000k -c:a aac -b:a 128k -f mpegts "srt://192.168.1.100:9000?mode=caller"

In this command:

  • -re reads the input at native frame rate.
  • -f mpegts ensures the stream is packaged in an MPEG-TS container, which is required for standard SRT video delivery.
  • 192.168.1.100:9000 is the address and port of the listening device.

Receiving a Stream as a Caller

If a remote server is listening and broadcasting a feed, you can pull that stream by using the caller URL as an input to FFmpeg:

ffmpeg -i "srt://192.168.1.100:9000?mode=caller" -c copy output.mp4

This connects to the listener, pulls the stream, and saves it directly to a local MP4 file without re-encoding.

Essential Configuration Parameters

You can append parameters to the connection string using the & delimiter to optimize performance and security:

  • Latency (latency): Sets the buffer window in microseconds to recover dropped packets. A recommended starting value is 2 to 2.5 times your Round-Trip Time (RTT).

    "srt://192.168.1.100:9000?mode=caller&latency=200000"

    (Sets a 200ms latency buffer)

  • Encryption (passphrase and pbkeylen): Secures the connection using AES encryption. Both caller and listener must share the same passphrase. Key length options are 16 (128-bit), 24 (192-bit), or 32 (256-bit) bytes.

    "srt://192.168.1.100:9000?mode=caller&passphrase=SecretPassword123&pbkeylen=32"
  • Stream Identification (streamid): Often required by cloud ingest points (such as Haivision or AWS MediaConnect) to route streams or identify users.

    "srt://192.168.1.100:9000?mode=caller&streamid=live/feed/ch1"

Complete Production Example

The following example transmits an input file to a remote listener with 250ms latency, 256-bit AES encryption, and a custom stream ID:

ffmpeg -re -i source.mkv -c:v libx264 -c:a aac -f mpegts "srt://203.0.113.50:7001?mode=caller&latency=250000&passphrase=MySecureToken&pbkeylen=32&streamid=channel_primary"