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.
Download the latest FFmpeg essentials or full build for Windows.
Extract the ZIP folder and add the
binfolder to your system’s Environment Variables (PATH) so you can run FFmpeg from any Command Prompt window.Open Command Prompt and run the following command to verify that
rtspsis a supported protocol:ffmpeg -protocolsLook for
rtspsunder 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.mp4Command Breakdown:
-tls_verify 0: Disables TLS certificate verification. This is crucial if your security camera uses a self-signed SSL certificate, which is common in local network setups.-rtsp_transport tcp: Forces FFmpeg to use TCP instead of UDP. TCP is highly recommended for RTSPS to ensure packet delivery and prevent video corruption.-i "rtsps://...": Specifies the input URL of your secure stream. Always wrap the URL in double quotes to prevent Windows Command Prompt from misinterpreting special characters (like&or?) in the stream path.-c copy: Copies the video and audio payloads directly without re-encoding. This saves CPU usage and preserves the original quality of the camera stream.output.mp4: The destination file where the stream will be saved.
Step 3: Run and Stop the Capture
- Open Command Prompt or PowerShell on Windows.
- Paste your customized FFmpeg command and press Enter.
- FFmpeg will connect to the camera and begin writing the stream to
your specified file (e.g.,
output.mp4). - 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.