frigate-nvr
Frigate NVR Skill
Complete guide for managing Frigate Network Video Recorder with AI object detection.
Quick Reference
Core Components
| Component | Purpose |
|---|---|
| Frigate Server | Main NVR processing and recording |
| Detector | AI inference (Coral TPU, OpenVINO, CPU) |
| go2rtc | RTSP/WebRTC streaming |
| MQTT | Event publishing to Home Assistant |
Configuration File Location
/config/frigate.yml # Main configuration
/media/frigate/ # Recording storage
1. Installation
Docker Compose
version: "3.9"
services:
frigate:
container_name: frigate
image: ghcr.io/blakeblackshear/frigate:stable
restart: unless-stopped
privileged: true
shm_size: "256mb"
devices:
- /dev/bus/usb:/dev/bus/usb # Coral USB
# - /dev/apex_0:/dev/apex_0 # Coral PCIe
volumes:
- /etc/localtime:/etc/localtime:ro
- ./config:/config
- ./media:/media/frigate
ports:
- "5000:5000" # Web UI
- "8554:8554" # RTSP
- "8555:8555" # WebRTC
environment:
FRIGATE_RTSP_PASSWORD: "password"
With Coral TPU
devices:
- /dev/bus/usb:/dev/bus/usb # USB Coral
# OR for PCIe Coral:
- /dev/apex_0:/dev/apex_0
2. Configuration
Basic Camera Setup
# frigate.yml
mqtt:
enabled: true
host: mqtt-broker
port: 1883
user: frigate
password: "{FRIGATE_MQTT_PASSWORD}"
detectors:
coral:
type: edgetpu
device: usb
cameras:
front_door:
ffmpeg:
inputs:
- path: rtsp://user:pass@192.168.1.100:554/stream1
roles:
- detect
- record
detect:
width: 1280
height: 720
fps: 5
objects:
track:
- person
- car
- dog
- cat
record:
enabled: true
retain:
days: 7
mode: motion
snapshots:
enabled: true
retain:
default: 14
Detection Zones
cameras:
front_door:
zones:
driveway:
coordinates: 0,500,400,500,400,0,0,0
objects:
- car
filters:
car:
min_area: 5000
porch:
coordinates: 400,500,640,500,640,0,400,0
objects:
- person
- package
Motion Masks (Ignore Areas)
cameras:
front_door:
motion:
mask:
- 0,0,200,0,200,100,0,100 # Top-left corner
Object Filters
cameras:
front_door:
objects:
track:
- person
- car
filters:
person:
min_area: 1000
max_area: 100000
min_score: 0.6
threshold: 0.7
car:
min_area: 5000
min_score: 0.5
3. Recording Configuration
Recording Modes
record:
enabled: true
retain:
days: 7 # Keep all recordings for 7 days
mode: motion # all, motion, active_objects
events:
pre_capture: 5 # Seconds before event
post_capture: 5 # Seconds after event
retain:
default: 30 # Keep events for 30 days
mode: motion
Storage Management
record:
retain:
days: 3
mode: motion
events:
retain:
default: 14
objects:
person: 30 # Keep person events longer
car: 7
4. Detector Configuration
Google Coral USB
detectors:
coral:
type: edgetpu
device: usb
Google Coral PCIe
detectors:
coral:
type: edgetpu
device: pci
Multiple Corals
detectors:
coral1:
type: edgetpu
device: usb:0
coral2:
type: edgetpu
device: usb:1
OpenVINO (Intel CPU/GPU)
detectors:
ov:
type: openvino
device: AUTO
model:
path: /openvino-model/ssdlite_mobilenet_v2.xml
CPU (Fallback)
detectors:
cpu:
type: cpu
num_threads: 4
5. go2rtc Streaming
Stream Configuration
go2rtc:
streams:
front_door:
- rtsp://user:pass@192.168.1.100:554/stream1
front_door_sub:
- rtsp://user:pass@192.168.1.100:554/stream2
cameras:
front_door:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/front_door
input_args: preset-rtsp-restream
roles:
- record
- path: rtsp://127.0.0.1:8554/front_door_sub
input_args: preset-rtsp-restream
roles:
- detect
WebRTC for Low Latency
go2rtc:
webrtc:
candidates:
- 192.168.1.50:8555 # Your Frigate IP
- stun:8555
6. Home Assistant Integration
MQTT Configuration
mqtt:
enabled: true
host: 192.168.1.10
port: 1883
topic_prefix: frigate
client_id: frigate
user: mqtt_user
password: mqtt_pass
Home Assistant Config
# configuration.yaml
mqtt:
sensor:
- name: "Frigate Front Door Person"
state_topic: "frigate/front_door/person"
camera:
- platform: mqtt
name: "Front Door"
topic: "frigate/front_door/person/snapshot"
Frigate Integration (HACS)
# Use the Frigate integration from HACS for:
# - Camera entities
# - Binary sensors for objects
# - Event notifications
# - Lovelace card
7. Notifications
MQTT Events
# Events published to:
frigate/events # All events
frigate/<camera>/person # Person count
frigate/<camera>/person/snapshot # Snapshot image
Event JSON Structure
{
"type": "new",
"before": {},
"after": {
"id": "1234567890.123456-abc123",
"camera": "front_door",
"frame_time": 1234567890.123,
"label": "person",
"score": 0.87,
"box": [100, 200, 300, 400],
"area": 20000,
"region": [0, 0, 640, 480],
"current_zones": ["driveway"],
"entered_zones": ["driveway"]
}
}
8. API Reference
REST API Endpoints
# Get config
curl http://frigate:5000/api/config
# Get camera snapshot
curl http://frigate:5000/api/front_door/latest.jpg -o snapshot.jpg
# Get events
curl "http://frigate:5000/api/events?camera=front_door&limit=10"
# Delete event
curl -X DELETE http://frigate:5000/api/events/EVENT_ID
# Restart Frigate
curl -X POST http://frigate:5000/api/restart
# Get recording summary
curl http://frigate:5000/api/front_door/recordings/summary
MQTT Commands
# Enable/disable detection
mosquitto_pub -t "frigate/front_door/detect/set" -m "ON"
mosquitto_pub -t "frigate/front_door/detect/set" -m "OFF"
# Enable/disable recording
mosquitto_pub -t "frigate/front_door/recordings/set" -m "ON"
# Enable/disable snapshots
mosquitto_pub -t "frigate/front_door/snapshots/set" -m "ON"
9. Performance Tuning
Reduce CPU Usage
cameras:
front_door:
detect:
fps: 5 # Lower FPS for detection
width: 1280 # Lower resolution
height: 720
ffmpeg:
output_args:
detect: -f rawvideo -pix_fmt yuv420p
record: preset-record-generic-audio-aac
Memory Optimization
# Docker Compose
shm_size: "256mb" # Increase if needed
# frigate.yml
cameras:
front_door:
ffmpeg:
hwaccel_args: preset-vaapi # Intel Quick Sync
# hwaccel_args: preset-nvidia # NVIDIA GPU
Hardware Acceleration
ffmpeg:
hwaccel_args: preset-vaapi # Intel
# hwaccel_args: preset-nvidia-h264 # NVIDIA
# hwaccel_args: preset-rpi-64-h264 # Raspberry Pi 4
10. Troubleshooting
Common Issues
Camera not connecting:
# Test RTSP stream
ffprobe rtsp://user:pass@192.168.1.100:554/stream1
# Check Frigate logs
docker logs frigate 2>&1 | grep "front_door"
High CPU usage:
- Lower detect FPS to 5
- Use hardware acceleration
- Add motion masks for busy areas
- Use sub-stream for detection
Coral not detected:
# Check USB devices
lsusb | grep Google
# Check Frigate logs
docker logs frigate 2>&1 | grep -i coral
No recordings:
# Check storage permissions
ls -la /media/frigate/
# Check recording config
grep -A 10 "record:" /config/frigate.yml
Debug Configuration
logger:
default: info
logs:
frigate.record: debug
frigate.event: debug
detector.coral: debug
Best Practices
- Use sub-streams for detection (lower resolution, less CPU)
- Use main stream for recording (full quality)
- Set appropriate FPS - 5 FPS is usually sufficient for detection
- Configure zones to reduce false positives
- Use motion masks for trees, roads, reflections
- Regular maintenance - prune old recordings
- Monitor storage - set appropriate retention policies
- Use Coral TPU for best detection performance
More from housegarofalo/claude-code-base
mqtt-iot
Configure MQTT brokers (Mosquitto, EMQX) for IoT messaging, device communication, and smart home integration. Manage topics, QoS levels, authentication, and bridging. Use when setting up IoT messaging, smart home communication, or device-to-cloud connectivity. (project)
22devops-engineer-agent
Infrastructure and DevOps specialist. Manages Docker, Kubernetes, CI/CD pipelines, and cloud deployments. Expert in GitHub Actions, Azure DevOps, Terraform, and container orchestration. Use for deployment automation, infrastructure setup, or CI/CD optimization.
6postgresql
Design, optimize, and manage PostgreSQL databases. Covers indexing, pgvector for AI embeddings, JSON operations, full-text search, and query optimization. Use when working with PostgreSQL, database design, or building data-intensive applications.
6home-assistant
Ultimate Home Assistant skill - complete administration, wireless protocols (Zigbee/ZHA/Z2M, Z-Wave JS, Thread, Matter), ESPHome device building, advanced troubleshooting, performance optimization, security hardening, custom integration development, and professional dashboard design. Covers configuration, REST API, automation debugging, database optimization, SSL/TLS, Jinja2 templating, and HACS custom cards. Use for any HA task.
6testing
Comprehensive testing skill covering unit, integration, and E2E testing with pytest, Jest, Cypress, and Playwright. Use for writing tests, improving coverage, debugging test failures, and setting up testing infrastructure.
5react-typescript
Build modern React applications with TypeScript. Covers React 18+ patterns, hooks, component architecture, state management (Zustand, Redux Toolkit), server components, and best practices. Use for React development, TypeScript integration, component design, and frontend architecture.
5