Real-time Streaming (RTSP) Protocol: What is it and how does it work?
If you are looking for a video streaming protocol that does not require WIFI or an Internet connection with low latency, real-time streaming protocol (RTSP) might suit your needs. Read on to learn more about the compatibility, recording, and rebroadcasting capabilities of RTSP.
What Is Real-Time Streaming Protocol (RTSP)?
Real-Time Streaming Protocol (RTSP) is a network protocol designed to control streaming media in entertainment and communications systems. The protocol combines transcoding and programming to transfer video over a network or to the internet with an easy-to-use link. One of the most common use cases of the RTSP protocol is security camera systems, where the media is a video stream that can be with or without audio.
How Does RTSP Work?
RTSP functions similarly to HTTP, described as a "network remote control" for media servers. This protocol was designed to control video and audio streams without downloading media files. When a video stream begins, the device leveraging RTSP sends a request to the media server that initiates the setup process.
The first request must also inform the client about the available options through the Options command. After that, a user can watch or turn off the stream. In addition to the Options request, RTSP supports several control commands like play, pause, and setup. RTSP leverages TCP to maintain an end-to-end and stable connection without requiring local download or caching.
However, the protocol does not support content encryption or retransmission of lost media packets and cannot stream directly to a browser over HTTP. This is because RTSP is connected to a dedicated server for streaming and relies on RTP to transmit real media. To circumvent this, you must use FFMPEG to convert the RTSP to an HLS stream. This major limitation and its inability to scale led to a drop in RTSP usage.
RTSP can send the following commands from the client to the server when negotiating and controlling media transmissions:
- Options: This request determines what other types of requests the media server will accept
- Describe: This request identifies the URL and type of data
- Announce: This request describes the presentation when sent from the client to the server and updates the description when returned
- Setup: This request specifies how a media stream must be transported before a play request is sent
- Play: This request starts the media transmission by signaling to the server to start sending the data
- Pause: This request temporarily halts the stream delivery
- Record: This request initiates a recording of the media stream
- Teardown: This request terminates the session and stops all media streams
- Redirect: This request informs the client that it must connect to another server by providing a new URL for the client to issue requests to
Technical Overview of RTSP
The components below comprise the technicals details, benefits, and drawbacks of the RTSP streaming protocol:
- Audio Codecs: AAC, AAC-LC, HE-AAC+ v1 & v2, MP3, Speex, Opus, Vorbis
- Video Codecs: H.265, H.264, VP9, VP8
- Playback Compatibility: Not widely supported and rarely used for playback
- Benefits: Low-latency
- Drawbacks: Low quality of experience, low compatibility, and limited scalability
- Latency: 2-second average
- Variant Formats: The entire stack of real-time protocol (RTP) includes Real-Time Control Protocol (RTCP) and RTSP, and it is often referred to as RTSP
When To Use The RTSP Protocol
There are 5 common instances where the RTSP protocol is the best option for users:
1. Increasing ONVIF Compatibility
RTSP can greatly assist with ONVIF compatibility for security cameras. It offers the option of an alternate audio and video stream if ONVIF is incompatible with a security device. This typically happens when a user attempts to utilize an IP camera with a third-party recorder. Most professional network video recorder (NVR) systems provide alternate ways to add 3rd party manufactured cameras, one of them being to access the RTSP stream from a camera.
2. Recording To a Secondary Location
RTSP streaming can re-record and store the transmitted stream on a 3rd party server or recorder. Many media and network attached storage (NAS) servers support RTSP since it has been around for decades. Most NVR systems can also accept RTSP streams to record, a useful feature for users who prefer or are required to have a secondary backup of their footage.
3. Smart Home System Integration
Companies like Control4, Savant, and other smart home installers offer RTSP stream compatibility for security cameras, recorders, and other automated home devices. 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.
4. VLC Media Player
The VLC Media Player can access RTSP streams that a camera or system provides. With VLC, you can watch a camera without logging into the web interface. Lower bitrates allow for more retention on recorder storage and less data usage when remote viewing.
5. Rebroadcasting To Live Streaming Services
RTSP can stream a security camera feed 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 an RTMP (Real Time Messaging Protocol) stream to rebroadcast over the internet. But, pairing an RTSP stream with streaming software, like Open Broadcasting Software (OBS), offers a way to convert an RTSP stream to RTMP.
RTSP vs. RTMP
Both RTSP and RTMP are designed for efficient and low-latency streaming of video files. While broadcasters widely use RTMP, RTSP is mainly used for localized streaming from IP cameras.
RealNetworks developed RTSP in 1996, designed to control the entertainment and communication systems in a streaming server RTSP utilizes User Datagram Protocol (UDP) and Real-time Transport Protocol (RTP). RTSP is the standard protocol used for streaming video data from IP cameras and supports reliable segmented streaming, enabling users to watch streams while it's still being downloaded. The protocol also provides extensive customization options to help you build your own streaming applications and add new features. The main disadvantage of RTSP is that it isn't widely used for broadcasting multimedia over the Internet.
Real-Time Messaging Protocol (RTMP) was developed by Macromedia and is now owned by Adobe. RTMP was originally designed to establish a stable connection between a media server and a Flash player. It uses Transmission Control Protocol (TCP) to transmit data packets from the server. A major benefit of RTMP is that it maintains a stable connection between your hosting server and the client's server, which helps provide a seamless low-latency streaming experience, regardless of internet connection. The top two major disadvantages of RTMP are that it isn't compatible with HTML5 players and the protocol is vulnerable to bandwidth issues.
Frequently Asked Questions
Does RTSP need wifi?
RTSP does not require WIFI or an internet connection. You can simply use static IPs for the cameras via your router.
Do browsers support RTSP?
Direct RTSP streaming is not supported by browsers. You can use a proxy server that will convert RTSP to an HTTP stream as a workaround if you have to play an RTSP stream in a browser.
Is RTSP push or pull?
Pull; most IP cameras use the RTSP protocol to pull data to the media server.
What protocol does RTSP use?
Is RTSP protocol secure?
RTSP does not support content encryption because RTSP is connected to a dedicated server for streaming and relies on RTP to transmit real media. This major limitation led to a drop in RTSP usage.
Is RTSP a TCP or UDP?
RTSP uses a Transmission Control Protocol (TCP) connection, but it is also possible to use UDP.
Is RTSP protocol still used?
While RTSP has not been able to keep up with the popularity of other streaming protocols and has major disadvantages compared to them, RTSP remains standard in many surveillance and closed-circuit television (CCTV) architectures.