Ingest RTSP, SRT, or RTMP streams into Wowza Streaming Engine for playback with WebRTC

Learn how to use Wowza Streaming Engine™ media server software to ingest a non-WebRTC source stream and play it back with WebRTC or WebRTC plus other scalable HTTP-based streaming protocols like HLS.

About non-WebRTC to WebRTC workflows


Wowza Streaming Engine 4.7.7 and later can ingest RTSP, SRT, and RTMP streams and output those streams as WebRTC content for playback on mobile and desktop browsers that support WebRTC APIs. This workflow provides flexibility for publishing streams to Wowza Streaming Engine while maintaining the benefits of WebRTC for playback: low latency when compared with HTTP-based streaming; browser-based playback without plugins or protocol-specific, proprietary players; and the robust feature set of the open source WebRTC framework.

Wowza Streaming Engine also supports hybrid workflows: ingesting streams from RTSP, SRT, or RTMP to deliver the streams over WebRTC and HTTP-based protocols like HLS and MPEG-DASH or any playback protocol that Wowza Streaming Engine supports. This allows a scaled approach for delivery using a content delivery network (CDN) in addition to direct WebRTC browser connections. 

When planning a non-WebRTC to WebRTC workflow, consider whether you’ll need to transcode the stream to achieve your goal of WebRTC playback. Transcoding is required when the ingest source stream has a different audio codec, video codec or video encoding profile from the WebRTC output. The workflows in this article provide a few possibilities for non-WebRTC ingest to WebRTC playback, but they aren’t an exhaustive list.

Set up Wowza Streaming Engine for WebRTC playback


Before setting up your IP camera or encoder, you'll need to configure Wowza Streaming Engine for WebRTC. WebRTC streaming can't be configured in Wowza Streaming Engine Manager. You must configure it in XML at the VHost and application level. The following three sections are required for WebRTC setup.

Configure SSL/TLS for Wowza Streaming Engine

Encryption is required for all components of the WebRTC workflow. You must have a secure HTTP (HTTPS) connection to a web camera for WebRTC publishing and playback. As a result, due to cross-domain issues, you'll need to configure an SSL certificate to secure the connection between the browser and Wowza Streaming Engine for the SDP data exchange.

We recommend the free Wowza StreamLock certificate to secure this connection. The instructions in this article assume you've configured port 443 with an SSL certificate.

If you plan to use your own SSL certificate, the following resources may help you convert your SSL certificate to the Java KeyStore (JKS) format that's required by Wowza Streaming Engine. Although it's possible to use self-signed certificates with WebRTC, note that you must ensure the browser you're using to test accepts traffic encrypted with any self-signed certificates in use.


Configure the HTTP provider

You must configure the HTTPWebRTCExchangeSessionInfo HTTP provider to support an SDP exchange for the WebRTC session.

Configure a live application

After the HTTP provider is added to your VHost.xml file, configure a live application for WebRTC streaming. This example uses the live application that's included in the default Wowza Streaming Engine installation. If you plan to use the example WebRTC test pages in GitHub, you'll need to change the application name referenced in the examples from webrtc to live or create a new custom live application named webrtc.

Connect a non-WebRTC source to Wowza Streaming Engine


Next, set up a source to publish the stream to Wowza Streaming Engine and configure a transcoder template, when necessary, to prepare for playback using WebRTC. Select one workflow from the following options.

Set up an RTSP source for a passthrough video-only stream

In this example workflow, you'll ingest a stream from an IP camera or RTSP encoder into Wowza Streaming Engine with an output of WebRTC video-only playback. The example RSTP source stream has H.264 video and AAC audio. If you require audio playback, you need to transcode the audio stream in Wowza Streaming Engine from the AAC audio codec to the Opus audio codec for WebRTC output. In this example scenario, Wowza Streaming Engine ingests an RTSP stream, passes through video and audio, and makes a video-only WebRTC stream available for playback. By default, Wowza Streaming Engine can package the stream into HLS, MPEG-DASH, and other protocols for playback at scale.

