RTSP: The Real-Time Streaming Protocol ExplainedSeptember 16, 2020
The Real-Time Streaming Protocol (RTSP) is a tried-and-true technology used to control audio/video transmission between two endpoints and facilitate the transportation of low-latency streaming content across the internet.
Along with the Real-Time Messaging Protocol (RTMP), RTSP once dominated the video streaming landscape. Although that’s no longer the case today, RTSP remains standard in many surveillance and closed-circuit television (CCTV) architectures. The reason for this is simple: it’s still the protocol of choice for IP cameras.
In this article, we’ll look at the RTSP specification, the history behind RTSP streaming, and typical workflows using this protocol.
What Is a Protocol?
In the realm of computer science, protocols provide a set of rules governing how data travels from one communicating system to another. For instance, the Hypertext Transfer Protocol (HTTP) defines how webpage data and hypertext links are transmitted across the World Wide Web by governing communications between web servers and browsers.
By extension, streaming protocols handle the delivery of live and on-demand streaming content. RTSP is one of the foundational technologies making up the streaming protocol suite, designed to establish and maintain sessions between a source and the streaming server.
What Is RTSP?
To restate our definition now that we’ve covered the basics, RTSP is an application-layer protocol used for commanding streaming media servers via pause and play capabilities. It thereby facilitates real-time control of the streaming media by communicating with the server — without actually transmitting the data itself. Rather, RTSP servers often leverage the Real-Time Transport Protocol (RTP) in conjunction with the Real-Time Control Protocol (RTCP) to move the actual streaming data.
The official definition from a 1998 proposal of the standard states:
“The Real-Time Streaming Protocol (RTSP) establishes and controls either a single or several time-synchronized streams of continuous media such as audio and video. It does not typically deliver the continuous streams itself, although interleaving of the continuous media stream with the control stream is possible. In other words, RTSP acts as a “network remote control” for multimedia servers.”
So, when a user initiates a video stream from an IP camera using RTSP, the device sends an RTSP request to the streaming server that jumpstarts the setup process. The video and audio data can then be transmitted using RTP. You can thus think of RTSP in terms of a television remote control for media streaming, with RTP acting as the broadcast itself.
RTSP: A Snapshot
- Audio Codecs: AAC, AAC-LC, HE-AAC+ v1 & v2, MP3, Speex, Opus, Vorbis
- Video Codecs: H.265 (preview), H.264, VP9, VP8
- Playback Compatibility: Not widely supported and rarely used for playback (Quicktime Player and other RTSP/RTP-compliant players, VideoLAN VLC media player, 3Gpp-compatible mobile devices)
- Benefits: Low-latency and ubiquitous in IP cameras
- Drawbacks: Not optimized for quality of experience and scalability
- Latency: 2 seconds
- Variant Formats: The entire stack of RTP, RTCP (Real-Time Control Protocol), and RTSP is often referred to as RTSP
RTSP uses the following commands, typically sent 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: A describe request identifies the URL and type of data.
- Announce: The announce method describes the presentation when sent from the client to the server and updates the description when sent from server to client.
- Setup: Setup requests specify how a media stream must be transported before a play request is sent.
- Play: A play request starts the media transmission by telling the server to start sending the data.
- Pause: Pause requests temporarily halt the stream delivery.
- Record: A record request initiates a media recording.
- Teardown: This request terminates the session entirely and stops all media streams.
- Redirect: Redirect requests inform the client that it must connect to another server by providing a new URL for the client to issue requests to.
Other types of RTSP requests include ‘get parameter,’ ‘set parameter,’ and ’embedded (interleaved) binary data,’ which are detailed here.
History of RTSP Streaming
First developed by Netscape Communications, Progressive Networks (now RealNetworks), and Columbia University, the RTSP specification was published by the Internet Engineering Task Force in 1998. Version 2.0, published in 2016, amended the early version in an effort to shorten roundtrip communication with the media server.
Before the emergence of adaptive bitrate streaming via HTTP-based protocols, both RTSP and RTMP powered most streams on the internet. But because both require dedicated servers, they didn’t lend well to large-scale broadcasts.
As such, RTSP is now used primarily as a contribution protocol. Most workflows leverage a media server to ingest streams transmitted via RTSP/RTP and then repackage the file for delivery to viewing devices — ranging from iPhones to smart TVs.
Next-generation alternatives like Secure Reliable Transport (SRT) are competing directly with RTSP for video contribution today. Even so, RTSP remains popular in surveillance workflows as the de facto standard for IP cameras.
RTSP and IP Cameras
Most IP cameras use the RTSP protocol to pull data to the media server. From surveillance to conferencing, IP cameras work great when you want to live-stream from one location without getting too fancy. These user-friendly streaming devices don’t require a separate encoder, and RTSP works great when pairing IP cameras with a stateful server. What’s more, broadcasters can then aggregate the content for delivery to any device with a live transcoding solution. Watch the video below to learn more.
Typical RTSP Workflow
RTSP is a stateful protocol used more often for video contribution (ingest) than for last-mile delivery and playback (egress). Android and iOS devices don’t have RTSP compatible players out of the box, which is the primary reason why RTSP is rarely used for streaming from end to end. Instead, most broadcasters leverage a streaming software or service to repackage the RTSP stream into a more user-friendly format like HLS.
RTSP Streaming With Wowza
Despite its age, RTSP has staying power as an ingest format. But you’ll need a video repackaging solution to deliver the stream to end-user devices.
No matter what No matter what type of streaming architecture you’re trying to build, Wowza makes it happen. Our full-service platform can power any workflow — with reliability to boot. Try a free trial of Wowza Streaming Cloud or Wowza Streaming Engine to get started today.