RTSP to WebRTC: Real-Time Surveillance with IP Cameras (Update)
Demand for real-time surveillance continues to grow, with the global video surveillance market projected to reach $83.3 billion in 2028, an almost 10% increase from 2023. Part of this is due to more and more public and private organizations recognizing the value that connected cities, building ecosystems, and more have for safety, security, and cost savings. But possibly more significant are the technological advancements that have made the surveillance opportunities we’ve dreamed of a reality.
Surveillance streaming has evolved beyond traditional CCTV cameras and surveillance control rooms to include connected IP cameras and artificial intelligence (AI), allowing for faster data processing, more accurate predictions for what will happen next in time-sensitive situations, and real-time video delivery to decision makers in remote locations. These new features and capabilities have shifted the security landscape. Technology like facial recognition, which allows IP cameras to capture an image from a significant distance and run it against a database in real time, are transforming surveillance across every vertical.
But what puts the “real-time” in real-time surveillance? How are we able to make these bold claims about the speed with which this newly enhanced data can be gathered, processed, and delivered? That’s where underling protocols like RTSP and WebRTC come into play. By combining the functionality of RTSP with the speed of WebRTC, you can stream surveillance footage at sub-second speeds.
Why Real-Time Surveillance?
Real-time surveillance data is critical in emergency situations where every second counts. Faster data means faster response times from law enforcement and first responders. As such, real-time crime centers across the United States have been created to aggregate and analyze incoming streams using AI capabilities, like facial recognition, license plate readers, and gunshot detection.
Hazardous work environments, military operations, and even healthcare settings also benefit from advancements in real-time surveillance. AngelEye Health, for example, uses Wowza to delivery around-the-clock patient monitoring to parents of newborns in the NICU. Another Wowza customer that chooses to remain anonymous uses IP cameras to stream coastlines in real-time. Real-time surveillance can also be used as evidence in court cases, provide peace of mind for homeowners, and be instrumental in flood and wildfire detection.
Real-Time Surveillance Use Case Summary:
- Industrial robots
- Mining operations
- Healthcare monitoring
- Law enforcement crowd control
- Natural disaster detection and response
- Active-shooter situations
- First response video calls
- Courtroom evidence
- Workplace safety
- Traffic management
From sophisticated drones to camera equipped robots, security capabilities that once only existed in sci-fi films are here and growing at a rapid speed. Innovations in surveillance technology can increase our level of comfort by saving lives, reducing security threats, preventing industrial catastrophes, and sparing businesses from losing millions of dollars.
From real-time analytics to AI and machine learning, are you doing enough to protect your people and property?
What is RTSP?
First developed in a collaboration between RealNetworks, Netscape, and Columbia University back in 1996, the Real-Time Streaming Protocol (RTSP) was designed to create and maintain a connection between raw data sources and streaming servers while also allowing for real time media manipulation. But let’s take several steps back and unpack why that is significant for a real-time surveillance workflow.
Protocols are sets of rules that govern how data is handled within a given workflow. Different types of protocols manage different steps in this process. For example, a transport protocol (sometimes called streaming protocol) dictates how data is packaged and sent from one location to another. A security protocol establishes how data is encrypted or otherwise protected. An application layer protocol defines the parameters or commands by which a server and source might communicate.
So in your RTSP surveillance workflow, RTSP is your application layer protocol that uses the Real-Time Transport Protocol (RTP) to actually transfer the streaming media. RTP brings the data from raw source to server. RTSP gives the server the ability to send commands to the raw source, allowing viewers to pause, playback, and otherwise interact with footage in real time. This unique functionality is what makes RTSP the protocol of choice for IP cameras.
What is WebRTC?
Web Real Time Communications (WebRTC) is a collection of protocols, standards, and Javascript APIs that work together to stream data at sub-second speeds. WebRTC is so fast in part because it eliminates the need for intermediary servers, reducing the number of steps between peers communicating. Basically, it needs only a webcam and browser to accomplish what other streams need a media server and encoder for.
WebRTC’s strength is also its weakness. These stripped-down peer-to-peer connections lack scalability. Despite not requiring it, WebRTC can become more scalable and its use cases more varied when it is paired with streaming infrastructure like media servers and video content delivery networks (CDNs). Even with these additional steps, WebRTC can stream at sub-second speeds.
How Can They Work Together for Real-Time Surveillance?
A single streaming workflow can involve different transport protocols. RTSP (with RTS) is often only used for ingest (packaging data for delivery from the raw source to the media server) as opposed to egress (delivery from the media server to the end user devices).
With most IP cameras using RTSP by default, that can make stream viewing a challenge unless you repackage it into a more playback-friendly protocol like HTTP Live Streaming (HLS) for viewing. Unfortunately, RTSP to HTTP can result in up to 20 seconds of latency, which is unacceptable for critical surveillance use cases.
This is where WebRTC comes in. WebRTC is often used for both ingest and egress without negatively impacting latency. By converting RTSP streams to WebRTC, you can utilize IP cameras and maintain real-time speeds.
Real-Time Surveillance with Wowza
Wowza has on-premises, cloud-based, and hybrid surveillance solutions. Wowza Video, our cloud-based streaming platform, in particular can accelerate your real-time surveillance use case by ingesting your IP camera stream as RTSP and repackaging it into WebRTC for delivery at sub-second speeds. However, our Wowza Streaming Engine software can also offer secure and reliable real-time surveillance. For the purposes of exploring the RTSP to WebRTC workflow, we’ll walk you through how to set it up in Wowza Video.
The configuration is simple:
- Create a live stream.
- Publish the stream using the WebRTC hosted publish page.
- Provide the WebRTC hosted playback page URL to your viewers.
Read on for the full tutorial.
Create a Live Stream Using an RTSP-Based Encoder
- Sign in to Wowza Video
- Click the Live Streams menu, and then click Add Live Stream.
- On the Live Stream Setup page, enter a Live Stream Name. (For our purposes, we will use the name Wowza HQ2.)
Note: The Live Stream Name is required and should be short and descriptive.
- Choose a Broadcast Location.
Note: The Broadcast Location is where Wowza Video transcodes your stream. The Broadcast Location defaults to your browser’s time zone. Choose one that’s as close as possible to the video’s location and that supports the features you want to use.
- Click Next.
- On the Video Source and Transcoder Settings page, look for your specific camera type and click it to connect it. If you can’t find it, then select Other RTSP instead.
- For Live Stream Type, select Adaptive Bitrate. The Passthrough option is not available if you are using WebRTC.
Note: WebRTC does not actually support adaptive bitrate streaming. However, choosing Adaptive Bitrate as your Live Stream Type will allow the transcoder to create an adaptive bitrate HLS stream as well should you need to reach a larger audience.
- Specify how the encoder will communicate with Wowza Video by selecting Pull Stream.
- Enter the encoder’s Source URL.
Note: See the encoder/camera user guide for information about its URL. The hostname or IP address in the URL must be publicly accessible. If authentication information, such as a username and password, is included in the source URL, it can only contain alphanumeric, period (.), underscore (_), and hyphen (-) characters.
Note: By default, Wowza Video uses TCP port 554 for RTSP streaming. If you don’t use the default port, be sure to indicate that in the source URL.
- Select Prioritize Latency to create an HLS stream with the lowest latency possible. Wowza Video will provide you with both WebRTC and HLS playback URLs.
- Specify the Resolution. This should match your camera’s resolution output.
- Click Next for the next three pages, leaving all default settings.
- Click Finish.
Modify The Codecs for WebRTC Playback
For WebRTC playback in Wowza Video, you will need to transcode your RTSP stream to the following codecs:
Do this by configuring your transcoder settings as follows:
- Select Transcoders from the Advanced column in the left navigation pane.
- Click on the transcoder in the list that is the same name as your stream.
- When that page opens, click on Outputs & Targets.
- Locate the Passthrough transcoder (usually at the top) and then click on the symbol for Copy.
- On the next page, click on H.264 as the video codec and Opus as the audio codec.
- Click Copy.
- Click Direct Playback URLs in the navigation.
Note: On this page, you will see a list of the protocols your RTSP stream has been transmuxed into. You will only be charged for egress if any of those playback URLs are used. (Egress is traffic that leaves Wowza Video for Wowza CDN and custom stream targets.)
- The default viewer limit for WebRTC playback is set to 10, but you can click edit and adjust that number up to 300.
- Click on the + symbol next to the WebRTC protocol and copy the last link in the list. It will match the resolution you selected when setting up the stream. You will need this link copied for the next section.
Configure the Hosted WebRTC Playback Page
Wowza Video provides a hosted WebRTC playback page for your convenience.
- Open wowza.com/webrtc/play.
- Click Settings in the upper right corner.
- Paste the WebRTC link from the previous section in the first field: SDP URL.
Note: The SDP URL contains Application Name and Stream Name information that you will need to copy and paste into the fields.
- For your Application Name, enter the characters just after webrtc-session.json.
- For your Stream Name, enter the characters at the end of the SDP URL.
Note: Your URL may display as entrypoint.cloud.wowza.com/webrtc-session.json or entrypoint.video.wowza.com/webrtc-session.json. Either one is fine.
Start the Stream in the Wowza Video Manager
- Return to the Wowza Video dashboard.
- In the left navigation, click Available Streams followed by the name of your stream.
- When the overview page for your stream appears, click the green button that reads Start Live Stream.
- Once the live stream has started, return to your WebRTC playback page.
- Click Play.
Congratulations! Your WebRTC stream will begin on the hosted playback page with a latency averaging sub-500 milliseconds. You may choose to use only the WebRTC playback page, but should you choose to deliver your RTSP stream over both WebRTC and HLS, simply return to the Wowza Video dashboard and click on the HLS Hosted Page URL.
Conclusion: Wowza for Your Security
Most IP cameras, the camera of choice for most surveillance and traffic monitoring operations, send out an RTSP stream that is low latency but can only be viewed with specific software. Wowza, however, can easily convert your RTSP stream to WebRTC for real-time playback in a browser or on any device.
Not sure the RTSP to WebRTC via Wowza Video workflow above is going to satisfy all of your real-time surveillance needs? Schedule a free consultation with a member of our team to learn about surveillance, monitoring, and security solutions across our suite of services.