From c5176564b579fd903aee42da38d7d72ac6b411a3 Mon Sep 17 00:00:00 2001 From: Jozsef Gtta Date: Sat, 27 Jun 2026 13:30:25 +0000 Subject: [PATCH] rename thinkstation/ to jgpc/ - add jgpc/frigate/frigate-cctv-setup.md --- jgpc/frigate/frigate-cctv-setup.md | 161 +++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 jgpc/frigate/frigate-cctv-setup.md diff --git a/jgpc/frigate/frigate-cctv-setup.md b/jgpc/frigate/frigate-cctv-setup.md new file mode 100644 index 0000000..9006f17 --- /dev/null +++ b/jgpc/frigate/frigate-cctv-setup.md @@ -0,0 +1,161 @@ +# Frigate NVR & CCTV Setup + +**Last Updated:** May 2026 +**Host:** jgpc — `192.168.88.41` + +--- + +## Hardware + +| Component | Details | +|-----------|---------| +| Machine | Lenovo jgpc P710 | +| CPU | Intel Xeon E5-2623 v4 @ 2.60 GHz (4 cores / 8 threads, boost to 3.2 GHz) | +| RAM | 24 GB | +| GPU | NVIDIA GeForce GTX 1050 Ti (4 GB VRAM) | +| OS Disk | 234 GB SSD (`/dev/sda2`) | +| Media Storage | 14 TB HDD — mounted at `/mnt/14TB-HD/frigate/media` | + +--- + +## Frigate Docker Setup + +| Item | Value | +|------|-------| +| Image | `ghcr.io/blakeblackshear/frigate:stable-tensorrt` | +| Container name | `frigate` | +| Config path | `/srv/docker/frigate/config/` | +| Media path | `/mnt/14TB-HD/frigate/media` | +| Compose file | `jgpc/frigate/docker-compose.yml` (this repo) | +| Web UI | `http://192.168.88.41:5000` → `https://cameras.jgitta.com` | +| RTSP port | `8554` | +| WebRTC port | `8555` | + +**GPU acceleration:** Container runs with `runtime: nvidia` and `NVIDIA_VISIBLE_DEVICES=all`. The GTX 1050 Ti handles: +- LPR (licence plate recognition) via GPU +- Birdseye re-stream encoding via `h264_nvenc` +- ONNX object detection via the `onnx` detector + +**Shared memory:** `shm_size: 1024mb` — required for frame buffers across 6 cameras. + +--- + +## Object Detection + +| Item | Value | +|------|-------| +| Detector | ONNX (GPU-accelerated) | +| Model | YOLOv9-t-320 (`yolov9-t-320.onnx`) | +| Input size | 320 × 320 | +| Label map | COCO-80 | +| Model path | `/config/model_cache/onnx/yolov9-t-320.onnx` | + +--- + +## Licence Plate Recognition (LPR) + +| Item | Value | +|------|-------| +| Enabled | Yes | +| Device | GPU | +| Model size | Small | + +**Known plates:** + +| Name | Plate | +|------|-------| +| Joe | ABC1234 | +| Cynthia | ABC4567 | +| Wesley | XYZ9876 | + +--- + +## Camera Inventory + +All cameras are **Reolink** PoE units on the `192.168.88.0/24` subnet. + +| Camera | IP | Model notes | Mount location | +|--------|----|-------------|----------------| +| front_driveway | 192.168.88.105 | Dual-lens panoramic (7680×2160 = two 4K sensors stitched) | Front driveway | +| front_yard | 192.168.88.104 | 4K 811A | Front yard | +| shop | 192.168.88.103 | 4K 811A (uses HTTPS for API) | Shop / outbuilding | +| deck | 192.168.88.101 | 4K 811A | Deck | +| back_yard | 192.168.88.102 | 4K 811A | Back yard | +| front_right | 192.168.88.100 | 4512×2512 sensor (non-standard resolution) | Front right | + +--- + +## Camera Stream Settings + +All cameras confirmed via Reolink API (May 2026): + +| Camera | Main Resolution | Main Codec | Bitrate | FPS | I-frame | Sub Resolution | Sub Codec | +|--------|----------------|------------|---------|-----|---------|----------------|-----------| +| front_driveway (.105) | 7680×2160 | H.265 | 10240 Kbps | 20 | 1x | 1536×432 | H.264 | +| front_yard (.104) | 3840×2160 | H.265 | 6144 Kbps | 25 | 1x | 640×360 | H.264 | +| shop (.103) | 3840×2160 | H.265 | 6144 Kbps | 25 | 1x | 640×360 | H.264 | +| deck (.101) | 3840×2160 | H.265 | 6144 Kbps | 25 | 1x | 640×360 | H.264 | +| back_yard (.102) | 3840×2160 | H.265 | 6144 Kbps | 25 | 1x | 640×360 | H.264 | +| front_right (.100) | 4512×2512 | H.265 | 8192 Kbps | 20 | 1x | 896×512 | H.264 | + +**I-frame interval** set to 1x on all cameras so Frigate can start/end recording clips cleanly without waiting for a keyframe. + +--- + +## go2rtc Stream Architecture + +Chrome/Firefox cannot play H.265 (HEVC) via MSE (Media Source Extensions), so each camera requires two go2rtc streams: + +``` +camera_h265 → native H.265 RTSP from camera + └─ consumed by Frigate ffmpeg for RECORDING (stream copy, no re-encode) + +camera → ffmpeg:camera_h265#video=h264 (software H.265 → H.264 transcode) + └─ served to browser via MSE WebSocket for LIVE VIEW + +camera_sub → native low-res H.264 RTSP sub-stream + └─ consumed by Frigate for OBJECT DETECTION only +``` + +**Key behaviour notes:** +- go2rtc uses **lazy initialization** — transcoders only start when a browser opens the live view, and shut down ~30 seconds after the last viewer leaves. This causes a 2–3 second gray screen on first view, which is expected and unavoidable. +- The `_h265` streams are kept alive continuously by Frigate's recording ffmpeg processes, so recording starts instantly. +- The `#hardware` flag for NVENC transcoding in go2rtc causes EOF crashes with Reolink cameras and **must not be used**. Software transcoding (`libx264`) is used instead. +- Reolink cameras drop RTSP connections every 5–20 minutes (firmware behaviour). go2rtc reconnects automatically; this produces a brief gray screen, not static. + +### shop camera note +The shop camera (`192.168.88.103`) redirects HTTP → HTTPS. All API calls to shop must use `https://` with `-k` (skip cert verification). + +--- + +## Frigate Camera Detection Zones + +| Camera | Detect Resolution | Tracked Objects | Notes | +|--------|------------------|-----------------|-------| +| front_driveway | 1536×432 | person, car, dog, cat, license_plate | Has zone + LPR; alerts require `front_driveway_zone` | +| front_yard | 640×360 | person, car, dog, cat | — | +| shop | 640×360 | person, car, dog, cat | Motion mask on upper-right and mid-frame | +| deck | 640×360 | person, car, dog, cat | Two motion masks | +| back_yard | 640×360 | person, car, dog, cat | Two motion masks | +| front_right | 896×512 | person, car, dog, cat | Motion mask on upper-centre | + +--- + +## Recording & Retention + +| Type | Retention | +|------|-----------| +| Alert clips | 30 days | +| Detection clips | 30 days | +| Motion clips | 30 days | +| Continuous | Disabled | +| Snapshots | 30 days | + +--- + +## Known Issues & Quirks + +- **Reolink H.265 sub-stream firmware bug:** On some Reolink firmware versions, setting the sub-stream to H.265 produces a corrupted bitstream that go2rtc rejects with 404. Sub-streams should always remain H.264. +- **front_driveway panoramic:** The 7680×2160 resolution is two 4K sensors stitched side by side. The wide 1536×432 detect resolution in the Frigate config accounts for this. +- **front_right non-standard resolution:** Camera reports 4512×2512 rather than standard 4K. Model unknown — may be a 5MP variant or older sensor. +- **Swap pressure:** jgpc runs ~5.5 GB swap used under normal load. Monitor if adding more cameras or enabling Birdseye.