Capture RTSPS Stream with FFmpeg on macOS

This guide explains how to capture and record a secure RTSP (RTSPS) stream using FFmpeg on macOS. You will learn how to install FFmpeg with the necessary secure protocols, construct the correct command-line syntax for TLS/SSL streams, and save the incoming stream directly to a local video file.

Step 1: Install FFmpeg on macOS

The easiest way to install FFmpeg on macOS is using Homebrew. Homebrew compiles FFmpeg with built-in support for secure protocols like TLS, which is required for RTSPS.

Open your Terminal application and run the following command:

brew install ffmpeg

To verify that your FFmpeg installation supports secure protocols, run:

ffmpeg -protocols | grep rtsps

If rtsps appears in the output, your installation is ready.

Step 2: Prepare the RTSPS URL

An RTSPS URL typically includes the username, password, IP address, port (usually 322 or 8554 for secure streams), and the stream path. It follows this format:

rtsps://username:password@ip_address:port/stream_path

Step 3: Run the FFmpeg Capture Command

To capture the stream and save it as an MP4 file without re-encoding (which preserves quality and minimizes CPU usage), use the following command structure:

ffmpeg -rtsp_transport tcp -tls_verify 0 -i "rtsps://username:password@ip_address:port/stream_path" -c copy output.mp4

Command Breakdown:

Step 4: Stop the Capture

To stop recording, press Ctrl + C in your Terminal window. FFmpeg will safely finalize the container and save the completed video file to your current working directory.