geerlingguy / pi-nvr

Raspberry Pi NVR for home CCTV recording.
209 stars 22 forks source link

Raspberry Pi NVR Configuration

CI

This repository contains Raspberry Pi NVR (Network Video Recorder) configurations, for capturing and managing CCTV/IP camera streams.

Currently supported Raspberry Pi models:

Current Status

I'm experimenting with many different DVR applications. From time to time, I create videos about NVR solutions, and I'll update this list with all the related videos:

See the 'NVR Solutions' section below for my thoughts on different applications, and read through the GitHub issues to see current progress in testing.

Cameras

Currently, I use a mix of two different types of cameras in my setups:

The C800 does H.265-only (at 4K), while the DS-2CD2122FW does H.264-only (at 1080p), so between the two, I have tested a variety of recording scenarios.

Both of these cameras also offer a substream at 640x360, which is more suitable for motion detection and object recognition, since you don't need full resolution for that purpose.

Setup of PoE or other IP security cameras is outside of the scope of this README. The main goal is to get cameras covering as much or as little of your property as you would like.

Raspberry Pi Setup

For an NVR, you should use storage other than built-in eMMC (CM4 only) or microSD (Pi 5/4 or Lite CM4). For my own purposes, I'm booting a Pi off of an NVMe drive. See my articles on how to do this:

You also need a lot of storage. Multiple TB of storage is best if you want any form of long-term archive.

And finally, some applications like Frigate are much more powerful with the addition of a Coral TPU (note: these are hard to get at list price currently).

To prep the Pi, make sure you're running the latest version of Raspberry Pi OS, can reach the Pi over SSH, and can log into it with something like ssh pi@dvr.local (that's the default address I'm using to test).

Installation

Make sure you have Ansible installed (I install with Pip: pip3 install ansible).

Copy the example.inventory.ini file to inventory.ini and change the IP address under the [dvr] section to the IP or hostname of your Pi, and the username after ansible_user to your Pi username.

Copy the example.config.yml to config.yml and modify the settings to your liking.

Run the Ansible playbook to prepare the Pi for NVR applications:

ansible-playbook main.yml

Ideally you will have set up an SSH key pair to access the Pi without entering a password. If you need to enter a password to SSH into the Pi, add -k after the ansible-* commands and Ansible will prompt you for the password when it runs.

Then run specific NVR playbook, e.g.

ansible-playbook frigate/main.yml

Be sure to have storage settings configured (e.g. any network or local mounts) prior to starting any of these applications.

Frigate setup

The Frigate docker-compose configures the Frigate storage volume to be synced to /mnt/frigate, so you should either mount a network share in that path, or make sure /mnt exists locally.

For example, set up a RAID volume or a single disk (NVMe, SSD, or HDD), and made sure it was mounted at the path /mnt/frigate before running the playbook.

There are a number of great guides for Frigate out there, but I am indebted especially to this Frigate guide from Simplepush for a broad understanding of all Frigate's moving parts.

Shinobi setup

After the playbook completes, visit the URL of your NVR, at the /super path, e.g. http://dvr.local:8080/super. The default login credentials are:

Raspberry Pi NVR Solutions

Here are my notes on different options for DVR/NVR/CCTV solutions that could run on the Pi:

Author

This project was created in 2022 by Jeff Geerling.