Installing Frigate NVR on Raspberry Pi?

Frigate is an open-source network video recorder (NVR) designed specifically for object detection on security cameras. It runs on a Raspberry Pi and uses machine learning to identify people and vehicles in camera footage.

Installing Frigate NVR on Raspberry Pi?

Frigate NVR provides the following key features:

  • Object detection for people, cars, trucks, buses, boats, airplanes, etc. using machine learning
  • Real-time notifications when objects are detected
  • Local recording of footage when motion is detected
  • Integration with Home Assistant for automation and control
  • Cloud storage support for video backup

Frigate leverages Coral accelerators for efficient edge compute performance and optimized models for accurate object detection on security cameras.

Hardware Needed

To install Frigate NVR on Raspberry Pi, you will need:

  • Raspberry Pi 4 (2GB RAM minimum, 4GB recommended)
  • MicroSD card (16GB Class 10 minimum)
  • Power supply for Raspberry Pi
  • USB camera or IP camera(s) like Amcrest or Reolink

Optional accessories:

  • Raspberry Pi case with fan/heatsink
  • Coral USB accelerator (for enhanced performance)

Software Requirements

Frigate runs on Docker and has been tested on the following:

  • Raspberry Pi OS Lite
  • Debian OS
  • Ubuntu OS

You’ll also need:

  • Docker and Docker Compose installed
  • Git installed to clone Frigate

Installing Frigate on Raspberry Pi

Follow these steps to install Frigate on your Raspberry Pi:

  1. Install the Raspberry Pi OS
    Download the Raspberry Pi OS Lite image and flash it onto your microSD card. Insert the card into your Pi and boot it up.
  2. Enable SSH and WiFi
    • If using WiFi, configure the wireless network credentials in wpa_supplicant.conf.
    • Enable SSH by placing an empty file named ssh on the boot partition. Reboot Pi.
  3. Log in and Update Packages
    Log into your Pi via SSH. Update the package list and installed packages:

 sudo apt update

 sudo apt full-upgrade -y

Install Docker

Follow the official Docker installation guide for Debian/Raspbian:
 curl -sSL https://get.docker.com | sh  

 sudo usermod -aG docker YOUR_USER   Log out and back in for changes to take effect.

Download and Install Docker Compose

 sudo apt install -y libffi-dev libssl-dev python3 python3-pip 

 pip3 install docker-compose

Clone the Frigate Repository

 git clone https://github.com/blakeblackshear/frigate.git 

 cd frigate

Create Frigate Configuration File

Copy config.example.yml to config.yml. Customize settings like cameras, object detection, storage, etc.

Start Frigate Docker Containers

 docker compose up -d 
This launches the Frigate containers in detached mode.

Verify Operation

Check that Frigate is detecting objects on cameras:

 docker logs frigate | tail -n100
You should see real-time events from cameras listed.

Configure Home Assistant Integration (Optional)

To integrate Frigate with Home Assistant, follow the Frigate Home Assistant setup docs. This enables automations based on object detection events.

Optimizing the Performance of Frigate

Here are some tips for getting the best performance out of your Frigate NVR installation:

  • Add a Coral USB accelerator for enhanced object detection performance.
  • Choose optimal models for your camera types (wide angle vs narrow lens).
  • Lower detection thresholds on models to reduce false negatives.
  • Adjust bounding box padding percentages to tighten boxes on targets.
  • Use Substreams with RTSP cameras for lower resource streams.
  • Enable Hardware Acceleration in Docker to use GPU encoding.
  • Add a fan or heatsink case if the Pi overheats under load.
  • For 4+ camera systems, upgrade to a Raspberry Pi 4 with higher RAM.

Start with default settings, then tweak the detection configuration based on your CPU usage and detection results.

Storing and Accessing Footage

Frigate records footage whenever motion events occur. Here are some options for storage and accessing video history:

Local Storage

For local storage, attach a USB external hard drive to your Pi. In config.yml, enable recording to /media where the drive will be mounted. Video clips will save locally whenever there is object detection.

Advantages: Simple, keeps data on-premises
Downsides: Limited capacity, no offsite backup

Networked Storage

For robust storage that supports larger camera systems, use networked storage like a NAS (network attached storage device). Configure Frigate to store recordings on a mounted network drive.

Advantages: Scalable, access footage from multiple devices
Downsides: Added complexity, NAS hardware expense

Cloud Storage

Frigate also supports backing up recordings to Google Drive, Dropbox, SFTP servers, and other cloud storage providers. Set up a storage provider connection in config.yml. Clips will backup to the cloud for secure offsite storage.

Advantages: Offsite backup, easy access anywhere
Downsides: Bandwidth limits, storage costs

Maintenance Best Practices

