Callaba

RTSP to WebRTC: Gateway, Codecs & Browser Checks | Callaba

Aug 08, 2026

RTSP-to-WebRTC is a gateway workflow, not a URL substitution. The gateway acts as an RTSP client toward a camera or media server, receives the associated RTP media, and creates a separately negotiated WebRTC session for the browser. Codec, audio, timing, security and connection state must be validated on both sides.

The gateway terminates two different session models

RTSP camera to WebRTC browser gateway An RTSP camera provides control and RTP media to a gateway. The gateway authenticates, receives and optionally decodes and encodes media, then uses signaling, ICE and protected WebRTC media to reach a browser. Evidence is collected at each boundary. RTSP SOURCEDESCRIBE · SETUPRTP tracks MEDIA GATEWAYINGEST + DEPAYLOADauth · transport · timestampsMEDIA DECISIONpass · decode · encode WEBRTC EDGEsignaling · ICEDTLS-SRTP · RTCP BROWSERnegotiated codecdecoded frame PROVE UPSTREAM, GATEWAY, ICE, RTP AND FIRST FRAME SEPARATELY
An RTSP PLAY response and a connected WebRTC peer are intermediate states. The acceptance test ends with advancing, decoded media and stable statistics in the target browser.

Callaba can display RTSP in browser Multiview, but that is not a general WebRTC output

Callaba Multiview can accept an RTSP URL and show it on a controlled browser monitoring surface. Callaba also has browser-room and WebRTC media workflows. Those facts do not establish a public, general-purpose RTSP-to-WebRTC gateway for arbitrary applications.

Required outcomeWhat Callaba can doWhere that capability ends
Operator watches an RTSP sourceAdd the verified source to a private or public Multiview boardA browser monitor does not expose a generic WebRTC API or peer endpoint
Process or record the sourceUse supported Restream or Recording workflows where appropriateA media handoff does not prove RTSP-to-WebRTC conversion
Embed WebRTC in another applicationNo direct RTSP-to-WebRTC gateway contract is currently documentedSpecify signaling, session authorization, codec policy and scale separately

A dedicated RTSP-to-WebRTC output would need a session API, per-track codec decisions, TURN policy, a browser test page and correlated RTSP/WebRTC statistics. For now, use Multiview for operator monitoring and a separate gateway when an application needs reusable WebRTC delivery.

RTSP controls the source session; RTP normally carries its media

Probe the source's actual RTSP version. Many cameras implement RTSP 1.0, while RTSP 2.0 is a later protocol that is not backwards-compatible with 1.0 beyond version negotiation. Both control a media presentation, commonly with RTP and RTCP carrying media and reports, but their detailed session and transport requirements must not be mixed.

Validate the observed version, credentials, resource URL and session state. Record whether media uses negotiated UDP ports or RTP/RTCP interleaved with RTSP over TCP under that version and implementation. Then observe first RTP packet, sequence continuity, timestamps and track activity. A successful control response with no media points to a different boundary than an authentication rejection.

WebRTC adds signaling, ICE and protected real-time transport

The W3C WebRTC Recommendation defines browser APIs such as RTCPeerConnection, while the IETF WebRTC transport specification covers the real-time transport environment. An application still needs signaling to exchange descriptions and candidates.

Record ICE gathering, selected candidate pair, connection state, round-trip time, loss, jitter and received frames. Test direct and TURN-relayed cases from representative networks. “Connected” without inbound bytes or decoded frames is not a usable camera view.

Codec compatibility decides whether media can pass through

Inspect the exact RTSP video and audio payloads, including codec profile and parameters. RFC 7742 requires WebRTC endpoints to implement VP8 and H.264 Constrained Baseline, with H.264 packetization mode 1 support and negotiated profile-level-id. RFC 7874 defines Opus, PCMA and PCMU as the baseline WebRTC audio codecs. Actual use still depends on the offer, answer and endpoint implementation.

Choose separately for every track. Compatible encoded video may still need RTSP depayloading and WebRTC RTP repacketization without decoding pixels. A codec, profile, parameter or audio mismatch can require decode and encode. Transcoding adds compute, delay and a new failure boundary; repacketization adds protocol work but is not transcoding. Do not call the whole stream “passthrough” because one codec name appears on both sides.

Work one camera example from SDP to browser counters

