Accessing Live CCTV from RTSP on Local Network on Ubuntu/Linux

Suppose on the same WI-Fi setup in which your computer is connected, there is also a CCTV camera attached on the same local Wi-Fi network. Now in this tutorial, I am going to show you how to access the live CCTV camera from RTSP.

Before we go forward, you have to know the IP address of your CCTV. Suppose the IP address of your CCTV is 192.168.0.109. To verify, if it streaming rtsp, you can use nmap command as shown below:

nmap 192.168.0.109

The above command should shown something like this:

informerfrk@informerfrk:~$ nmap 192.168.0.109
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-08-26 14:31 IST
Nmap scan report for 192.168.0.109
Host is up (0.0042s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT    STATE SERVICE
80/tcp  open  http
554/tcp open  rtsp

Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds

As you can see there is 554 port open which is generally used for RTSP live video streaming.

Now install ffmpeg on your Ubuntu:

sudo apt update
sudo apt install ffmpeg

Now its time to play RTSP video. Below is the command to play RTSP live video using ffmpeg:

ffplay rtsp://admin:password@192.168.0.109:554

In the above command, you have to provide your admin and password.

If you want to access through a specific CCTV stream, then you can use the command like you can see in the example below:

ffplay rtsp://username:password@192.168.0.109:554/stream1

 

Leave a Reply

Your email address will not be published. Required fields are marked *