Receive SRT Stream and Transcode to HLS Using FFmpeg

This article demonstrates how to securely ingest a Secure Reliable Transport (SRT) stream and transcode it into an HTTP Live Streaming (HLS) playlist using a single, efficient FFmpeg command. You will learn the specific command-line parameters required to handle SRT encryption and configure the HLS segmenter for optimal web playback.

To achieve this in a single step, FFmpeg must be compiled with both SRT support (--enable-libsrt) and your preferred video encoder (such as --enable-libx264).

The FFmpeg Command

Below is the complete, single-line command to receive an encrypted SRT stream as a listener and transcode it to HLS:

ffmpeg -i "srt://0.0.0.0:9000?mode=listener&passphrase=YourSecurePassword123&pbkeylen=32" \
-c:v libx264 -preset veryfast -g 60 -keyint_min 60 -sc_threshold 0 \
-c:a aac -b:a 128k \
-f hls -hls_time 4 -hls_list_size 10 -hls_flags delete_segments \
-hls_segment_filename "segment_%03d.ts" playlist.m3u8

Command Breakdown

1. Secure SRT Input Options

2. Video and Audio Transcoding

3. HLS Output Options