To keep your Frigate NVR running smoothly, follow these maintenance best practices:

  • Update Frigate regularly – Watch for update notifications in Home Assistant or check on updates manually using git pull. Apply updates to get the latest features and security fixes.
  • Reboot device weekly – Occasionally reboot the Pi device to clear memory, refresh system resources, and make sure it comes back online properly on restart.
  • Check storage usage – If recording clips locally, make sure hard drive does not fill up entirely or old footage may be deleted.
  • Monitor system health – Watch for overheating issues or unusual CPU load spikes indicating problems. Check Frigate logs for errors.
  • Back up configuration – Keep a backup copy of your config.yml and container data in case you need to restore or migrate Frigate.

Following these tips will help avoid issues and ensure your Frigate system keeps running as expected.

Conclusion

Installing Frigate NVR on a Raspberry Pi provides an affordable, open-source monitoring and security solution for homes and small businesses. Leveraging edge compute with Coral devices, Frigate delivers real-time object detection on IP cameras with high accuracy. Storing footage locally or integrating cloud services enables access from anywhere. With optimizations and best practices, Frigate offers a compelling self-hosted video surveillance platform using Raspberry Pi and machine learning capabilities.

Key Takeaways

  • Frigate NVR utilizes a Raspberry Pi and Docker to run optimized ML models for real-time object detection events.
  • GPU acceleration with the Coral USB device can significantly improve detection performance.
  • Tuning parameters in config.yml helps tailor Frigate behavior to your specific cameras and use case.
  • Backup of footage and configuration is important to prevent losing video history and system settings.
  • Following maintenance tips helps avoid issues and ensure reliable long-term operation.

Frequently Asked Questions

  1. What is the system hardware needed for Frigate?
    Frigate requires at minimum a Raspberry Pi 4 with 2GB RAM, but 4GB RAM is recommended for best performance with multiple cameras. For enhanced object detection, adding a Coral USB accelerator helps significantly.
  2. What cameras are compatible with Frigate?
    Frigate works with most IP cameras including brands like Amcrest, Dahua, Hikvision, Reolink, Wyze and others. It also supports USB webcams and RTSP camera streams.
  3. How accurate are the object detections?
    Accuracy depends on camera image quality and lighting conditions. Well-lit subjects within 20 feet can achieve over 90% detection accuracy. Wider angle views are more challenging.
  4. Can Frigate integrate with smart home systems?
    Yes, Frigate supports integration with Home Assistant via MQTT. This allows creating automations triggered by Frigate detection events.
  5. How many cameras can Frigate support concurrently?
    Performance depends on hardware and model complexity, but a Raspberry Pi 4 can run 2-3 cameras with Coral accelerator. An 8-core processor can support 8+ camera streams.
  6. Can I access video feeds and recordings remotely?
    Yes, footage saved locally or to cloud storage providers can allow remote access via web browser or mobile apps. Streaming remotely requires exposing ports safely via VPN or proxy.
  7. What events trigger recording saving?
    By default, detections of persons and vehicles will trigger saving video clips around the time of the event. This behavior is customizable in config parameters.
  8. How long is event footage stored?
    Local storage is limited by hard drive space. Cloud services allow custom retention policies. Most footage is kept for 1-7 days generally before being deleted/overwritten.
  9. Is Frigate free to use?
    Yes, Frigate is 100% free and open source software. However, some optional features like cloud storage may incur costs for storage capacity used.
  10. How do I monitor system health and events?
    Frigate logs extensive details to console, viewable via docker logs frigate. Home Assistant also visualizes events on a dashboard if integrated.
  11. Can I use Frigate without Home Assistant?
    Absolutely. Frigate runs independently, while Home Assistant integration allows automation rules based on its events. Either way, it works great as a stand-alone NVR.
  12. Are there mobile apps for Frigate?
    Currently Frigate does not have native mobile apps, but the web interface is mobile browser friendly. And Home Assistant has companion mobile apps allowing remote access.
  13. How do I ensure my Docker containers stay up-to-date?
    Watch the Frigate GitHub repo for notifications on new versions. Run regular docker compose pull and docker compose up -d to update your running containers.
  14. What optimization tweaks can I make to performance?
    There are many parameters in config.yml allowing customization of detection zones, confidence thresholds, frame analysis rates, resolution, and other options that can optimize performance for your specific camera types and lighting conditions.
  15. Can I install Frigate without using Docker?
    All official Frigate documentation leverages Docker which handles dependencies and streamlines environment configuration. Technically advanced users may attempt direct OS installation, but Docker is strongly recommended.
  16. What troubleshooting should I try for errors?
    Check docker logs frigate for startup issues or detection failures. If cameras won’t connect, verify your RTSP streams work independently first. Restart docker compose and reboot the Pi before reporting bugs on GitHub.
  17. How do I completely uninstall/remove Frigate?
    Run docker compose down, then docker system prune -a –volumes to remove containers, networks, images and volumes. Optionally delete the frigate source folder if removing entirely.

Leave a Comment