FFmpeg Stream Live Video Over SRT Listener Mode
This guide explains how to stream live video using FFmpeg over Secure Reliable Transport (SRT) configured in listener mode. Setting FFmpeg as an SRT listener allows the application to bind to a specific local port and wait for remote clients, media servers, or decoders to initiate the connection to receive the outgoing live broadcast reliably across unpredictable networks.
Basic SRT Listener Command
To output an SRT stream in listener mode, set the output protocol to
srt://, define the local IP and port, set the container
format to mpegts, and append the mode=listener
query parameter.
ffmpeg -re -i input.mp4 -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -f mpegts "srt://0.0.0.0:9998?mode=listener"Real-Time Live Capture Example
If you are capturing from a live video source (such as a capture card or webcam) rather than looping a file, replace the file input with your device input:
ffmpeg -f v4l2 -i /dev/video0 -c:v libx264 -preset ultrafast -tune zerolatency -b:v 3000k -maxrate 3000k -bufsize 6000k -c:a aac -b:a 128k -f mpegts "srt://0.0.0.0:9998?mode=listener&latency=200000"Command Parameter Breakdown
-re: Reads the input at its native frame rate. Required when streaming from pre-recorded media files; omit this flag when using real-time hardware inputs (e.g., v4l2, decklink).-c:v libx264 -preset ultrafast -tune zerolatency: Encodes the video stream to H.264 while minimizing latency by disabling frame buffering and B-frames.-f mpegts: Forces the transport stream to MPEG-TS, which is the required container format for SRT transmission in FFmpeg.0.0.0.0: Instructs FFmpeg to bind to all available network interfaces. You can replace this with a specific local interface IP address (e.g.,192.168.1.50).mode=listener: Sets FFmpeg to wait for an incoming connection rather than attempting to connect to a remote host (caller mode).latency=200000: Sets the SRT buffer latency in microseconds (200,000 µs = 200 ms). Increase this value if you experience packet loss or high network jitter.
Connecting a Client to the Stream
Once the listener command is running, any player or receiver configured in caller mode can pull the feed by targeting the listener's IP address and port:
ffplay "srt://<LISTENER_IP>:9998?mode=caller"