Live Streaming · November 26, 2026 · Maryna Poplavska

SRT to WebRTC and RTSP to WebRTC: How to Ingest IP Camera, Drone and Broadcast Feeds

SRT to WebRTC and RTSP to WebRTC: How to Ingest IP Camera, Drone and Broadcast Feeds

By Maryna Poplavska, Lead Project Manager · Last updated 19 November 2026

To get an SRT or RTSP feed into WebRTC, you put a gateway between the source and the viewer: a media server, a library or your own pipeline that terminates the source protocol and republishes the same encoded video and audio over WebRTC. Whether an SRT to WebRTC or RTSP to WebRTC path works without re-encoding depends on the codecs, not the protocol. RTSP sets up and controls a stream whose media travels as RTP; SRT carries a stream over UDP. Neither decides what the browser can decode. The WebRTC side does.

For a product that shows live camera feeds, the costly failures are quiet: video with no sound, a picture that freezes, a player that never comes back after the camera restarts. Nothing in the player says why. All three showed up in our lab.

For what each protocol does in a live pipeline, see our map of WebRTC, HLS, SRT and RTMP. To check the specifications, we pushed synthetic ffmpeg test streams through a MediaMTX gateway into a WebRTC player in our lab: one machine, loopback, no real cameras (Chrome 157 headless, macOS on Apple silicon, MediaMTX v1.21.3, 12 Nov 2026). Our SRT leg was one MediaMTX instance pulling from another, not a real SRT encoder. We recorded behaviours, not benchmarks.

Key takeaways

  • A gateway converts the transport, not the codec. Pass-through works only when the source codecs are ones the WebRTC side can carry to your viewers.
  • Video: WebRTC browsers must implement VP8 and H.264 Constrained Baseline (RFC 7742). In our lab, MediaMTX accepted H.264 with B-frames on ingest, then closed the viewer’s session when a player attached; High profile without B-frames played.
  • Audio: Opus and G.711 are required (RFC 7874); AAC is not. In our lab, G.711 and Opus passed through; MediaMTX skipped AAC, so video played with no audio packets and only a log warning.
  • Start-up and recovery are yours to design. A new viewer waits for the next keyframe, and when the source dropped, MediaMTX closed the viewer’s session at once and did not carry it over when it re-pulled the source itself.

Decide these first.

  1. Do you control the device settings? If yes, most fixes below (profile, B-frames, audio codec, keyframe interval) are settings. If the devices are your customers’, the same fixes become transcoding at the gateway.
  2. What start-up time and recovery do you promise viewers? The keyframe interval sets the first; the player’s reconnect logic sets the second.

What does it mean to bring an SRT or RTSP feed into WebRTC?

It means running a gateway that speaks the source protocol on one side and WebRTC on the other. On the source side, the gateway pulls a camera’s RTSP URL, or receives or pulls an SRT stream. On the viewer side, it sets up a WebRTC session with each player (ICE for connectivity, DTLS-SRTP for encryption) and sends the media as RTP. If the codecs fit, the encoded frames pass through. If they don’t, something re-encodes.

A gateway terminates an RTSP or SRT source and republishes it as WebRTC, transcoding only when codecs do not match.

You don’t need WHIP for this: the gateway ingests RTSP and SRT directly, and WHIP and WHEP (our explainer) only set up WebRTC sessions.

Which source are you ingesting, and what does it actually carry?

Whatever the protocol, each source carries four values that, in our view, decide more of the build than the protocol does. Read them off the camera or encoder profile and confirm them in the stream with ffprobe:

  • Video codec and profile: H.264 Constrained Baseline, Main or High; H.265; or something else.
  • B-frames: on or off.
  • Audio codec: AAC, G.711, Opus or none.
  • Keyframe interval: how often the source sends a full frame a new viewer can start from.

This guide covers IP cameras over RTSP and SRT from broadcast or field encoders. RTMP from drones and older encoders is a different path. For RTMP, our 2022 example shows an RTMP drone feed converted to WebRTC through a Janus-based converter. In our view, drones that send RTSP or SRT follow the same codec rules; we have no published RTSP or SRT drone ingest work. Camera discovery (ONVIF) is outside this piece.

Do you have to transcode?

You have to transcode when a source codec is outside what the WebRTC side can carry to your viewers. For video, RFC 7742 says: “WebRTC Browsers MUST implement the VP8 video codec as described in [RFC6386] and H.264 Constrained Baseline as described in [H264].” For audio, RFC 7874 says “WebRTC endpoints are REQUIRED to implement the following audio codecs:” Opus and “PCMA and PCMU (as specified in ITU-T Recommendation G.711 [G.711])”. These rules bind browsers and WebRTC endpoints, not cameras. A camera sends whatever its firmware supports, and the mismatch lands on your gateway.

Which video and audio codecs WebRTC requires, and where an SRT or RTSP source needs transcoding.
  • H.264 Constrained Baseline, G.711 and Opus pass through. In our lab all three played through MediaMTX over RTSP (our G.711 source was 8 kHz narrowband audio), and Constrained Baseline with Opus also played over the SRT pull.
  • H.264 with B-frames needs a different encoder setting or a re-encode. B-frames are not part of the Constrained Baseline profile that RFC 7742 requires, and in our lab MediaMTX closed the viewer’s session when a player attached to a B-frame source. High profile without B-frames passed through; RFC 7742 doesn’t require it, so test your viewers’ browsers.
  • H.265 depends on the viewer’s device. The IETF’s HEVC profile for WebRTC, draft-ietf-avtcore-hevc-webrtc-10, says “Support for the H.265 video codec is OPTIONAL for WebRTC browsers and non-browsers.” MediaMTX’s browser-compatibility notes say “Chrome supports publishing and reading H265 tracks only on Windows and only when a capable GPU is present”, yet headless Chrome 157 on macOS played it in our lab (finding 3 below), so test on your viewers’ devices or transcode to H.264.
  • AAC needs an audio transcode. MediaMTX accepts AAC over SRT, but its WebRTC read list is “Opus, G722, G711 (PCMA, PCMU)”, and in our lab it skipped the AAC track instead of converting it.

Who transcodes, and where, in our view. If you control the device, fix the encoder profile (no B-frames; Opus or G.711 audio) and nothing needs transcoding. If you don’t, an audio-only transcode to Opus at the gateway is the cheap fix when the video already passes. A video re-encode is the expensive one: CPU or GPU time per source stream, and added delay. Run it once per source, before fan-out, not once per viewer.

Which gateway should you use: MediaMTX, Janus, GStreamer or your own pipeline?

In our view four questions decide it: how many sources and viewers you have, whether camera feeds must join a live conference or only reach a viewer, where the gateway runs (next to the cameras or in the cloud), and what your team can operate. We ran only MediaMTX; the notes on Janus and GStreamer come from their documentation and, for Janus, our own project.

  • MediaMTX is one server that ingests SRT, RTSP, RTMP, WebRTC and more and serves WHEP. Its README says “Streams are automatically converted from a protocol to another”, but only inside its codec lists: in our lab it forwarded H.264, H.265, Opus and G.711 and skipped AAC. In our view it suits camera feeds going to viewers with little custom media logic; we did not test how it scales.
  • The Janus streaming plugin takes camera feeds through its rtsp stream type, which the Janus documentation says is “only available if libcurl support was compiled”. We used Janus to put camera feeds into live conference sessions. The plugin page doesn’t describe transcoding, so plan that step yourself.
  • GStreamer puts decode, encode and WebRTC in one pipeline through webrtcbin; in our view, budget for building signalling around it.

If none fits as-is, the bridge becomes a custom WebRTC development job: a gateway plus your own transcoding, monitoring and player logic.

Which ingest path fits which source?

Pass-through is expected when video is H.264 Constrained Baseline and audio is Opus or G.711, the codecs WebRTC requires; anything else needs a test, an encoder change or a transcode. Lab results in the table are MediaMTX only; we did not run Janus or GStreamer.

Source Gateway options Transcode? First thing to check
IP camera, RTSP, H.264 Constrained Baseline + G.711 or Opus MediaMTX; Janus streaming (rtsp type); GStreamer None: both passed through MediaMTX in our lab Camera profile and B-frame setting
IP camera, RTSP, H.264 High without B-frames + Opus Same None in our lab; test your viewers’ browsers The profile in the stream (ffprobe), not the WebRTC session’s profile-level-id
IP camera, RTSP, H.264 without B-frames + AAC Same Audio only, to Opus (MediaMTX skipped AAC in our lab) Gateway log for skipped tracks; audio packets in player stats
Camera or encoder, H.264 with B-frames Any; the session close we saw is MediaMTX’s own check, and others may differ Change the encoder profile or re-encode video Gateway log (MediaMTX: session closed when a player attached)
IP camera, RTSP, H.265 MediaMTX forwarded it in our lab; Janus and GStreamer not tested To H.264, or limit viewers to tested HEVC-capable devices Viewers’ browsers and OS
SRT encoder, H.264 + AAC MediaMTX (SRT listener or pull; we ran the pull); GStreamer (not tested; you build the ingest) Audio to Opus; Constrained Baseline video passes As the AAC row; in our lab, tracks read over SRT (gateway to gateway) followed the same rules
Your own edge device (GStreamer to WebRTC) No separate gateway (webrtcbin) Encode to a WebRTC codec at the source Signalling and NAT traversal, which you build

What drives the effort, in our view. More camera or encoder models mean more profiles to check. Devices you don’t control mean transcoding instead of settings.

If you are scoping this for a product, our live streaming team builds ingest and transcoding pipelines for interactive and broadcast streaming.

What breaks when you bridge RTSP or SRT into WebRTC?

We tested five behaviours on purpose, all with MediaMTX v1.21.3 as the gateway, and four looked like a stream that half works: video with no sound, a frozen frame, a late start, a player that never came back. Setup: ffmpeg sources published over RTSP to MediaMTX, a second MediaMTX instance pulling them from the first over SRT or RTSP (the way a gateway pulls from a camera), and a minimal WHEP player in headless Chrome. These are MediaMTX behaviours; Janus or GStreamer may fail differently.

Lab failures: AAC and B-frames at the gateway, keyframe waits and reconnects at the player in RTSP and SRT ingest.
  1. AAC audio disappears without an error in the player. With every H.264 + AAC source we ran, over RTSP and the SRT pull, the browser got video and an audio track that never carried a packet. The only signal was a MediaMTX warning, “skipping track 2 (MPEG-4 Audio)”. Use Opus or G.711 at the encoder or transcode audio at the gateway, and alert on that log line or on zero audio packets in the player’s stats.
  2. H.264 with B-frames ends the session. A High-profile source with B-frames was accepted on ingest and reported online. When a player attached, MediaMTX closed the session; the player had decoded two frames and then froze: “WebRTC doesn’t support H264 streams with B-frames”. The same profile without B-frames played, so in our lab the B-frames, not the profile, triggered the close. The negotiation gave no warning: both High-profile sources reported profile-level-id=42e01f (Constrained Baseline) in the session. The WebRTC session’s SDP doesn’t tell you what the camera sends; check the stream with ffprobe.
  3. H.265 played in our setup, which proves little. Headless Chrome 157 on macOS decoded H.265 (no B-frames) over RTSP and the SRT pull. We did not capture the decoder, or test other browsers, operating systems or H.265 with B-frames.
  4. A new viewer waits for the next keyframe. With a source set to a long keyframe interval, the first picture appeared only when the next keyframe arrived, so by the same mechanism a viewer can wait up to one full interval. In our view, set camera keyframe intervals to match the start-up time your product promises.
  5. Reconnecting is the player’s job. We killed and restarted the ffmpeg source twice, once with the viewer on the gateway the source publishes to, once with the viewer on a second instance that pulls RTSP from the first. Our stand-in for a camera was that first MediaMTX instance, not a real camera. In both, the viewer’s WebRTC session was closed (“terminated”) rather than paused, and our bare WHEP player stayed disconnected. The pulling instance (over SRT in the first test, RTSP in the second) logged an EOF and came back on its own after a short retry, but the closed session did not come back with it. Build reconnect into the player (a new WHEP request, a new session) and test it by stopping the source, not only the viewer’s network.

