How to Stream an RTSP Camera to Your Browser with WebRTC

By Naresh · October 13, 2026 · Tutorials

Most IP cameras and CCTV DVRs speak RTSP. Browsers don't. If you open rtsp://192.168.1.20:554/stream1 in Chrome, nothing happens. To show a live camera on a web page you need a small server in between that converts RTSP into something the browser understands.

This guide explains the options and walks through the quickest working setup.

Advertisement

Your three options

MethodLatencyGood for
HLSSeveral secondsMany viewers, simple CDN hosting
MJPEG / snapshotsLow, but heavy bandwidthQuick prototypes
WebRTCUnder a secondLive monitoring, PTZ control, doorbells

For anything "live", WebRTC is the right choice.

The quickest working setup: MediaMTX

MediaMTX is a free, single-binary media server that reads RTSP and serves WebRTC out of the box.

1. Download the release for your OS from its GitHub page and unzip it.

2. Add your camera to mediamtx.yml:

paths:
  cam1:
    source: rtsp://user:pass@192.168.1.20:554/stream1

3. Run it:

./mediamtx

4. Open http://localhost:8889/cam1 in your browser. You should see the live feed.

Embedding it in your own page

The simplest way is an iframe pointing at the MediaMTX player:

<iframe src="http://YOUR-SERVER:8889/cam1"
        width="640" height="360" allow="autoplay"></iframe>

For full control (custom UI, multiple cameras, recording), you'll talk to the server with the WHEP protocol from JavaScript.

Common problems

Want the full step-by-step build?

My ebook Camera to Browser walks through a complete RTSP-to-WebRTC setup, with working code and troubleshooting.

Get the ebook
Advertisement

Need something like this built? I take freelance projects in streaming, web apps and automation. Get in touch.

More in Tutorials