Try Live Demo

The incompatibility between RTSP IP Camera and Web Browsers is a headache. We need to use some third-party plugins for web browsers or use some native applications to watch the IP Camera. It absolutely doesn’t feel comfortable. Luckily, Ant Media provides 2 ways to make RTSP IP Camera WebRTC (Web browser) compatible. With RSTP to WebRTC stream, you can watch RTSP streams with ultra-low latency. The first one is for IP Camera Users and the second one is for IP Camera Manufacturers.

DCS 7010L A1 Side Right rtc

Let me describe these two solutions.

1. Make IP Camera WebRTC Compatible for IP Camera Users

As known, WebRTC is supported by Web Browsers(Safari, Edge, Chrome, Firefox, Opera) natively. If we change the RTSP stream to WebRTC then the RTSP IP Camera can be playable on the Web Browser with WebRTC. So we call it RTSP to WebRTC. This magic happens inside of the Ant Media Server.

Let’s explain how Ant Media Server does this magic.

  • Ant Media Server can pull streams from RTSP, and RTMP servers. IP Cameras are RTSP servers at the same time so that Ant Media Server can pull the IP Camera’s stream via its RTSP URL.
  • Ant Media Server can convert RTSP to WebRTC stream internally and IP Camera stream can be watchable via WebRTC on almost any Web Browser.
WebRTC IP Camera

RTSP IP Camera to Web Browsers via WebRTC(One-to-Many)

  • Watching RTSP IP camera is also scalable which means Ant Media Server can pull stream from IP Camera once and provide many viewers to watch it. In other words, Ant Media Server just multiplexes the IP Camera’s RTSP stream to WebRTC Stream. RTSP to WebRTC provides ultra-low latency (0.5 seconds latency).

How to Add RTSP IP Camera to Ant Media Server

Ant Media Server provides two ways for adding an IP Camera.

The first way is adding the RTSP IP Camera to the Ant Media Server through Web Panel or addStreamSource REST Method.  Let me show you the simpler way,  login to the web panel,  switch to your app, and click “New Live Stream > Stream Source” as shown below.


Just type the RTSP URL to the form and click the “Create” button

ant media server stream source

Ant Media Server Connect to RTSP URL automatically and fetch the stream. Keep in mind that if you need Ultra Low Latency, use WebRTCAppEE for adding the RTSP URL

The second way to add an IP Camera to Ant Media Server is through ONVIF URL. You can check this blog post for learning how to add an IP Camera via the ONVIF URL

2. Embedded WebRTC SDK for IP Camera Manufacturers

This solution is for IP Camera manufacturers. If you just want to use Peer to Peer connection between IP Camera and Web Browser, Ant Media can provide a solution for this case as well.

Embedded WebRTC SDK can run both on ARM and x86 processors. So let me explain what this Embedded WebRTC SDK does.

  • IP Cameras generally have a built-in RTSP URL. You can embed Ant Media’s Native WebRTC SDK into your IP Camera and the SDK let you fetch the RTSP stream internally and can forward the RTSP stream to the other Peer via WebRTC.
  • Native SDK does not transcode the RTSP stream, it just fetches the stream and forwards it to the WebRTC stack. So that it does not need much CPU resources as its normal WebRTC stack needs. In addition, it does not cause any latency.
WebRTC IP Camera

WebRTC IP Camera and Browser (P2P)

  • Signaling of WebRTC SDK is compatible with Ant Media Server. So that you need to use Ant Media Server as a signaling server in order to have peer to peer connection between a web browser and your RTSP IP Camera.

How to Use Embedded WebRTC SDK

We’ve delivered source code, documentation, and support for using Embedded WebRTC SDK.  There is only one method you need to call in your ARM application. Here is the sample code

int main(int argc, char* argv[]) {

signalingThread = rtc::Thread::Current();

“rtsp://”, “stream1”);

return 0;

As you see, the critical method is startWebSocket the method has three parameters

  • The first parameter is the WebSocket URL of the Ant Media Server
  • The Second parameter is the internal RTSP URL of the IP Camera
  • The third parameter is the stream id that will be published

After you run this application, please visit the http://Your_Ant_Media_Server_Address:5080/WebRTCAppEE/peer.html and write the stream id that you’ve used in your code(It’s stream1 in the sample code) and click the Join Button.  You will watch the IP Camera stream on your browser under 0.5 seconds latency with RTSP to WebRTC streaming option.

You can check out IP Camera Streaming Made Easy with Ant Media Server and Ultra-Low Latency Streaming Uses Cases blog posts.

I hope this brief introduction would help you in getting started with IP camera streaming using WebRTC. To access Embedded WebRTC SDK or have any questions please keep in touch.



Categories: Tutorial

Ahmet Oguz Mermerkaya

Oguz is the co-founder of Ant Media. His tech stack includes VxWorks, UML, Rhapsody in C++. Java, OSGi, Swing, JSF, Web, PHP, FFmpeg API, Native WebRTC, Java EE, Hibernate, Spring, MongoDB, MySQL, Angular, JavaScript, HTML5, Android (Native) and iOS (Native). Oguz is one of the writers of "Merhaba Android", one of the first books published in Turkey about Android app programming. His second book is about HTML5 & CSS3. He has attended several conferences and universities talking about Android, business life and technical issues. He is a member of the GDG Community and also the founder of GDG Ankara.