What we did not test: a real SRT encoder (caller or listener modes, the SRT latency setting), other gateways (Janus, GStreamer), browsers other than Chrome 157 headless (no Safari, Firefox or Edge), real IP cameras or hardware encoders, ONVIF, WHIP publishing, packet loss, TURN or NAT traversal, CPU load and latency. Everything ran on one machine over loopback.

How do you measure end-to-end latency for an ingest path?

Measure glass to glass on the real network, in our view most simply with a timestamp overlay: burn a clock into the source and capture the player beside the same clock. SRT’s latency setting is in our protocol map; whether sub-second pays off, in when WebRTC is mandatory and when it’s overkill.

What have we built that this rests on?

  • RTSP to WebRTC for a US government agency. As part of a government video-conferencing product, we built “the RTSP-to-WebRTC bridge using Janus — converting live IP camera streams into WebRTC-compatible feeds embeddable directly into active conference sessions” (case study). The case study records that bridging them “required dedicated engineering in the Janus RTSP plugin, transcoding pipeline, and stream health monitoring.”
  • A different shape: WebRTC at the edge. For a drone-video client we built a GStreamer capture pipeline on Raspberry Pi that serves WebRTC and HLS from one encoder. The case study describes no RTSP, RTMP or SRT ingest, so it backs only the table’s edge-device row.
  • Where the proof stops: we have no published client project with SRT ingest, WHIP or MediaMTX, and no published RTSP or SRT drone ingest work. Those parts rest on the cited sources and our lab, which is a test bench, not delivery experience.

How do you test an ingest path before committing?

  1. Inventory every source model from the stream itself (ffprobe), not the WebRTC session’s SDP: codec, profile, B-frames, audio codec, keyframe interval.
  2. Push one source of each kind through the gateway untranscoded, and read the gateway log for skipped tracks or closed sessions.
  3. Check the player’s WebRTC stats, not just the picture: packets received on every track, frames decoded.
  4. Add transcoding only for what failed: audio first if the video already passes.
  5. Test the browsers and devices your viewers actually use.
  6. Run a failure drill: restart a pushed source and a pulled one, cut the uplink, restart the gateway, and watch whether players recover.
  7. Measure glass-to-glass latency with a stated method on the real network.

Our lab covered steps 2, 3 and part of 6 (source restarts only).

FAQ

Do I need to transcode an RTSP camera stream for WebRTC?

Not if the camera sends H.264 without B-frames and Opus or G.711 audio. RFC 7874 requires WebRTC endpoints to implement Opus and G.711, and in our lab G.711 (PCMU) and Opus passed through MediaMTX without re-encoding. AAC needs an audio transcode; B-frames, an encoder change or a re-encode.

Does WebRTC support H.265?

Optionally: the IETF’s HEVC-in-WebRTC draft makes it optional, and Chrome ties support to the platform. Test on your viewers’ devices or transcode to H.264.

Why does my RTSP camera play in VLC but not in the browser?

In our view, check the codecs first. VLC isn’t bound by WebRTC’s codec requirements, so a stream with B-frames, H.265 or AAC can play there and fail in the browser. Then read the gateway log: in our lab, MediaMTX’s log was the only place that named the cause of the AAC and B-frame failures.

Bringing cameras, drones or broadcast encoders into a WebRTC product? Book a free 30-minute call with a Trembit engineer. Bring your source list (camera or encoder models, codecs, protocols) and where viewers watch, and we’ll pressure-test the ingest path with you: what passes through, what needs transcoding, what to test first. Already have a path that half works? Bring the gateway log. No deck, no pitch.

Maryna Poplavska
Written by Maryna Poplavska Project Manager & Business Analyst

Related Articles

Ready to start?

Let Us Work Together

Tell us about your project and we'll get back within 24 hours.

Get in Touch