Configure RIST Main and Simple Profiles in FFmpeg

Reliable Internet Stream Transport (RIST) is an open-source, low-latency transport protocol designed for reliable video delivery over unpredictable networks. This guide explains how to configure both the Simple and Main profiles of RIST in FFmpeg using the librist protocol wrapper. You will learn the core differences between the two profiles, how to specify them in standard FFmpeg commands, and how to apply profile-specific parameters such as encryption and buffer sizes.

Prerequisites

To use RIST in FFmpeg, your FFmpeg build must be compiled with librist support enabled (--enable-librist). You can verify this by running:

ffmpeg -protocols | grep rist

If rist appears under output and input protocols, your build supports it.

Understanding RIST Profiles

  • Simple Profile: Focuses strictly on packet loss recovery using RTP, RTCP, and ARQ (NACKs). It features minimal overhead and does not support encryption, multiplexing, or tunneling.
  • Main Profile: Wraps payloads in GRE (Generic Routing Encapsulation) tunnels, allowing for stream multiplexing, pre-shared key (PSK) AES encryption, and null-packet deletion.

Configuring the Simple Profile

The Simple Profile is best suited for trusted local networks or private connections where encryption is handled by other layers and low protocol overhead is paramount.

To output a stream using the Simple Profile, append ?profile=simple to your RIST destination URL:

ffmpeg -re -i input.mp4 -c:v copy -c:a copy -f mpegts "rist://receiver_ip:5004?profile=simple&buffer_size=1000"

To receive a Simple Profile stream:

ffmpeg -i "rist://0.0.0.0:5004?profile=simple&buffer_size=1000" -c copy output.ts
  • buffer_size: Defines the ARQ buffer duration in milliseconds (default is often 1000ms).

Configuring the Main Profile

The Main Profile is designed for the public internet and environments requiring stream security and multi-client routing. It enables GRE encapsulation and AES encryption.

To send a stream using the Main Profile with AES-128 or AES-256 encryption:

ffmpeg -re -i input.mp4 -c:v copy -c:a copy -f mpegts \
"rist://receiver_ip:5004?profile=main&secret=YourPassphraseHere&aes_type=256&buffer_size=1000"

To receive the encrypted Main Profile stream:

ffmpeg -i "rist://0.0.0.0:5004?profile=main&secret=YourPassphraseHere&aes_type=256&buffer_size=1000" \
-c copy output.ts

Key RIST Parameters in FFmpeg

You can chain multiple query parameters to the rist:// URL to fine-tune your stream:

  • profile: Set to simple, main, or advanced. The default is typically main if encryption is specified.
  • secret: The pre-shared key (passphrase) for encrypting the session (Main/Advanced profile only).
  • aes_type: Defines the encryption strength. Accepted values are 128 or 256.
  • buffer_size: Sets the recovery buffer in milliseconds. A higher value handles longer bursts of packet loss at the cost of higher latency.
  • packet_size: Specifies the maximum packet size (defaults to 1316 bytes for standard TS payloads).