Turn an old webcam into an AI security camera with Frigate
🤖 Researched and drafted automatically from the official docs, and reviewed before publishing. Commands are taken from the source projects — but always sanity-check before running anything on your own hardware.
Frigate is a local NVR that runs object detection on IP camera feeds without sending video to the cloud. It works with cheap Wi-Fi cameras, old USB webcams bridged to RTSP, or dedicated IP cameras. Detection happens on your hardware—CPU alone works, but a Coral accelerator or GPU makes it fast. This guide gets you running on a spare PC or mini-PC with basic Docker.
Prerequisites
- A PC or mini-PC with Docker installed (Ubuntu 22.04 LTS is standard; any Linux distro works)
- At least 2 CPU cores and 2 GB RAM (4 GB+ recommended)
- One or more cameras: IP camera with RTSP/HTTP stream, or USB webcam + RTSP bridge (e.g.,
go2rtc) - Network access to cameras (same LAN or VPN)
- Optional: Google Coral USB accelerator or compatible GPU for faster detection
Step 1: Set up storage and config directories
Frigate stores video, detections, and config on disk. Create the structure:
mkdir -p ~/frigate/config
mkdir -p ~/frigate/storage/clips
mkdir -p ~/frigate/storage/recordings
cd ~/frigate
Frigate will write event clips and 24/7 recordings here. Use fast local storage (NVMe SSD preferred) if recording many cameras.
Step 2: Create a minimal docker-compose.yml
Pull the official docker-compose from the Frigate repository and adapt it. Start with a basic version:
version: '3.9'
services:
frigate:
image: ghcr.io/blakeblackshear/frigate:stable
container_name: frigate
privileged: true
restart: unless-stopped
shm_size: '256mb'
devices:
- /dev/bus/usb:/dev/bus/usb
ports:
- "5000:5000"
- "8554:8554"
- "8555:8555/tcp"
- "8555:8555/udp"
environment:
- FRIGATE_UID=1000
- FRIGATE_GID=1000
volumes:
- ./config:/config
- ./storage:/media/frigate
- /etc/localtime:/etc/localtime:ro
networks:
- frigate
networks:
frigate:
driver: bridge
The shm_size of 256 MB is a starting point; increase it if you see “unable to allocate memory” errors. Port 5000 is the web UI, 8554 is RTSP re-streaming.
Step 3: Create the config file
Create config/config.yml. Start minimal and add cameras:
logger:
default: info
database:
path: /media/frigate/frigate.db
recorder:
enabled: true
retain:
default: 10
mode: all
detectors:
cpu:
type: cpu
objects:
track:
- person
- car
- dog
- cat
cameras:
front_door:
ffmpeg:
inputs:
- path: rtsp://192.168.1.100:554/stream
roles:
- detect
- record
detect:
width: 1280
height: 720
fps: 5
Replace 192.168.1.100 with your camera’s IP. The detect section sets the resolution and FPS for object detection—lower values use less CPU. The recorder section keeps 10 days of video by default.
Step 4: Get your camera’s RTSP URL
If you have an IP camera, find its RTSP stream address in the manual or web UI. Common patterns:
rtsp://username:password@camera-ip:554/stream
rtsp://camera-ip/live
http://camera-ip:8080/video
For a USB webcam, you need an RTSP bridge. The Frigate docs recommend go2rtc. Add it to docker-compose:
go2rtc:
image: alexxit/go2rtc:latest
container_name: go2rtc
restart: unless-stopped
ports:
- "1984:1984"
volumes:
- ./go2rtc.yaml:/config/go2rtc.yaml
networks:
- frigate
Create go2rtc.yaml:
rtsp:
listen: :554
streams:
usb_cam:
source: v4l2:///dev/video0
Then in Frigate’s config, use rtsp://go2rtc:554/usb_cam as the camera path.
Step 5: Start Frigate
docker-compose up -d
Check logs:
docker-compose logs -f frigate
You should see Frigate initializing the database and connecting to cameras. Wait 30 seconds, then open http://localhost:5000 in a browser on the same network.
Step 6: Verify detection and recording
The web UI shows live feeds, detected objects, and event clips. Walk in front of the camera—you should see a “person” detection appear. Frigate stores clips of events in storage/clips/ and 24/7 video in storage/recordings/.
If detection is slow (>1 second per frame), your CPU is bottlenecked. Lower the detection fps or width in config.yml, or add a Coral accelerator.
Optional: Add a Coral USB accelerator
If you have a Google Coral USB accelerator, update docker-compose to pass the device:
devices:
- /dev/bus/usb:/dev/bus/usb
- /dev/apex_0:/dev/apex_0
Then update config.yml:
detectors:
coral:
type: edgetpu
device: usb
And set cameras to use it:
cameras:
front_door:
detect:
detector: coral
Detection will drop from 300+ ms per frame (CPU) to 50 ms.
Optional: Integrate with Home Assistant
Frigate includes a Home Assistant custom component. Install it via HACS or manually, then add the integration and point it to your Frigate instance at http://localhost:5000. You’ll get automations for person detection, clips, and snapshots.
Storage and retention
Video eats disk fast. A 1080p camera at 10 fps uses ~1.5 GB per day. Set retention in config.yml:
recorder:
retain:
default: 10
objects:
person: 30
car: 5
This keeps 10 days of all video, but 30 days of clips with people and 5 days of car clips. Adjust based on your disk size.
Keep the web UI on your LAN
Do not expose port 5000 to the internet. Frigate’s web UI has no authentication by default. Either keep it behind your LAN firewall, access it via a VPN, or use a reverse proxy with authentication. If you need remote access, use Nabu Casa (Home Assistant’s cloud) or a WireGuard VPN.
Respect local recording laws
Check your jurisdiction’s rules on recording. Many places require consent or visible signage if recording audio or people in private spaces. Video-only recording of your own property is usually legal, but confirm first.
Is it worth it?
Yes, if you have spare hardware and want to avoid cloud camera subscriptions. Frigate is mature, well-maintained, and runs on anything from a Raspberry Pi 4 to an old laptop. Detection is accurate and local. The main cost is storage—budget 1–2 TB per camera per month if you keep 24/7 recordings. If you only care about event clips, disk use drops to 50–100 GB per month. Start with one camera and a USB webcam to learn the system before scaling up.
Related video
New self-hosted AI & homelab shorts, daily.
Subscribe on YouTubeRelated guides
Turn a $15 Android TV Box into an Armbian Linux Server
Flash Armbian on Amlogic S905/S922 TV boxes to run Docker, Pi-hole, and other services. Boot from USB first—eMMC flashing can brick it.
Turn Old WiFi Gear Into a 320Msps SDR Receiver with GQRX
Repurpose abandoned WiFi hardware as a software-defined radio receiver. Build a 320Msps SDR station on your homelab using GQRX, GNU Radio, and RTL-SDR dongles—no new gear required.
Run macOS Binaries on Linux ARM with Kakehashi
Use Kakehashi to execute native macOS applications on Linux ARM64 hardware, cutting Apple hardware costs while keeping your workflow intact.