Assume the RTSP DESCRIBE response identifies H.264 video and AAC audio. First parse the H.264 profile-level-id, packetization parameters and in-band parameter-set behaviour; compare them with the browser's WebRTC SDP. If the H.264 profile and parameters are accepted, the gateway may depayload and repacketize video into the negotiated WebRTC RTP form. If not, select a supported H.264 or VP8 transcode.

AAC is not one of RFC 7874's required WebRTC audio codecs, so the gateway cannot assume it will negotiate. It may transcode AAC to Opus, omit audio under an explicit policy, or use another mutually offered codec. Verification then follows the decision: RTSP packets arrive, the video repacketizer or encoder emits frames, the audio encoder emits Opus when selected, offer and answer agree on payload formats, and browser inbound and decoded-frame counters advance.

Timing and keyframes shape startup and recovery

A newly joined browser needs decodable media. Long keyframe intervals can delay the first picture or recovery after loss. The gateway may request or wait for an upstream keyframe, but camera behaviour varies. Measure time from session request to first decoded frame and observe what happens after a brief source interruption.

Preserve monotonic timestamps across the gateway and define how discontinuities are handled after an RTSP reconnect. Do not hide a frozen last frame behind a healthy WebRTC connection state; alert on frame advancement and media age.

Authorization exists on both sides of the gateway

Protect camera credentials and keep the source network private. Store secrets outside browser-visible URLs and redact them from logs. Record the security properties the actual RTSP 1.0 or 2.0 source and selected media transport provide; do not infer protected RTP from a protected control connection. On the viewer side, authorize the WebRTC session, constrain its lifetime and prevent one token from enumerating unrelated cameras.

TURN credentials, signaling endpoints and session identifiers also need rotation and rate limits. Decide how many peers may watch one source and whether the gateway shares an upstream RTSP session or opens one per viewer; that choice affects camera limits and isolation.

Capacity depends on camera sessions, transcoding and peer fan-out

Count upstream sessions, received bitrate, depayload and jitter buffers, decoder and encoder work, WebRTC peers, TURN relay traffic and per-peer state. A camera may limit concurrent RTSP clients, so a shared gateway ingest can be safer than allowing each viewer to open one.

Load-test the real codec and resolution. Add peers gradually, split direct and relayed connections, and record CPU, memory, outbound bitrate, encoder queue and first-frame time. Leave capacity for reconnect waves when a camera or gateway restarts.

Example: the WebRTC peer connects, but the browser stays black

Signaling completes and ICE reports connected, yet no picture appears. Competing hypotheses are an idle RTSP media path, an unsupported source profile, a gateway packetization fault or browser autoplay policy. The first comparison joins RTSP RTP packet growth, gateway decoded or forwarded frames, selected ICE pair bytes, WebRTC inbound RTP and browser decoded-frame counters. RTP reaches the gateway, but its decode step rejects the camera's active profile and no outbound frames are produced. The root cause is the codec boundary. Change the camera profile or enable a supported transcode, then verify advancing outbound frames, browser decode and first visible picture.

Validate the gateway from camera to target browser

  1. Probe the source. Save RTSP methods, selected transport, tracks, codec parameters, timestamps and keyframe cadence.
  2. Choose per-track handling. Document pass-through, repacketization, transcode or omission and the reason.
  3. Test WebRTC negotiation. Capture offer, answer, codec result, ICE candidates and selected path without exposing credentials.
  4. Prove media. Observe upstream packets, gateway frames, outbound RTP, browser received bytes and decoded frames.
  5. Exercise networks. Test direct and TURN-relayed viewers, packet loss, camera restart and gateway restart.
  6. Check policy and scale. Deny an unauthorized viewer, expire a session and add peers up to the planned limit.

RTSP-to-WebRTC FAQ

Can a browser open an RTSP URL directly?

A normal web application does not use RTSP as its native media API. A gateway or another browser-facing delivery path is usually required.

Can H.264 always pass from RTSP into WebRTC unchanged?

No. Profile, level, packetization, parameters and browser negotiation must match. Audio and timing may require separate handling.

Why can ICE connect while video remains black?

ICE proves a network path, not upstream media, gateway processing or browser decoding. Inspect counters at every boundary.

Does Callaba expose a general RTSP-to-WebRTC gateway?

That public contract is not currently documented. Callaba Multiview can display RTSP for browser monitoring, which is a narrower workflow.

Verify the RTSP source contract Open the browser monitoring guide Design the WebRTC server boundary