Files
homelab-configs/thinkstation/frigate/frigate-cctv-setup.md
T
jgitta 094f8b5fec Add Frigate CCTV setup doc and current config.yml
- frigate-cctv-setup.md: full hardware, camera inventory, stream
  architecture, go2rtc layout, retention settings, known quirks
- config.yml: current live Frigate config (all 6 cameras, H.265 main
  streams with H.264 transcoding for live view, ONNX/LPR on GPU)
2026-05-24 20:55:36 -05:00

162 lines
6.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Frigate NVR & CCTV Setup
**Last Updated:** May 2026
**Host:** thinkstation-p710 — `192.168.88.41`
---
## Hardware
| Component | Details |
|-----------|---------|
| Machine | Lenovo ThinkStation 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 | `thinkstation/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 23 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 520 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:** ThinkStation runs ~5.5 GB swap used under normal load. Monitor if adding more cameras or enabling Birdseye.