Capture Secure RTSP (RTSPS) Stream with FFmpeg on Windows

This guide provides a straightforward, step-by-step tutorial on how to capture and record a secure RTSP (RTSPS) stream using FFmpeg on a Windows operating system. You will learn how to verify your FFmpeg installation for SSL/TLS support, construct the correct command-line syntax to handle secure connections, and save the stream into a standard video format.

Step 1: Install FFmpeg with TLS Support

To capture an RTSPS (RTSP over TLS/SSL) stream, your FFmpeg build must support secure protocols. Most modern Windows builds of FFmpeg (such as those from gyan.dev) include TLS support by default.

  1. Download the latest FFmpeg essentials or full build for Windows.

  2. Extract the ZIP folder and add the bin folder to your system’s Environment Variables (PATH) so you can run FFmpeg from any Command Prompt window.

  3. Open Command Prompt and run the following command to verify that rtsps is a supported protocol:

    ffmpeg -protocols

    Look for rtsps under the “Input” section of the output list.

Step 2: Construct the RTSPS Command

An RTSPS URL typically looks like this: rtsps://username:password@ip_address:port/stream_path. Because RTSPS relies on TLS encryption, you may need to bypass certificate verification if you are connecting to a local IP camera with a self-signed certificate.

Use the following command structure to capture the stream:

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

Command Breakdown:

Step 3: Run and Stop the Capture

  1. Open Command Prompt or PowerShell on Windows.
  2. Paste your customized FFmpeg command and press Enter.
  3. FFmpeg will connect to the camera and begin writing the stream to your specified file (e.g., output.mp4).
  4. To safely stop recording and close the file container without corrupting the video, press Q on your keyboard while the Command Prompt window is active.