Try it free

← BlogGuides9 min read

IP camera streaming server: how to stream RTSP cameras to a website

Almost every IP camera gives you an rtsp:// address, and no web browser will open it. An IP camera streaming media server is the piece that sits between the two: it pulls the camera on your network and serves it in formats a web page can play.

Why browsers cannot play your camera

RTSP was designed in the late 1990s for controlling media players on a network. Browser makers never adopted it, and plug-ins that once played it are long gone. Browsers play video in exactly three ways today: files and HLS through the <video> element (with Media Source Extensions), and live WebRTC. So the camera's stream must be repackaged into one of those.

The pipeline

From IP camera to web page On the local network, the streaming server discovers cameras with ONVIF and pulls their RTSP streams. A firewall separates the local network from the internet; only the server is reachable from outside. The server delivers WebRTC to browsers for sub-second viewing and HLS for every device, and can also restream to YouTube. YOUR LOCAL NETWORK Gate camera PTZ camera Lobby camera Streaming server pull · repackage record · restream RTSP firewall Browser · WebRTC under 1 s Any device · HLS plays everywhere YouTube · restream public audiences
The cameras never face the internet. The server pulls them inside your network and is the only thing viewers reach.
  1. Discover. With ONVIF, the server finds cameras on the network (WS-Discovery) and asks each one for its stream address, so you do not have to know every vendor's RTSP URL pattern. Pan-tilt-zoom control comes through the same standard.
  2. Pull. The server opens RTSP to the camera, usually with RTP over TCP for reliability, and reconnects by itself when the camera reboots or the network drops.
  3. Repackage. The camera's H.264 video is put into WebRTC packets and HLS segments as is. Only audio typically needs converting, since WebRTC wants Opus and cameras send G.711 or AAC.
  4. Deliver. Embed the server's player on your page, or give out a watch link, with control over who may watch.

Codecs: what plays where

Camera codecs and what browsers can play without conversion H.264 video plays in every major browser over both WebRTC and HLS, so no conversion is needed. H.265 (HEVC) support varies by browser and device, so it often needs converting to H.264. MJPEG is inefficient and best converted. Audio: G.711 and AAC usually need converting to Opus for WebRTC; AAC plays as is in HLS. CAMERA SENDS WebRTC HLS H.264 video H.265 / HEVC video MJPEG video G.711 / AAC audio plays as is plays as is depends on browser depends on device convert convert convert to Opus AAC as is
Tip: set cameras to H.264 in their own settings. It removes nearly all conversion, and with it most of the server's processor load.

Security: never port-forward a camera

Opening a camera's RTSP or web port to the internet is how cameras end up on public search engines for exposed devices. Their firmware is rarely updated and default passwords are common. With a streaming server in between:

How many cameras can one server handle?

When video is only repackaged, the limit is mostly network, not processor: a 1080p camera at 4 Mbps costs 4 Mbps in and 4 Mbps per viewer out. Converting (H.265 to H.264, or extra qualities) is what costs processor. The arithmetic is in how to size a streaming server.

In creekX: choose Find cameras, pick yours, type its password, and it is live, with automatic reconnect, pan-tilt-zoom buttons, recording, watch links and embeds. A camera without ONVIF works from its RTSP address. See IP cameras and the camera guide.

Frequently asked questions

Can a web browser play an RTSP stream directly?

No. No current browser supports RTSP. The stream has to be converted by a server into a format browsers play, such as WebRTC or HLS.

What is the best way to stream an IP camera to a website?

Use a streaming server that pulls the camera over RTSP on the local network and serves WebRTC for low delay with HLS as a fallback, then embed its player on the page. Do not expose the camera itself to the internet.

Do I need to re-encode IP camera video?

Usually not for WebRTC or HLS if the camera sends H.264. H.265 cameras may need converting for browsers that cannot decode it, and audio in G.711 or AAC may need converting to Opus for WebRTC.

What is ONVIF?

An industry standard that lets software discover IP cameras on a network and ask them for their stream addresses and settings, so you do not have to look up each vendor’s RTSP URL format.