In today's video, I walked through setting up Axzez's Interceptor 1U case with a Raspberry Pi as a Frigate NVR, or Network Video Recorder.
Doing so allows me to plug multiple PoE security cameras straight into the back of the device, and record their IP video streams to disk (the case has space for up to 3 hard drives or SSDs). And by adding on a USB Coral TPU, I can also run inference on frames where motion is detected, and identify people, cars, bikes, and more using built-in object recognition models.
The video makes use of my open source pi-nvr project, which uses Ansible to install NVR software on a Raspberry Pi. A Raspberry Pi isn't a strict requirement—Frigate and other open source NVR apps run great on a wide variety of computers—but it is efficient and well-supported. And, nowadays you can find a Pi 4 or Pi 5 most anywhere.
The Axzez Interceptor makes use of the Compute Module 4, which exposes PCI Express through it's board-to-board connector. This lets the Interceptor use up to 5 SATA connections for the hard drives, meaning using disks in RAID is more reliable than if you were to plug them in using USB.
A Pi 5 or future Compute Module 5 could increase bandwidth and likely support 2-4x more cameras than the Compute Module 4, but I am only planning on deploying four or five HD (1080p) cameras for now.
Optimizing Frigate on the Raspberry Pi
Unless you've been under a rock, the past few years have changed a lot regarding the Raspberry Pi's value proposition as a tiny homelab PC. Between shortages and the first-ever price increase for the Pi 5 base model ($35 for 1 GB Pi 4 to $60 for 4GB Pi 5), there are a lot of times when a used mini PC could be a better value, even if it uses 1.5-2x more power at idle.
Especially considering the iGPUs built into more modern Intel mini PCs, they are a great value for a simple router, a small VM server running Proxmox, or even as a Frigate NVR box. You could even skip the Coral TPU if the built-in iGPU is fast enough.
But the Pi is still a decent value—and you don't need a more expensive Pi 5 to run Frigate well.
I have been exploring ways to optimize Frigate's performance on the Compute Module 4 and other Pi models, and here are a few quick wins—which also help on faster computers, but may not be as necessary:
- Don't use the camera's main stream for the
detect
role; you can use a 480p substream (some cameras even output 360p), and it will still have enough resolution for the Pi to process. - Only use the full resolution stream (1080p or 4K) for the
record
role. It will be recorded in the background (if you choose), and any detected objects will save off clips using that raw recorded footage. - Configure Frigate's storage to use NVMe or disk-based storage, don't have it write to eMMC memory or any kind of microSD card. Ideally, get NVR-ready hard drives, like WD's Purple / Surveillance line. They're designed for constant writes and some reads, and should work a little better for the purpose.
I'm still trying to figure out how to speed up operations like exporting footage either as timelapses or the realtime clips. Some things are limited by the I/O of the Pi itself, and would benefit from running on a Pi 5 vs a Pi 4 or CM4.
Watch the full video with my build process and a bit more on Frigate setup on the Raspberry Pi here:
Comments
After a few people mentioned it in the comments, I went back to check—apparently the Coral TPU changes it's identifier after it runs its first inference. It now shows up as:
That's a bit weird, and I can imagine could cause issues with software trying to pass through the device based on it's ID!
Love the NVR IPcam post and I am a bit curious if anyone has tried using a multi-channel PCIe video capture card with the Pi5?
As an Axzez LLC Co-founder, I just wanted to clear up a few things, but first let me say what an excellent video Jeff made highlighting our products. Thank you.
The Realtek IC is RTL8367RB-VB-CG. It is a "single-chip 5+2-port 10/100/1000M non-blocking switch architecture", not 100M, so each PoE Board has a 1000M connection, shared. There is a switch on each PoE board that splits that into 8 100M connections, one for each PoE port. This should be more than enough for cameras these days.
The back screw for the 1U case lids is the same as the other screws. There is no difference in threading.
If you are not using our provided OS, you will need the driver ko files from our image. The Linux kernel you are using must be the same as the version used to build our ko files. Our images do keep up with the latest kernel and arm firmware releases. I am working on a legacy downloads page where you will be able to find older OS builds where you can get the ko files if you like. Without our driver files, the PoE will not work to provide power to devices.
The power converter used in Jeff's demo, as he noted, was for our 1U 5HDD case. We do have custom power converters on the way, but we have been using lead extensions in the mean time. We did order power converters with proper length leads, but the manufacturer changed the tech in the converter and they did not work when we tested them. The sent us new parts but they did not have the custom length leads.
The fans we provide have leads long enough to reach our board to plug in. They may not be as quiet as Jeff's. 😅
Regarding the fan direction. Yes it is pulling air in, not pushing air out. We tested both ways and the system ran much, much cooler with this change. There is plenty of air flow to keep the system cool. We’ve been running systems here continuously for over a year now.
Regarding the fan placement, it may be atypical, but we actually got this idea from other cases on the market. We cannot take credit for their side placement. It works great because there is space between racks and most other cases are not pulling air from this space.
Regarding the FAQ, yes, not all CM4 boards will require the bootloader settings to be updated. Raspberry Pi sets them up differently, I suppose, over time. We just note what is needed. I'd say about 30% of customers end up needing to make these changes.
Note about Frigate, it requires AI object detection on the host. Some cameras come with built-in AI object/motion/facial detection/recognition, so using the host is unnecessary. Since Frigate does not take advantage of this on-camera AI, it only has the host CPU/GPU/Coral for this. This fact limits the number of cameras that Frigate can support on a CM4 (or even the future CM5), even with Coral. Jeff, correct me if I'm wrong here. It would appear that Shinobi or Kerberos.io may be viable alternatives, though I have not used either.
I've seen a number of people comment about Shinobi and Agent DVR; I've tried Shinobi and found it to be a little annoying, UI-wise. I haven't tried Agent DVR, but it sounds like it might be ideal if you really just want to record all the camera feeds to disk (no processing involved). Someone mentioned running it on a Pi 2 even!
I haven't tried Kerberos.io but it looks like it might scale up a bit more than most of the other open source solutions I've tested.
Thank you for doing this project. I tried this a few years back with both pi3 and pi4s to no luck using an Intel co processor. I ran into so many brick walls. Now, thanks to you and your project, I have completed a Frigate setup on a pi5 and coral TPU.
Couple of things I would love to see added to this projects
1) Alerts and notifications (I have never used MQTT or Home Assistant)
2) Trying to secure this thing behind a username and password at least. I would prefer to have some auditing of who viewed what and when.
3) Expose it in a way that allows me to get the notifications and view the videos remotely without risking someone finding my server or needing an always on VPN.
I would love it if you had any thoughts or ideas on places to start for these goals.
Thank you so much for getting me started again on a stalled project..
Thank you for your work. Thanks to your great work I have built my own Frigate NVR using an 8GB Pi 5, Coral TPU, and NVMe storage. (You also inspired me to pickup a rack mount, PoE solution for all my pi's and that was a great addition.)
Awesome! Sounds a lot like my setup at home now. Trying to work on a slightly smaller setup for home now that I've moved the larger servers to work!
A video about smaller setups for home would be awesome!