How to Configure RIST Profiles in FFmpeg
This guide provides a straightforward tutorial on how to configure the Reliable Internet Stream Transport (RIST) protocol in FFmpeg. You will learn the differences between the RIST Simple and Main profiles, how to specify them in your FFmpeg commands, and how to apply key configuration parameters like encryption to ensure secure, low-latency video streaming.
Prerequisites
To use RIST with FFmpeg, your FFmpeg binary must be compiled with the
librist support enabled. You can verify this by running the
following command in your terminal:
ffmpeg -protocols | grep ristIf rist appears in the output, your FFmpeg build
supports the protocol.
Understanding RIST Profiles in FFmpeg
The librist library in FFmpeg supports two primary
profiles:
- Simple Profile: Designed for basic packet recovery using ARQ (Automatic Repeat reQuest). It lacks built-in encryption and multiplexing.
- Main Profile: Builds on the Simple Profile by adding advanced features, including AES encryption, authentication, and port multiplexing.
In FFmpeg, you configure these profiles using the
profile query parameter in the RIST URL. The available
values are simple (or 0) and main
(or 1).
Configuring the Simple Profile
The Simple Profile is the default setting in FFmpeg. It is ideal for point-to-point streaming over private networks where encryption is not required.
Sender (Muxer) Example
To stream a video file using the RIST Simple Profile, use the following syntax:
ffmpeg -re -i input.mp4 -c:v libx264 -preset fast -f mpegts "rist://192.168.1.100:5000?profile=simple"Receiver (Demuxer) Example
To receive the Simple Profile stream:
ffplay "rist://192.168.1.100:5000?profile=simple"Note: Because simple is the default profile,
omitting the ?profile=simple parameter will yield the same
result.
Configuring the Main Profile
The Main Profile is required when streaming over the public internet, as it allows you to encrypt your stream.
When configuring the Main Profile, you should also specify the
encryption type (aes_type) and the pre-shared key/password
(secret).
Supported Encryption Settings
aes_type: Defines the encryption strength. Allowed values are128(AES-128) or256(AES-256).secret: The passphrase used to generate the encryption keys. It must be between 8 and 128 characters.
Sender (Muxer) Example
To stream using the Main Profile with AES-256 encryption:
ffmpeg -re -i input.mp4 -c:v libx264 -preset fast -f mpegts "rist://192.168.1.100:5000?profile=main&secret=MySecurePassphrase123&aes_type=256"Receiver (Demuxer) Example
To receive and decrypt the Main Profile stream, the receiver must match the sender’s profile, secret, and AES type:
ffplay "rist://192.168.1.100:5000?profile=main&secret=MySecurePassphrase123&aes_type=256"Additional RIST Configuration Parameters
You can append more parameters to your RIST URL query string
(separated by &) to fine-tune the stream
performance:
buffer: The size of the recovery buffer in milliseconds (default is 0). Increasing this helper handles higher packet loss but adds latency. Example:buffer=1000(1 second).packet_size: Specifies the RTP packet size (default is 1316 bytes).bandwidth: Limits the maximum bandwidth (in Kbps) allowed for recovery data.