Set up an SRT source for a transcoded audio, passthrough video stream

In this example workflow, you'll ingest an SRT stream from an encoder into Wowza Streaming Engine with an output of WebRTC video and audio playback. The example SRT stream has AAC audio and H.264 video. You’ll need to use Wowza Streaming Engine to transcode the AAC audio to Opus for WebRTC output. Wowza Streaming Engine ingests the SRT stream, transcodes the audio, passes through the video, and makes a WebRTC stream available for playback. By default, Wowza Streaming Engine can package the stream into HLS, MPEG-DASH, and other protocols for playback at scale. Transcoding introduces latency into the media delivery pipeline, so this transcoded workflow will have a longer startup time and higher latency than a passthrough video-only workflow.

Set up an RTMP source for a transcoded video and audio stream

In this example workflow, you'll ingest an RTMP stream from a camera or encoder into Wowza Streaming Engine with an output of WebRTC video and audio playback. The example RTMP stream has AAC audio and H.264 video with a High profile. You’ll need to transcode the AAC audio to Opus, and, for this example, you'll also transcode the H.264 video to adjust the profile from High to Main. Wowza Streaming Engine ingests the RTMP stream, transcodes the video and audio, and makes a WebRTC stream available for playback. By default, Wowza Streaming Engine can package the stream into HLS, MPEG-DASH, and other protocols for playback at scale. Transcoding introduces latency into the media delivery pipeline, so this transcoded workflow will have a longer startup time and higher latency than a passthrough video-only workflow.

Tune for latency

The expected latency of passthrough streams that output WebRTC is one second or less. Transcoding, however, introduces latency into the media delivery pipeline. Streams that require audio or video transcoding have an expected latency of two seconds or less. While some amount of latency is expected due to frame buffering in your encoder, there are steps you can take to tune the WebRTC stream for low latency, depending on the source and whether it needs to be transcoded. 

Test playback


Now that your custom live application and source stream ingest is set up, you can test out your workflow.

Test WebRTC playback

In production environments, a WebRTC playback page must be hosted on a web server utilizing SSL/TLS encryption. For testing and learning purposes, Wowza provides a hosted WebRTC playback test page so you can see WebRTC in action more quickly.

Note:
  1. Ensure that your IP camera or encoder is sending a source stream to Wowza Streaming Engine.
  2. In a browser tab, go to the WebRTC play hosted test page.
  3. In the Signaling URL field, enter the secure WebSocket URL to connect to the Wowza Streaming Engine WebRTC sessions listener: 
    wss://[ssl-certificate-domain-name]/webrtc-session.json
    where ssl-certificate-domain-name is the secure domain name for your Wowza Streaming Engine instance.

    If using Wowza StreamLock, for example, the Signaling URL looks something like this:
    wss://5ab4321c0d123.streamlock.net/webrtc-session.json

    If you are connecting WebRTC sessions using a port other than the standard SSL/TLS port 443, you must include that non-standard port in the Signaling URL:
    wss://5ab4321c0d123.streamlock.net:[SSL-port-number]/webrtc-session.json
  4. Enter an Application Name that matches the WebRTC live application you configured.
  5. For Stream Name, enter a name for the stream, such as myStream.
  6. To play the WebRTC stream from Wowza Streaming Engine, click Play.
  7. To test playback in a different browser or with a different device, click Copy config (copy config icon) to copy the configuration settings and share them.

For more advanced learning and testing, Wowza Media Systems provides WebRTC examples on GitHub that demonstrate how to play WebRTC streams with Wowza Streaming Engine. See Use WebRTC example pages with Wowza Streaming Engine.

Test playback for HLS or other protocols

By default, Wowza Streaming Engine packages incoming source streams into multiple playback protocols including HLS and MPEG-DASH. See the Wowza Video Test Players page to test playback using these protocols from Wowza Streaming Engine.

More resources