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 rist

If 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:

  1. Simple Profile: Designed for basic packet recovery using ARQ (Automatic Repeat reQuest). It lacks built-in encryption and multiplexing.
  2. 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

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: