Configure FFmpeg SRT Caller or Listener Mode

This article provides a practical guide on how to configure Secure Reliable Transport (SRT) streaming in FFmpeg using either caller or listener mode. You will learn the difference between these two connection modes, the correct URL syntax for FFmpeg, and see clear command-line examples for setting up both sender and receiver configurations.

Understanding SRT Connection Modes

SRT requires one peer to act as a listener (waiting for an incoming connection) and the other to act as a caller (initiating the connection). Once the handshake is completed, data can flow in either direction. By default, FFmpeg operates in caller mode if no mode is explicitly defined.

Configuring Caller Mode

In caller mode, FFmpeg initiates the connection to a remote SRT listener. This is the most common setup when streaming from a local encoder to a remote ingestion server or CDN.

To configure caller mode, append ?mode=caller to your SRT destination URL (or omit it, as it is the default).

Example: Sending a stream in caller mode

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

Example: Receiving a stream in caller mode

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

Configuring Listener Mode

In listener mode, FFmpeg binds to a local port and waits for a remote caller to initiate the connection. This is useful when you want to ingest a stream directly from a remote camera or encoder without using an intermediary server.

To configure listener mode, append ?mode=listener to the SRT URL. You should typically bind to 0.0.0.0 to accept connections on any network interface.

Example: Receiving a stream as a listener

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

Example: Sending a stream as a listener

ffmpeg -re -i input.mp4 -c:v libx264 -c:a aac -f mpegts "srt://0.0.0.0:9000?mode=listener"

Key SRT Parameters to Include

When configuring either mode, you can append additional parameters to the SRT query string using an ampersand (&).

Example with advanced parameters:

ffmpeg -re -i input.mp4 -f mpegts "srt://192.168.1.100:9000?mode=caller&latency=2000000&passphrase=MySecurePassword123&pbkeylen=32"