Self-Hosting Frigate NVR: Smart AI Camera Surveillance for Your HomeLab

HomeLab tutorial - IT technology blog
HomeLab tutorial - IT technology blog

Ditch the False Alarms: Smarter Home Surveillance

If you have ever owned a consumer-grade security camera, you know the drill: your phone buzzes at 3 AM because a moth flew too close to the lens. Legacy motion detection is notoriously dumb. It can’t tell the difference between a burglar and a wet leaf blowing across your porch. After clearing 200 daily “ghost” alerts from my own phone, I realized my HomeLab needed a more intelligent way to handle video.

Frigate NVR flips the script by running local AI object detection that actually understands what it sees. Instead of pinging you every time the wind blows, it identifies a “person” on the porch or a “dog” in the garden. Because it runs entirely on your own hardware, your private video feeds never touch a third-party cloud.

NVR Comparison: Finding the Right Path

Most home security setups fall into one of three categories. Choosing the right one determines whether your system is a helpful tool or a constant annoyance.

Cloud-Based Solutions (Nest, Ring, Arlo)

These are the easiest to plug in, but the convenience comes at a price. You are looking at $10–$20 monthly subscriptions and a total loss of privacy. If your internet drops, your security goes dark. For many HomeLab enthusiasts, sending 24/7 video of their front door to a giant corporation is a dealbreaker.

Traditional Local NVRs (Blue Iris, Shinobi)

Systems like Blue Iris are powerful and keep data local, but they are resource-heavy. Blue Iris requires a dedicated Windows machine and often costs around $70 for a license. While robust, these systems still rely heavily on pixel-change detection. You will likely spend weeks masking out trees and adjusting sensitivity sliders only to still get alerts when a cloud passes over the sun.

AI-Native Local NVR (Frigate)

Frigate was built specifically for real-time AI object detection. It uses basic motion to trigger a localized AI check, which then confirms the object type before bothering you. It communicates via MQTT, turning your cameras into rich data sensors for Home Assistant. This makes it possible to trigger complex automations, like flashing the porch lights only when an unknown vehicle enters the driveway.

The Reality of Running Frigate

No software is perfect. Here is the honest breakdown after six months of testing.

The Good

  • True Reliability: Once tuned, false alarms drop to near zero. You only see what matters.
  • Granular Control: You can define specific zones. Maybe you want to track people on the sidewalk but only record when they step onto your grass.
  • Smart Home Synergy: The Home Assistant integration is best-in-class. It treats a “person detected” event just like a physical motion sensor trip.
  • Resource Efficiency: By using hardware acceleration, Frigate can handle multiple 4K streams without melting your CPU.

The Bad

  • Hardware Pickiness: AI detection is math-intensive. Running it on a standard CPU will spike your load to 90% or higher. You essentially need a hardware accelerator.
  • Steep Learning Curve: Frigate has a minimal GUI for settings. Most of your work happens in YAML configuration files, which can be unforgiving to beginners.

The Ideal Hardware Stack

Don’t try to run AI detection for five cameras on a Raspberry Pi CPU; it will likely lag by 15 seconds before crashing. For a stable production setup, I recommend specific hardware targets.

1. The Server

A refurbished Intel-based Mini PC (like an OptiPlex 7050 Micro) is the gold standard. You can often find these for under $130 on eBay. Look for an 8th Gen Intel CPU or newer. The built-in QuickSync technology handles video decoding far better than any AMD or ARM equivalent.

2. The Secret Sauce: Google Coral TPU

This $60–$90 device is non-negotiable for a serious setup. A USB or M.2 Google Coral TPU handles the heavy lifting of object detection. It reduces inference times from 100ms+ on a CPU to a blistering 7ms. This offloading allows your server to stay cool and responsive.

3. The Cameras

Stick to cameras that support RTSP and dual-streaming. Frigate uses a low-res “sub-stream” (usually 640×480) for the constant AI analysis. It only pulls the high-res 4K stream for saved clips and snapshots, saving massive amounts of network bandwidth.

Deploying Frigate with Docker

Assuming you have Docker ready, follow these steps to get your container running.

Step 1: Prep the Environment

mkdir -p ~/frigate/config ~/frigate/storage
cd ~/frigate

Step 2: Configure Docker Compose

This docker-compose.yml is optimized for an Intel GPU and a USB Coral TPU. Note the shm_size—standard containers only get 64MB, which isn’t enough for high-res video buffers.

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true
    restart: unless-stopped
    image: ghcr.io/blakeblackshear/frigate:stable
    shm_size: "256mb" 
    devices:
      - /dev/bus/usb:/dev/bus/usb
      - /dev/dri/renderD128:/dev/dri/renderD128
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./config:/config
      - ./storage:/media/frigate
      - type: tmpfs
        target: /tmp/cache
        tmpfs:
          size: 1000000000
    ports:
      - "5000:5000"
      - "8554:8554"
    environment:
      FRIGATE_RTSP_PASSWORD: "choose_a_strong_password"

Step 3: Define the Logic (config.yml)

Create config/config.yml. This is the brain of your setup. Replace the placeholder IPs with your actual camera addresses.

mqtt:
  host: 192.168.1.50 # Point this to your Mosquitto broker

detectors:
  coral:
    type: edgetpu
    device: usb

cameras:
  front_porch:
    ffmpeg:
      inputs:
        - path: rtsp://admin:[email protected]:554/stream1
          roles: [record]
        - path: rtsp://admin:[email protected]:554/stream2
          roles: [detect]
    detect:
      enabled: True
      width: 640
      height: 480
      fps: 5
    objects:
      track: [person, dog, car]
    record:
      enabled: True
      retain:
        days: 7
        mode: motion

Integration and Results

Fire up the stack with docker-compose up -d. Head to http://[server-ip]:5000 to see your feed. If the Coral is working, you will see detection speeds under 10ms in the debug UI.

The real magic happens in Home Assistant via the HACS integration. My personal favorite automation turns my porch light to 100% brightness only when a “person” is detected after 11 PM, while completely ignoring the neighborhood cats. Setting this up requires some YAML patience, but the result is a professional-grade security system that works for you, not against you.

Share: