Menu

1 / 2

RTSP IP Cameras with Sound in a Web Browser over WebRTC (WHEP) from C#, No Media Server

DEV Community: csharp·Roman Miniailov (VisioForge)·12 days ago
#x6IEeaFM
#devtocsharp#devto#dev#ddd#camera
Long article (2572 words) — no AI summary yet.
Reading 0:00
15s threshold

A browser cannot open an rtsp:// URL. The two usual ways to put an IP camera on a web page are to transcode it to HLS — several seconds of delay, plus a decoder and an encoder per camera — or to run a separate media server next to your application.

This post takes a third route: the .NET application itself becomes a WebRTC server, the camera's H.264 goes to the browser exactly as the camera sent it, and the camera's audio goes with it as Opus.

IP camera --RTSP, H.264 + AAC--> [ RTSPRAWSourceBlock --H.264, not decoded------------------> WHEPServerSinkBlock ] --WebRTC--> browsers [ RTSPRAWSourceBlock --AAC/G.711--> DecodeBinBlock --PCM--> WHEPServerSinkBlock ] (your .NET application)

Enter fullscreen mode

Exit fullscreen mode

What that buys you:

Sub-second latency — the browser plays WebRTC, not segments.

Almost no CPU for the video, for any number of viewers — the video is never decoded or encoded. The audio is decoded once per camera and encoded to Opus for each viewer.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.