AUDIO
Listen to this page
Chapters
cameras — RTSP object detection
Several IP cameras connect over RTSP; a dedicated detection container watches the streams, detects objects (YOLO), stores clips/snapshots in the configured storage destinations and pushes notifications to the phone.
One plugin, one tool: cameras (manifest action enum).
Installation
The plugin itself ships with the core; the detection container is the opt-in service
server/cameras-worker/(ffmpeg/OpenCV + YOLO):docker compose --profile cameras up -d --buildThe installer offers the profile automatically when cameras is selected.
CPU by default; GPU (compose GPU reservation lines, via the GPU override file) and Google Coral USB (
/dev/bus/usbdevice block +CAMERAS_MODEL=…_edgetpu.tflitemodel) are optional. The EdgeTPU runtime is NOT preinstalled (Google removed the packages repo) — supply the libedgetpu deb yourself; see the note inserver/cameras-worker/Dockerfile.The model (
CAMERAS_MODEL, defaultyolov8n.pt) downloads at the worker's first start.
The plugin checks the worker (health in the status UI) and manages it at runtime: every config change is PUSHED to the live worker (cameras appear/disappear without restart). What it cannot do from inside its own container is the docker build itself — the status endpoint reports exactly that instruction.
Camera setup (admin page #/pui/cameras)
All credentials are entered from the admin side, never in code:
- Cameras — CRUD with name, RTSP URL
(
rtsp://user:pass@host:554/...), enabled toggle; the camera name is renamed inline: click the name, edit, ✓ saves / ✕ (or Esc) cancels. - Detection settings —
precision(minimum detection score %, default 25),detectionTime(min seconds on screen, default 0), the detection model (yolov8n.pt— fast, default;yolov8s.pt— more accurate, roughly twice the inference cost; the worker downloads the weights on first use and restarts its streams on a switch),minArea(minimum object size, % of the frame area — smaller boxes are ignored at all: falling snow, insects, a cat far away; default 0.3, 0 disables the gate) andignoreStatic(default on — an object must MOVE between two samples to trigger: at least 1 % of the frame diagonal AND 12 % of the box's own diagonal, so night-IR jitter on a big parked vehicle never passes while a walking person does; an object seen for the first time waits one sample to reveal whether it moves; a box that cannot be judged (no track id from tracker churn, or no coordinates) counts as static too — only in the tracker-less mode unjudgeable boxes stay), plus a per-cameraexcludeLabelslist (labels whose detections are discarded from storage — the stream is still watched live). - ROI — region of interest (per camera, edited on the live view): the small show/hide button on the video opens a transparent overlay with the watched-area polygon — it starts as the FULL FRAME (4 points). Gestures, no tools: drag a point to move it; double-click the area adds a point (the boundary bends there — the area behind the new point drops out of the polygon); double-click a point removes it. Below the video: ✕ resets to full frame, ✓ saves the polygon with the camera. Only detections whose box CENTER lies inside the polygon are watched at all — everything beyond the fence simply does not exist for this camera (the live view itself stays full-frame).
- Storage destinations + retention —
retentionDays(default 90) governs every destination; the worker purges daily:- Google Drive (default) — connected with the same one-button OAuth
flow as google_docs (popup consent, ONE shared redirect URI,
GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRETfrom the Env screen; see plugins/google_docs). An optional folder name / folder id pins the destination. A pasted service-account JSON is still accepted as a legacy fallback. - FTP — host/user/password/dir.
- S3 — endpoint/region/bucket/key/secret; works with AWS S3 and
S3-compatible services (MinIO, Backblaze, …). Optional key
prefix. - Local buffering (default ON,
settings.bufferLocal) — when an upload fails, the clip stays in the local media volume and a 2-minute sweep retries until the destination answers; every failure, recovery and retention-drop of a buffered file is reported to the audit log as an incident. The admin UI shows a "N files buffered" hint.
- Google Drive (default) — connected with the same one-button OAuth
flow as google_docs (popup consent, ONE shared redirect URI,
- File naming & transcode — files are named
<camera>-<date>-<firstDetection>.webm|.mp4|.webp(first = highest-score object), readable from the name alone. Events are recorded with an ffmpeg child in stream-copy mode (Matroska) — this keeps the camera's own audio track (if the stream has one) and makes the clip length exactly the wall-clock window of the visit. Before storage the recording is re-encoded: first attempt is VP9 + Opus WebM (whenever that actually comes out smaller); if re-encoding fails, the clip is saved as H.264 + AAC MP4, which every browser plays; if even that fails, the clip keeps the camera's original container as is — the recording is always saved, only the format gives way. Detection snapshots are WebP, or JPEG when that is unavailable.
Event recording model
The recording always covers the FULL visit — from the object's appearance to its disappearance — not 1-second fragments: brief occlusions or motion blur cannot chop the recording mid-visit. A too-short blip of movement is not saved. A long continuous visit never becomes one endless file: when a clip reaches the length limit (~5 minutes), an object that is STILL moving continues in a follow-up clip. Right after the stream (re)connects, detections stay quiet for a few seconds while the tracker settles — early connection noise can look like movement. The clip is recorded with the camera's own audio (when the stream has one) and starts at the detection, not before it.
Detections gallery & live view
- Gallery — clips/snapshots served through the core as authenticated proxy; date filters + pagination (6 per page); manual deletion: a checkbox in each card's top-right corner selects one or several detections, a Delete button appears next to the paginator and asks for confirmation in a modal; confirmed items delete the clip + snapshot from the worker's media volume and drop their event rows — copies already uploaded to Drive/FTP/S3 stay.
- Storage usage — the page reports the number of files, media size and disk used/free in GB (percents in brackets).
- Live view — per camera, an MJPEG stream proxied by the core
(
/cameras/:id/stream.mjpg, snapshots at…/snap.jpg).
Media storage
Media lives in the worker's media volume (in the default deployment
bind-mounted to server/data/media/); credentials/config live in the
central SQLite db (rows plugin-cameras-* via ctx.sqlStore), pushed to
the worker over the internal channel only.
Agent tool
POST /api/v1/tools/cameras (role user):
| action | params | what |
|---|---|---|
list |
— | cameras + worker health |
events |
camera?, from?, to?, page?, limit? |
recent detections, newest first; from/to as YYYY-MM-DD |
Every detection is also pushed to the home event bus
(notify: "Front door: person detected" — phone push via
hub).
Last updated: November 2026