RTSP or Real Time Streaming Protocol is included on all IP cameras, NVRs, and DVRs that CCTV Camera World sells. RTSP provides the flexibility to integrate video from products manufactured by one company in to third party products. RTSP is a video streaming protocol that provides a video stream for use in third party software or recorders, or for use in live streaming applications. Continue reading to learn more about RTSP streaming and what it can be used for.
What is RTSP?
Real Time Streaming Protocol or RTSP is a network protocol designed for use in entertainment and communications systems to control streaming media. The protocol was designed to create an easy way to access or manipulate a media stream. In CCTV and security camera systems the media is a video stream that can be with or without audio. The protocol packs complex transcoding and programming together behind the scenes to transfer video over a network or to the internet with an easy to use link.
RTSP has many uses outside of CCTV so there is a lot of information out on the web and it can get really technical. Since we’re only concerned about security cameras we’ll focus on how RTSP relates to the security cameras we sell. As we mentioned in the introduction RTSP is an included feature on all of our IP cameras, NVRs, and DVRs when connected to a network.
The RTSP stream from a surveillance system or IP security camera directly relates to the encoding settings that are set on the device itself. This means that anyone looking to stream to a 4K TV or monitor should purchase a 4K security camera or 4K NVR system.
Note: RTSP is a network protocol that requires a network connection. This means that Coaxial cameras, such as CVI or analog, cannot be used for projects with RTSP unless they are paired with a compatible DVR.
When and why use an RTSP stream?
Alternate stream for increased ONVIF compatibility
The main purpose of RTSP when it comes to security cameras is to assist with ONVIF compatibility. While RTSP can only send video and audio it helps by providing another type of stream to try if ONVIF compatibility does not work in the devices you are trying to use. This relates to when someone attempts to use an IP camera with a third-party recorder. Most professional NVR or XVR systems provide alternate ways to add 3rd party manufactured cameras and one of those ways is to access the RTSP stream from a camera.
Recording or live back up to a secondary location
RTSP streaming also provides the ability to re-record and store the stream on another server or recorder. Since RTSP has been around a long time there are many media and NAS servers that have support for RTSP. Most XVR and NVR systems not only provide RTSP streams to send video out, they can also accept RTSP streams to record! This is useful for customers who prefer to have a secondary or redundant backup of their footage, or if it is required by regulations in industries like the marijuana industry.
Smart home system integration
Companies like Control4, Savant, and other smart home installers offer RTSP stream compatibility to display security cameras or recorders on their home automation equipment. RTSP technology provides an easy way for these companies to transmit a video stream to multiple devices in a home at the same time. For example if a person has multiple tablets or home control stations they can pull a stream from a camera or NVR no matter where they are in their home or business.
VLC Media Player
A great program to use RTSP streams with is VLC Media Player. VLC can be used to directly access the RTSP stream that a camera or system provides. The most common use of VLC is to watch a camera without logging into the web interface. Someone who is curious about how encoding settings affect their cameras can use VLC to view the RTSP stream to preview their changes and confirm there are no video artifacts. To finely tune encoding settings we recommend using a trial and error approach. Lower bitrates allow for more retention on recorder storage and less data usage when remote viewing. For more information on bitrates and how they effect remote viewing check out our article on watching security cameras with a slow internet connection.
Rebroadcasting the stream to live streaming services
Last but not least is streaming a security camera to a live stream website. Some common live streaming CCTV projects include: animal sanctuaries, national parks, zoos, beaches, and construction sites. Most live streaming websites require a RTMP (Real Time Messaging Protocol) stream so the stream can be rebroadcast over the internet. Pairing a RTSP stream with streaming software like the free Open Broadcasting Software(OBS) offers a way to convert a RTSP stream to RTMP. Other paid or freemium software options include: Xsplit, VMIX, and Wirecast.
Once the software is setup and configured there will be live video streaming to Youtube, Facebook Live, or Twitch depending on what the user chooses to stream to. To learn more about streaming to the web using OBS as a streaming software watch and read our How to stream a security camera to YouTube Live article.
How do you use the RTSP stream from an IP camera, NVR, or DVR?
We will discuss using the RTSP stream from the security cameras and recorders we carry here at CCTV Camera World. The RTSP stream URL varies from brand to brand but this article is meant for customers who have already purchased or are thinking about purchasing from CCTV Camera World.
Determining what the RTSP stream should be
The RTSP stream needed for a program or direct viewing depends on what a person might want to do with the stream. For example some programs like VLC or media players require the RTSP stream to begin with the prefix “rtsp://”. Other programs might not need the prefix but usually require the user to specify that it is an RTSP stream.
A basic RTSP stream
To create the rest of the RTSP URL link a user will need to know what IP address that is set on their device. By default our cameras are shipped with a 192.168.1.109 IP address and our recorders are shipped with a 192.168.1.108 address. Users can modify the IP address of their device as they see fit but for our example we’ll use the IP camera default. This leads us to an RTSP stream that looks like as follows:
Password protected RTSP stream
Depending on the settings on the device, user credentials may be required for the link to work. The credentials are added before the IP address in the RTSP URL. For example, check out the following RTSP stream. This stream will work for most media players or programs. Replace the USERNAME and PASSWORD in the example with the username and password set on the camera or recorder to access the stream.
Adding additional commands or settings to the stream
Finally, whether it’s a stream from an security camera or recorder, there are additional commands that can be added at the end of an RTSP stream. The commands can be used to determine what channel the stream should come from on a recorder or which stream quality the user wants to stream over RTSP (Mainstream or Substream) from a recorder or camera. To add commands a user must first add the suffix “/cam/realmonitor?” to the link and the link will look like the example below.
The commands go after the ? in the link. The command can be channel or subtype or both. Here are a few examples of choices that can be made using the commands.
Mainstream or Substream - subtype
The “subtype” command can be added to the RTSP link to determine if the stream should pull the Mainstream or Substream from a camera. In layman's terms the mainstream is the full resolution and the substream is a lower resolution and less data intensive stream. This is useful when streaming to the internet if the upload speed at a location is not fast enough to transmit the full mainstream. Check out the example below of the mainstream or substream arguments:
Mainstream - rtsp://USERNAME:PASSWORD@192.168.1.109/cam/realmonitor?channel=1&subtype=0
Substream - rtsp://USERNAME:PASSWORD@192.168.1.109/cam/realmonitor?channel=1&subtype=1
Channel=1 or 2 or … - channel
Channel is used for a stream from a recorder and determines which channel the stream should come from. For example if a user wants the stream from the first camera on their recorder they will add “channel=1” to the end of their link. For the second camera it would be “channel=2” and so on.
Combining commands for NVR or DVR RTSP streams
Not only can you do one command at a time you can combine two commands for a specific stream from a recorder. Since the channel number doesn’t matter from a camera it only makes sense to combine the commands for a stream from an NVR or DVR. For our example we’ll get the 3rd channel from our NVR and the substream of that channel. A user can replace the channel number or stream type as they see fit.
Fetching the RTSP stream from a security camera or recorder involves transcoding the native stream. This transcoding not only has a CPU overhead on the device you are fetching the stream from, it introduces a delay or lag in the video stream. While IP cameras are not lag-free when compared to real-time live action, RTSP increases that lag. To demonstrate what to expect from RTSP streaming, we made the below video comparing the RTSP stream fetched from one of our 4K security cameras in 12MP mode to real live action, and to direct streaming from the camera's web service.