How to play RTSP in a browser (H.264 & H.265)
Play an IP camera or NVR stream in a web page using the open-source hevc-player demo. Its FFmpeg gateway converts RTSP to HTTP MPEG-TS, and WebAssembly decodes H.264 / H.265 video with AAC audio. You can try a stream reachable from this server, or run the same app on your camera’s network using Docker.
Play an RTSP camera stream in Chrome or Firefox
- Find the RTSP URL in your camera or NVR settings. Confirm the address and credentials using VLC on the camera’s network.
- Choose where to run the gateway. For a private IP camera, run this app locally or give your server a VPN route to the camera network.
- Paste the RTSP URL into the player above and select Play. The server remuxes the stream; your browser decodes the video.
- Select Sound to enable audio. If playback fails, check gateway connectivity, camera credentials, and FFmpeg availability.
The hosted demo cannot reach a camera at 192.168.x.x just because your browser is on the same Wi-Fi. Camera URLs and credentials are sent to the gateway. For private cameras, use your own deployment.
Add an RTSP player to React, Next.js, or a JavaScript website
Use the install and code example above to start the Node.js gateway and connect your UI. The live-player API registers fresh stream tickets when reconnecting. WASM decoder assets are bundled with the npm package. Serve the UI over HTTPS or localhost with the supplied cross-origin isolation headers.
An HTML5 video tag alone cannot open an RTSP URL. This implementation uses a canvas renderer and an HTTP MPEG-TS stream. Keep the gateway on a host that can reach your cameras; static hosting alone does not run FFmpeg.
RTSP to HLS, WebRTC, or MPEG-TS: which path does this demo use?
These are different ways to deliver camera video to a web page. HLS uses HTTP playlists and media segments. WebRTC uses a real-time connection and negotiated browser codecs. This demo sends MPEG-TS over HTTP and decodes H.264 or H.265 using WebAssembly, avoiding dependence on native HEVC decoding.
The gateway copies video rather than re-encoding it, and converts camera audio to AAC. Playback delay depends on the camera, network, buffering, and device performance. Try a lower-resolution camera substream if software decoding struggles.
Why “play RTSP in browser” needs a gateway
IP cameras and NVRs almost always expose rtsp:// for live view. That protocol is perfect for VLC and recorders, but web pages expect HTTP or WebRTC. Converting RTSP → MPEG-TS (video copy, audio to AAC) keeps latency low without re-encoding video, then the WASM player renders frames in any modern browser—including cameras that only offer H.265.
Who this RTSP web player is for
Developers & integrators
Build an IP camera web viewer or live wall with an npm package instead of a custom FFmpeg pipeline.Security & IoT teams
Preview H.264 / H.265 RTSP feeds in Chrome or Edge without installing a desktop RTSP client for every operator.HEVC troubleshooting
When “H.265 RTSP not working” in a browser path, WASM decode avoids depending on scarce native HEVC support.npm package evaluators
Try hevc-player on npm end-to-end before wiring it into React or Next.js.
RTSP browser player FAQ
- Can browsers play RTSP directly?
- No. Chrome, Firefox, Safari, and Edge cannot open an rtsp:// URL in a normal <video> tag. You need a small server-side gateway that turns RTSP into something the browser understands (HTTP MPEG-TS, HLS, or WebRTC). This demo uses the hevc-player gateway for that step.
- How do I play an RTSP stream in the browser?
- Use a gateway that can reach your camera, then paste its RTSP URL above and click Play, or install the hevc-player npm package, run npx hevc-player gateway, use startLiveStreamPlayer with createRemuxSession in its resolveUrl callback for automatic reconnection.
- Will H.265 / HEVC work in Chrome without plugins?
- The package supports this through software decoding; performance depends on your device and stream settings. hevc-player ships WASM (WebAssembly) decoders for H.265 and H.264, so you are not limited to browsers with native HEVC. Audio is normalized to AAC for playback.
- What is the difference between an RTSP player and a browser player?
- A desktop RTSP player (VLC, Onvif tools) speaks RTSP natively. A browser player needs HTTP or WebRTC. hevc-player bridges both: the gateway speaks RTSP to the camera; the page speaks MPEG-TS over HTTP to WASM.
- Why does my IP camera work on localhost but not on a hosted site?
- Private addresses like 192.168.1.x are only reachable on your LAN. The hosted gateway runs in the cloud and cannot open that RTSP path unless you VPN, tunnel, or run the gateway on a machine that shares the camera’s network.
Build your own RTSP web viewer with the open-source RTSP browser player on GitHub or install hevc-player for JavaScript and React.