What is RTSP protocol for IP cameras

The RTSP protocol can be used to transmit images on CCTV systems and due to its compatibility with several devices, it is a great option for hybrid projects.

In this article, you will learn what the RTSP protocol is and how to use it for an IP camera, digital recorder (DVR) or network recorder (NVR).

IP camera video stream via RTSP concept

What is the RTSP protocol?

RSTP is an acronym for "Real Time Streaming Protocol", meaning it was designed to send audio or video live from one device to another.

This protocol was not created exclusively for CCTV, it was already used in other sectors where there is a need for real-time transmission and was adopted by video surveillance device manufacturers and became a standard protocol.


The RTSP protocol for CCTV

Video surveillance manufacturers implement the RTSP protocol on their cameras, recorders, and software so that they are compatible with other devices that are available in the market.

When purchasing an IP camera and a video network recorder from different manufacturers, you can have them communicate using this universal protocol.

To configure the equipment it is necessary to find out which RTSP command is to be used and this information can be found in the product's manual or by consulting the technical support team.

How to use the RTSP protocol

Imagine that you have purchased an IP camera from Dahua (a Chinese manufacturer) and want to use it with a network recorder (NVR) that you already own, but it is from a different manufacturer, such as Samsung.

You should search the Dahua's camera manual for the RTSP command that should be used to stream video over the network.

If you do not find this information in the product's manual you should contact the manufacturer technical support team as it is essential that you get the correct command so your equipment can communicate with each other.

After obtaining this information, you must insert it into the recorder which will initiate a request to send video through this universal protocol.

RTSP command for IP cameras

In practice, just open the NVR menu and input the RTSP command followed by the username and password of the IP camera and upon receiving this information the camera will send a real-time video stream.


How to use the RTSP protocol for cloud recording

The principle for video recording in the cloud is the same, just use the correct RTSP command to request the camera to send the video to the server that is located somewhere on the Internet.

The diagram below shows a IP camera that is installed on an internal network and it is connected to a router. You just need to set up the cloud recording server to send the RTSP command over the Internet and as soon as it is received by the camera it starts video streaming.

IP camera RTSP command

In this example, the server simply sends the RTSP command over the Internet and upon reaching the external interface of the router it routes to the internal network where the camera is located.

Therefore, it is necessary to configure the router and input the routing rules that are based on the network interfaces and communication ports.

How to Test an IP Camera with the RTSP Protocol

Before trying to set up a CCTV system it is interesting to make sure everything will work properly and the best way to do this is through simple tests like connecting an IP camera with a traditional software that uses the RTSP protocol.

There is a traditional free software called VLC that can be used for such tests. The diagram below shows an example of how to use it.

RTSP in a local network

In this example, an IP camera is connected to the router which in turn is connected to the laptop that uses the VLC software to send the RTSP command to the camera. Everything is on the local network and therefore there is no need for routing rules (the devices are attached to the internal ports).

In the VLC software, just open the "Media> Open Network Stream" menu or type CTRL + N and paste the RTSP command from the IP camera.

Teste de RTSP

In our example, the IP of the camera is 192.168.2.107 and the RTSP port is 554, this information must be entered in the command that will be sent to the camera. See the example in the image below:

Comando RTSP no VLC

The command in this case is:

rtsp://192.168.2.107:554/user=admin_password=admin_channel=1_stream=0.sdp?real_stream

After sending the command you can see the image of the IP camera directly on the laptop, which proves that the command used is correct and the network connections and IPs are also correct.

Exemplo de streaming via RTSP

After this initial test it is possible to move on to more advanced tests and use a remote connection with IP camera recorders or cloud recording systems.


A practical example of using the RTSP protocol via the cloud

Let's talk about a practical example of using the RTSP protocol for CCTV.

Imagine a situation where you have some analog security cameras connected to a digital recorder (DVR) and your intention is to have redundant video recordings. You just need to choose a service that allows you to store everything on a server in the cloud (somewhere in the Internet).

There are several cloud services available in the market such as CamCloud, CameraFTP, and Angelcam and you can choose the one that best suits your needs.

In this example I will use the services of Angelcam that works with different device brands and also work well with the RTSP protocol.

IP camera RTSP command

==> For more details, I recommend reading the other article: CCTV camera cloud recording: Using online IP camera storage

Configuring the router to work with the cloud

Before doing the tests with the command in the cloud, it is necessary to configure the router, this procedure is extremely simple, just use the IP information and port of the IP camera.

Basically, you have to inform the router that it should direct traffic coming from the Internet to the IP camera whenever the request is to a particular logical port which in the case of the RTSP protocol is by default the 554 .

See the image below that shows the configuration of the router, note that the configuration for this model must be made in the "Applications and games" menu the IP camera address is 192.168.2.107 and the port is 554.

RTSP rule in a router

Obviously you will have to look for other menus in different models of routers, usually you find this menu as port forwarding, port forwarding or NAT.


How to configure the cloud server

Dahua DVR can work seamlessly with this service because it allows the use of RTSP command and the information we need for configuration is available in the product's manual.

In this specific case, the device is a 4-channel Dahua DVR that uses the following RTSP command:

rtsp://<IP>:<Port>/user=<username>_password=<pass>_channel=<channel>_stream=0.sdp?real_stream

Just use this command and replace the IP, port, user and password information and that's it, everything will work according to your network. Everything must be configured on the server side of the cloud and the routing rules must be ready on the router that is on your local network.

See in the following image an example of how to configure the Angelcam's cloud. After creating a platform account in the site https://angelcam.com login with the user and password and choose the option DVR and NVR.

Angelcam Adicionar câmera
Angelcam escolha do DVR

After this step simply type or paste the RTSP command as shown in the following image

RTSP command

Note that the command used includes the external IP used by the router and the 554 port that was used in the router configuration and which is the DVR standard.

It is important to understand the concept, the RTSP command sent by the cloud server arrives at the router through the external interface before being routed according to established rules and therefore, you must make sure which is the external IP of the used by the router.

The following image shows the end result of the camera connection to the server in the cloud.

Angelcam DVR

In some cases you will notice that the image may suffer some quality variations due to some factors such as lack of Internet link stability, available bandwidth reduction or incompatibility of commands between the cloud server or camera.

Be sure to upgrade the IP camera firmware to the latest version available, this helps maintain compatibility with systems that use RTSP as cloud services and other brand recorders.

If you do not have a static IP on your Internet link

If you do not have a static IP on your Internet link, you can use a DDNS service available on the Internet, so the cloud service will continue to work and record the images from your camera even when there was an automatic change of the external IP of your router.


How to find your IP camera's RTSP command

The simplest way to find the command used by your camera or recorder is to consult the product's manual, if this is not possible contact your equipment supplier, if you still have problems you may try to use the ONVIF DEVICE MANAGER software following the instructions from the article ONVIF Device Manager Review and Download (Test IP Cameras)

Final considerations

Now you already know what the RTSP protocol is and how you can do the tests and use it in practical situations.

I recommend that you run local tests with the VLC software and the devices you have on your network to familiarize yourself with the use of this protocol


Want to learn more ?

If you want to become a professional CCTV installer or designer, take a look at the material available in the blog. Just click the links below:

Ultimate Guide V3

Please share this information with your friends...