How to Stream Video Over RIST with FFmpeg
This guide explains how to stream live video using the Reliable Internet Stream Transport (RIST) protocol with FFmpeg. RIST is an open-source, RTP-based protocol designed for low-latency, reliable transmission of video over unpredictable networks like the public internet. You will learn the necessary FFmpeg prerequisites, basic sender and receiver commands, and key configuration parameters to optimize transmission reliability and latency.
Prerequisites
To use RIST, your FFmpeg build must be compiled with the
librist library enabled. Verify your build supports the
protocol by running:
ffmpeg -protocols | grep ristIf rist appears under both supported file protocols for
input and output, your installation is ready.
Sending a Video Stream via RIST
To send a stream, transmit a transport stream (mpegts)
to the receiver's IP address and port.
ffmpeg -re -i input.mp4 -c:v libx264 -preset veryfast -b:v 3000k -c:a aac -f mpegts "rist://192.168.1.100:1234?buffer=1000"-re: Reads the input at its native frame rate (essential for live simulation).-c:v libx264and-c:a aac: Encodes video to H.264 and audio to AAC. If your input is already an MPEG-TS compatible format, you can use-c copyto skip encoding.-f mpegts: Formats the container as MPEG Transport Stream."rist://...": The target address and port.?buffer=1000: Sets the internal packet recovery buffer to 1000 milliseconds.
Receiving a Video Stream via RIST
The receiving device must bind to an interface and listen for incoming packets. In RIST, the receiver typically acts as the listening endpoint.
To view the incoming stream using ffplay:
ffplay "rist://0.0.0.0:1234?mode=listen&buffer=1000"To record or process the incoming stream with
ffmpeg:
ffmpeg -i "rist://0.0.0.0:1234?mode=listen&buffer=1000" -c copy output.mp4mode=listen: Tells FFmpeg to act as a server and wait for the sender to initiate the connection.0.0.0.0:1234: Binds the listener to all network interfaces on port 1234.
Important RIST URL Parameters
You can fine-tune the RIST connection by appending URL parameters after the target address:
- mode: Defines endpoint behavior. Accepted values
are
listenorsender. By default, FFmpeg acts as a caller. - buffer: Time (in milliseconds) reserved for packet
retransmission and packet-loss recovery (e.g.,
buffer=500). Increase this value for high-jitter or lossy connections. - profile: Sets the RIST profile. Available options
are
simple,main(default), andadvanced. Themainprofile supports multi-stream multiplexing and encryption. - fifo_size: Defines the buffer size for queueing packets before network dispatch.
- pkt_size: Sets the maximum size of RIST packets (default is typically 1316 bytes to align with 7 MPEG-TS packets).