The KAGAMI mark КАГАМИ
kagami.bg/academy · lesson · machine-readable viewVERIFIED 2026-10-01 · UPDATED 2026-10-01
IDENTITY
module
KW I9 · Video stream from IP cameras: go2rtc and Frigate
series
KAGAMI Way · Track I — Infrastructure
level
Intermediate
duration
~14 min
trust_label
VERIFIED 2026-10-01 (go2rtc v1.9.14 and Frigate documentation) · UPDATED 2026-10-01 · camera-specific traps are field observations, flagged as such
language
human view: en · bulgarian edition: /academy/moduli/KW_I9_Video_Pipeline.html
previous
KW_I6_Operational_Resilience.html
next
KW_I10_Voice_AI_Stack.html · Voice AI stack
PURPOSE

Feed mixed IP cameras reliably to several consumers (an NVR, a smart-home hub, a status panel). go2rtc holds one connection to each camera and restreams it to many clients; Frigate on top records and runs object detection, optionally on a Hailo accelerator. The lesson covers camera types, the main-stream/sub-stream split, common traps and the GDPR basics for cameras.

KEY CONCEPTS
COMMANDS / PATHS
CHECKLIST
NEXT MODULE

KW_I10_Voice_AI_Stack.html · offer: Quick experiment (kagami.bg/stalbata/)

SOURCES
TAGS
go2rtcfrigatehailortspip-camerarestreamgdprvideo-surveillance
VERIFIED · 01.10.2026 UPDATED · 01.10.2026

IP camera video stream: go2rtc and Frigate

How to feed video from mixed cameras to several applications reliably. The backbone is go2rtc: it holds one connection to the camera and fans it out to many clients. On top sits Frigate for recording and object detection — optionally with a Hailo accelerator. Plus the camera types and the traps that cost days.

⏱ ~14 min Intermediate Video surveillance go2rtc · Frigate · Hailo · GDPR
go2rtc🔒 local Frigate🔒 local Hailo (optional)🔒 local Docker🔒 local

01What you will learn

🔄
UPDATED · 01.10.2026 — what changed
We checked go2rtc (v1.9.14) and the Frigate documentation; added the main/sub stream split, a warning about securing the interface, a GDPR note and a link to the Hailo lesson. We removed details of one specific installation; the per-camera traps are field observations and are marked as such.

02Before you start

03Steps

  1. The principle: never straight at the camera

    Many cameras limit the number of simultaneous RTSP connections and have touchy audio. If Home Assistant, Frigate and your panel each connect on their own, the camera chokes. So you put go2rtc between them: it opens one connection to the source and fans it out to many clients.

    flow
    Camera # one connection
      → go2rtc # restream to many clients
      → Frigate · Home Assistant · panel
    ⛔
    A direct view can bring the camera down
    In our experience a live view aimed straight at an older camera crashes it — the RTSP connection limit plus an audio codec the application can't digest. Go through go2rtc, and #media=video strips the audio from the stream.
  2. Main stream and sub stream

    Most cameras offer two streams: a main one (high resolution) and a sub one (low). On Dahua-style cameras the path is the same and only subtype changes: 0 is the main stream, 1 the sub stream. The rule in Frigate: detection runs on the sub stream, recording on the main stream. That way the accelerator isn't drowned in high resolution, and the recording keeps its quality.

    yaml · go2rtc
    # values in <…> are placeholders; real credentials live in a secret store
    streams:
      hall_main: rtsp://<user>:<pass>@<camera-host>:554/cam/realmonitor?channel=1&subtype=0#media=video
      hall_sub:  rtsp://<user>:<pass>@<camera-host>:554/cam/realmonitor?channel=1&subtype=1#media=video
    yaml · Frigate reads from the restream
    cameras:
      hall:
        ffmpeg:
          inputs:
            - path: rtsp://127.0.0.1:8554/hall_sub
              input_args: preset-rtsp-restream
              roles: [detect]
            - path: rtsp://127.0.0.1:8554/hall_main
              input_args: preset-rtsp-restream
              roles: [record]
        detect:
          fps: 5   # the value the documentation recommends

    Two things to remember. #media=video tells go2rtc to ignore the audio, and #backchannel=0 stops it opening a two-way-audio channel that can block the camera. Need sound? Drop the first and add an audio codec your application accepts.

  3. go2rtc and Frigate: two different go2rtc

    Frigate ships its own embedded go2rtc. If you also run a standalone go2rtc on the same machine, you have two separate instances. By default go2rtc listens on 1984 (API and web UI), 8554 (RTSP) and 8555 (WebRTC) — two instances can't share the same ports, so change them on one. The version at the time of writing is v1.9.14 (19 Jan 2026), which the Frigate documentation also links to.

    ⚠️
    Don't publish the go2rtc interface
    Access to the go2rtc API is access to your server: the exec and echo sources can run commands. In Frigate they are off by default; they are turned on only with an environment variable, and only if you trust the whole config. Keep the interface on the internal network, or behind a reverse proxy with login.
    ⚠️
    Snapshots through frame.jpeg
    The go2rtc documentation describes width/w and height/h parameters for the snapshot. On our setup ?w= did not change the size ⚠️ — we haven't compared across versions. If it has no effect for you, scale in the application that fetches the snapshot.
  4. Camera types — each with its own trap

    The traps here are field observations, not guarantees for every model. Check against your own camera.

    CameraStreamSpecifics and trap
    Professional IP camera (e.g. the Dahua family)H.264, two streamsThe most predictable with go2rtc — its authors call it a reference implementation of the protocol. Give it a fixed address (DHCP reservation), or the paths in go2rtc break. The clock drifts — turn on NTP sync. For the camera's HTTP API, curl --anyauth picks the login method itself.
    USB webcamraw or MJPEGOur model offered only raw and MJPEG video (see what yours offers with v4l2-ctl --list-formats-ext) ⚠️ — then it needs transcoding to H.264 with ffmpeg. The device is opened by one process, so one ffmpeg holds it and everything else reads from go2rtc.
    Cheap camera with a sleep modeH.264It sleeps without motion → a periodic end of stream (EOF) is normal, don't chase it as an error.
    ESP32-CAM-type boardMJPEGA bad picture and reboots usually mean weak power. Give it a stable 5 V with enough current and a short cable.
    ✅
    Transcoding is a last resort
    go2rtc recommends ffmpeg for transcoding only when needed. If the camera already gives H.264, transcode nothing — that keeps the processor free.
  5. Detection: with or without an accelerator

    Frigate can detect people and cars on the processor too, but its documentation does not recommend that for real use: an accelerator or OpenVINO in CPU mode is better. With a Hailo, the detector type is hailo8l; while you set it up, use the Hailo and Frigate 0.18 lesson — the retention keys are there too. In short: the host driver must be the one Frigate requires, not the one built into the kernel; a mismatch blocks the detector.

    ℹ️
    Why two streams here as well
    The detector looks at a low-resolution picture at few frames per second — that is enough for it. The main stream goes only to recording. This way one camera barely loads the accelerator.
  6. The camera watches people: GDPR

    Recording people is personal-data processing. The European Data Protection Board (EDPB) Guidelines 3/2019 say, in short: the household exemption is narrow; write down the purpose; put up a sign as the first layer of information; keep recordings short (usually a few days; beyond 72 hours needs a stronger justification); don't record sound unless you need it; face recognition is biometric processing under Art. 9; large-scale systematic monitoring of a publicly accessible area needs a data protection impact assessment (Art. 35(3)(c)).

    ⚠️
    This is not legal advice
    For your own case, ask a lawyer or your data protection authority. Details and the retention configuration in Frigate 0.18 are in the Hailo and Frigate lesson.

04Check

1. Why don't we point every application straight at the camera?

2. Why might a USB webcam need transcoding and a single process holding the device?

3. Which stream do we use for what in Frigate?

4. A camera that sleeps without motion gives a periodic end of stream (EOF). What does it mean?

05What's next

06Sources

  1. go2rtc — README — ports, supported sources, security.
  2. go2rtc — RTSP module — the address format for Dahua, #media=video, #backchannel=0.
  3. go2rtc — releases — v1.9.14 is the latest as of 01.10.2026.
  4. Frigate — Restream — one stream from the camera, main and sub stream, limits on exec.
  5. Frigate — object detectors — CPU not recommended; Hailo.
  6. EDPB — Guidelines 3/2019 — processing of personal data through video devices.
  7. KAGAMI Academy — Hailo-8 and Frigate — accelerator setup and retention.
  8. KAGAMI's own field observations with different cameras (the traps in step 4).