Skip to content
OAOpenAppPhysical Security as a Service
Login

go2rtc

  • Product: go2rtc
  • Purpose: provide browser-friendly live viewing (WebRTC) for RTSP sources.
  1. Run go2rtc in your environment (dev-env includes it automatically).
  2. Create an OpenApp integration with provider type go2rtc.
  3. Add one camera device per NVR channel under that integration (device metadata must include channel).
  4. Under each camera device, create one stream entity per profile (entity metadata must include profile).
  5. Open the integration view page in the dashboard to generate stream links.

When you open the integration page, OpenApp will:

  1. Build RTSP URLs for each stream entity (based on the integration config + device channel + entity profile).
  2. Register/update go2rtc streams via REST API (PUT /api/streams).
  3. Show browser-openable links per camera + stream: webrtc.html?src=<stream_name>.

OpenApp shows multiple WebRTC links per camera/channel. They all use go2rtc’s webrtc.html, but they differ in what stream is played and how compatible it is with browsers.

For each camera channel, OpenApp registers one RTSP source per configured profile.

  • Main (selector=1): /Streaming/Channels/<channel>01
  • Sub (selector=2): /Streaming/Channels/<channel>02

How to choose:

  • Pick sub for dashboards and multi-camera views (lower bitrate/CPU, faster start, less bandwidth).
  • Pick main when you need maximum detail (face/plate reading), and you can afford bandwidth.

Both variants are WebRTC, but the video codec pipeline differs.

  • RAW

    • What it solves: lowest CPU usage on the server; “what the camera outputs” (often H.265/HEVC on modern NVRs/cameras).
    • Tradeoffs:
      • Many browsers cannot decode H.265/HEVC in WebRTC, so playback may fail even though the stream exists.
      • Best when the camera is already outputting H.264 (or a browser-supported codec).
  • Browser (H.264)

    • What it solves: browser compatibility. When needed, OpenApp registers an additional stream in go2rtc that uses ffmpeg transcoding to H.264 (and optional audio to Opus).
    • Tradeoffs:
      • Higher CPU usage on the machine running go2rtc (transcoding is expensive).
      • Can slightly increase latency and reduce quality at a given bitrate.
    • How it’s enabled: OpenApp decides automatically based on the stream’s detected video_codec. You can also set video_codec in the entity metadata manually.

How to choose quickly:

  • If playback fails in Chrome/Safari/Firefox with RAW, enable Browser (H.264).
  • If you’re resource-constrained (small VM / low-power host) and your cameras can output H.264 natively, prefer RAW.
  • OpenApp will try to detect the stream codec and only add a transcoded variant when needed.

The WebRTC link includes media=... and controls which tracks go2rtc should negotiate.

  • webrtc_tracks:
    • ["video"] (default): simplest, most robust.
    • ["video","audio"]: includes audio (if available).
    • Tradeoffs: slightly more bandwidth; depends on camera/NVR audio settings; browser autoplay policies may require user interaction for audio.

Set via config.webrtc_tracks.

Section titled “Networking notes (important for “link loads but doesn’t play”)”

WebRTC media is not proxied through the HTTPS gateway. The gateway helps you download webrtc.html and establish signaling, but the actual media connection is usually direct from the browser to go2rtc.

That means:

  • Your browser must be able to reach go2rtc’s WebRTC port (default 8555 UDP/TCP) on the hostname you’re using.
  • If go2rtc runs in Docker and advertises only a private container IP (like 172.x.x.x) as an ICE candidate, browsers on the host machine won’t be able to connect.

Practical guidance:

  • Local dev-env: ensure go2rtc publishes 8555/udp + 8555/tcp and advertises a host-reachable candidate (e.g. go2rtc.openapp.local:8555).
  • Firefox note: some Firefox setups are stricter about ICE candidate hostnames under .local. If you see ICE failed in Firefox but Chrome works, advertise an explicit IPv4 candidate too (e.g. 127.0.0.1:8555 for local dev).
  • Remote deployments: you’ll typically need to open/forward 8555 and configure go2rtc webrtc.candidates appropriately (static IP, stun:<port>, or a domain), depending on your network topology.
Field Type Required Description Default Example
webrtc_tracks array optional Preferred: which WebRTC tracks to request (multi-select). Allowed values: video, audio. ["video"] ["video","audio"]
nvr_host string required NVR hostname or IP address. ya39cams.tomers.com
nvr_port number optional NVR RTSP port. 554 554
max_channels number required Required for discovery: OpenApp will scan channels 1..max_channels and create missing camera devices and stream entities. 4
channel_start number optional First channel index for discovery scan. 1 1
nvr_format string optional NVR/DVR brand preset for RTSP URL format. Options: hikvision, dahua, reolink, uniview, custom. When custom, set rtsp_url_template. hikvision dahua
rtsp_url_template string optional Custom RTSP URL template (only when nvr_format is custom). Placeholders: {nvr_host}, {nvr_port}, {channel}, {channel_02} (zero-padded, e.g. 01), {profile}, {selector}, {channel_id}, {subtype}. rtsp://{nvr_host}:{nvr_port}/Streaming/Channels/{channel_id} rtsp://{nvr_host}:{nvr_port}/cam/realmonitor?channel={channel}&subtype={subtype}
profiles object optional Map of profile name -> selector. Used to compute {channel_id} as channel*100 + selector (Hikvision-style). { "main": { "selector": 1 }, "sub": { "selector": 2 } } { "main": { "selector": 1 }, "sub": { "selector": 2 } }
nvr_username Stored securely in Secrets Manager string required NVR username (used to build RTSP URLs). admin
nvr_password Stored securely in Secrets Manager string required NVR password (used to build RTSP URLs). ••••••••
Field Type Required Description Default Example
profile string required Stream profile name. Must exist in config.profiles (e.g. main, sub). main
video_codec string optional Optional: detected/declared video codec for this stream. Used to decide whether a browser-friendly H.264 transcoded variant is needed. hevc