In this article, we are going to show a tutorial on how to play RTSP stream via a command-line interface using FFmpeg. RTSP stands for Real Time Streaming Protocol and it is a standard protocol that governs the transfer of real-time media streams between client and server. It is primarily used for surveillance and live CCTV footage monitoring. Earlier, we showed you how to play the RTSP stream in the VLC media player. Now, if you want to watch RTSP stream through the command prompt, you can use FFmpeg software.
FFmpeg is a free, open-source, and portable audio and video processing software using which you can perform a lot of tasks like resize videos, batch rotates videos, convert videos, and more. In addition to that, you can also use it to play videos including live RTSP streams. You just need to enter one simple command in the Command Promot to do that. Here, I am going to mention step by step process to play RTSP stream via command line using FFmpeg. So, let’s get started now!
How to play RTSP stream via Command Line Interface using FFmpeg
Here are the main steps to play RTSP stream via Command Line interface using FFmpeg:
- Download FFmpeg.
- Unzip downloaded the FFmpeg ZIP folder.
- Open Command Prompt in the Unzipped FFmpeg folder.
- Type a command with the RTSP stream that you want to play.
- Press Enter button to watch the RTSP stream.
Let us check out the above steps in detail!
Next, open the extracted FFmpeg folder and then open the Command Prompt in this folder by typing CMD in the address bar and pressing the Enter button.
After that, type a command in the below syntax and then press the Enter button.
ffplay.exe <RTSP URL>
The ffplay.exe application is basically used to play and watch media files using FFmpeg. So, you need to mention this application with RTSP URL to play RTSP stream.
An example of one such command is written below:
As you press Enter to execute the above command, it will open up a video player window where you will be able to watch the RTSP stream. You can use the spacebar to play/ pause the video, double click on the window to play the RTSP video in fullscreen, and use other keyboard and mouse gestures to control video playback.
So, this is how you can use an easy-to-use command to play and watch RTSP stream via a command-line interface using FFmpeg.