I Spy, with my Little Pi...

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
when I moved into this new office space the place had a few of these old hick Vision security cameras it also had this junky old hick Vision NVR or Network video recorder you plug the cameras right into the back and it gives power to each camera records all their feeds to a hard drive and lets you access it remotely now don't get me wrong if you just need to store security footage this thing's fine but this is 2024 AI is taking over everything and not all of that is hype can it help us make a better NVR I'm going to take this Raspberry Pi and plug in this TPU that runs machine learning models it'll help the P identify people cars bikes or well anything I'm going to feed all the old cameras into it and build a modern free and open source NVR that's actually better than most of the commercial ones I'm going to literally spy with my little pie I guess on myself though since the cameras will be around my office but there are a few things I need to do to get this all working I have to reinstall the cameras because I had to take them all down for construction I have to get Poe power to each camera using a power over ethernut switch and I have to set up frig on a Raspberry Pi now you don't actually need a Raspberry Pi you can run frig on most any computer it just has to be able to run a Docker container and if you use a newer Intel CPU or even an arm Rock Chip CPU frig can use its internal npu but I'm using a Raspberry Pi for this build using it with the coral TPU it's efficient and plenty fast at least for four or five cameras but one big advantage of commercial commercial nvrs though is you can get them in a desktop enclosure like this or even in fancy rackmount boxes like the ubiquity Network video recorder there's nothing like that for the p is there is there this is the aess Interceptor oneu case XS sent this to me like a year ago and they didn't even ask me to make a video about it or anything but I did get it for free full disclosure but it's $130 rack mount enclosure that holds their Interceptor board and accepts an add-on Poe board and three hard drives you can build your own open- source rack mount NVR with this thing my goal is to take this box make it almost silent with some noxo fans and get frig running on it the coolest thing about this box is access makes this Poe board it has an internal power over ethernut switch so you truly get everything self-contained in one box that means I won't even need an extra Poe switch I can just plug the camera straight into here at least that's my hope now before I start building this out I want to make it clear even with a Raspberry Pi you don't need an elaborate box like this to get started with frig in fact at home I've been running frig for months with two 4K cameras and a pi5 with an nvme head and I also did a lot of testing with frig on this bit pyat a tiny compute module 4 based board frig runs great on any PI 4 or 5 and you can even use Coral tpus directly with a PCI Express bus on the pi 5 but if you want an all-in-one solution where you can just build it yourself and still look just as good as any pro NVR this thing is as good as it gets let's open up the case and get started these are not hot swap but they aren't too hard either I'm going to call an audible instead of installing all three of these hard drives I think I'll just do two in raid one and uh looks like you just put the screws in on the sides not necessarily the simplest solution in the world but uh it works it's okay um the other part of this that's important to get right is the power so this is the it takes a 12vt input and gives a 48 volt output 5 amps maximum for this uh Poe board and this is what takes the power supply power at 12 volts and outputs it at a Poe rated 48 volts uh so that you can power devices off of here and this is not necessarily the best solution for this but it is a solution and it should work this will go up here these guys it's getting kind of tight in here already but this is a compact case so I can't fault him too much for that uh this is our power supply and this is flex ATX this is a 350 W this is what they sent uh you can use other power supplies with the Interceptor board the nice thing is it uses Standard 24 pin ATX and your hard drives use standard SATA power connections so as long as we get this installed and it fits in here nicely um it's not going to be an issue either way seems like you'd want these exhausting not uh pulling in air but uh who am I to say I'm going to go ahead and do the same thing that they're doing use these as intakes so the fs are definitely not hot swappable but uh not too hard to replace one you do have to take down the system to do it and you my friend can go in the back over there much better now I can start getting this power connect Ed here well now it's time for this guy this has uh eight ports Poe ports that go into the switch was an RTL 8367 RB and it's a managed switch I think it's 100 megabits it I think you can get a gigabit to the pi and then 100 megabits to all of the poe devices which is fine for for Poe cameras this is a little short uh I'm going to have to figure that out and I'm going to figure out the rest of this wiring and figure out how to get this power connector over here and I'll rejoin you in a minute did you ever record an entire video and then realize your recorder was in the wrong setting and so you have a bunch of wasted footage that's exactly what happened while I was building this so uh you get to skip that part I might add a few highlights before this but anyway uh I'll get to the pertinent details one thing is this particular unit uh this this is one that I got a long time ago for their old extended case and it was these leads were kind of short so I don't know if that's the case if you buy the latest one that they have they might have ones with longer leads on it that get out here but I could not Mount this over here where it's supposed to go and get these yellow and black wires all the way to the poe board right here uh a couple other interesting things the power supply the bracket I had to bend it a little bit with at least this power supply it's a 350 W power supply Flex ATX and um you know but it fits fine these are all little things with a case this is I think their second design of this case so over time they'll they'll figure out little tweaks to make it a little bit better I'll I'll zip tie this a little bit maybe probably not uh but there's a cabling mess here that was there was just no space with a third hard drive bay and uh the the one downside is there's a little gap on the tops and bottoms of these drives so some air flow will get through uh but I don't know if even with these two fans I'm not sure if that's enough to really push air through this system and it's it's a strange setup it' be nice to have a couple intakes up here pushing their back and then it would exhaust out here or exhaust out the back but that's not how this is set up uh but I have the fans routed over here I had to use the fan extension cables to get them to the Interceptor board I plugged the Raspberry Pi in here it doesn't have a micro SD card slot so I wound up using emmc uh a compute module 4 with emmc and I don't need Wi-Fi because this is going to be in a fully enclosed metal box no external antenna or anything uh and then I put a little CR 2032 battery in for the RTC so it can keep time and here's the front panel header connections there's a power switch and led and then there's the USB 2.0 ports to the front panel that plug in back here and there's probably enough air flow that things will stay cool uh but let's get the let's get the lid on this thing wherever I put it and uh going to see if it boots up I already flashed raspberry posos onto the pi inside of here so raspberry pios uh 64-bit light and I have a script that will install frig now one thing I don't know is exactly how the the network switch chip Works in here I think it's configured to just like pass through the networking and be just a basic switch but if it's not I might need to do some things to get the switch working with these ports uh but let's screw this in and we'll get it turned on and and see what happens fingers crossed it seems like they have a different screw for the sides of this than they do the back which is a interesting design design it's an interesting I can't say that design decision design decision design decision uh to have it has it has coarser threads on the side and a longer thread on the back uh but you know it all works in the end hopefully let's get this it's a little bit heavier now let's get it uh plugged in and see what happens I'm going to plug the power supply in and hopefully it does not kill me this is an all metal chassis I hear the hard drive spinning up the fans are going the power supply fan is actually very quiet on here that's uh an unexpected surprise uh but this system actually boots up right away when you when you plug it in uh the power button only works after the first boot so I'm going to let it boot up I'm going to plug in networking and see if I can get to this on my network okay I called this Pi NVR so I'm going to try ping Pi NVR dolo and I'm not seeing it nope there it is okay so it's 221 I'm going to try to SSH into it SSH PP NVR local okay we're on Linux 6.6.2 and I'll see if we can see the PCI bus LS PCI there it is we have the uh SATA controller I think it's a jmbb 585 and we'll see if we can see the hard drives lsblk and there they are SDA and sdb both of them are 8 terab so I reading the FAQs on acc's website and it does mention that there's a few bootloader settings it wants us to change which I'll have to do uh somehow uh to that emmc on the compu module 4 on the bootloader um the other thing is it says if you use your own OS image so I'm using raspberry pios I'll need a kernel patch and maybe this if uh I don't know if it's using I think we're using Mainline Linux DSA uh but I might need a kernel patch if I want to control the onboard networking I don't know if it'll work without it if it still works I might not worry about this for now but if you want to control that onboard uh switch then you probably need this patch I don't think I need to add some of those uh options to the boot loader because I just shut it down and I pressed the power button and it turned back on and booted up fine so I I guess you don't need to make those boot loader changes uh so that's nice so it's day two for this uh project it was getting late yesterday and I went home and I'm back now and we're going to get this thing going uh you can see that it sees the USB device it's called Global unip Corp it I think it used to be Google incorporated so I don't know why the vendor has changed on the Google Coral but I plugged that into the box uh and it's USB 2.0 so you can see it's 480 megabits but that should be okay for for inference especially for just a few cameras uh but we'll we'll test that and make sure uh but now that I have the box running I have two hard drives um I need to get foret running on here so what I use is pi NVR a project that I built uh that I've been testing on a few different computers lately uh but this project sets up different NVR systems on a Raspberry Pi in this case uh and I've tested Zone minder Shinobi and frig and the other two are just not they're not very fun to use uh Shinobi in particular was so complicated to get running that uh I decided just to stop trying and now I'm using frig for all of my nvrs and uh this repository has instructions for getting going and some recommendations for cameras and Raspberry Pi models and all that and an installation guide so we're going to follow that and I'm going to go over to my project folder and I already set up this config file with uh one of the cameras this is the hick Vision Dome camera I have it's a uh I don't it's 1080p the exact model number I I might put it on screen or something uh but these are the settings for it in frig now how do you figure this stuff out because this is the one part of frigate that's kind of annoying is it's all yaml and I'm very familiar with yaml because I use anable a lot for example this Playbook itself is all Amel that describes how to install frig on on the Raspberry Pi uh you have to basically I found go to the frig uh documentation go to the frig uh GitHub and search around for your par particular camera the thing is I would recommend sticking to cameras that other people have used don't just go out and buy the cheapest camera or buy some camera that you think might be amazing buy one that other people have used unless you're good at figuring out where the stream paths are and things like that cuz some cameras are better than others at giving stream outputs that can be taken into frigate easily and I also have some anky 4K cameras that are also very easy to integrate and uh the key is this is after I've done a lot of testing with a lot of cameras is uh when you when you do the detection so when you're detecting whether there's motion or whether there's a person or a bike or a car or something you want to use a substream from the camera so cameras actually send out a full resolution stream and a and one or more sub streams that might be like 480p or even lower resolution and if you use that full like if you have a 4k camera then your Raspberry Pi is going to be processing 4K video real time which really bogs things down for motion detection I'm going to go ahead and get frig installed on here using this ansible Playbook it basically runs a Docker container on the Raspberry Pi with frig anyway I have anible installed uh the inventory. file I need to change this to Pi NVR local anable users pi and then the config file should be all correct here and I have it set to use the htpu on USB and then now I can run anall Playbook main. yaml so this Playbook will install Docker on the Raspberry Pi and that's a prerequisite to installing frig and then the next Playbook I'll run will install frig using Docker okay so now docker's installed I'm going to see if I can log in and Docker PS okay so Docker is running and now I can go back out and uh one other thing that I need to do before I install frig I believe I have frig and configured to store things in/ mn/ frig so I need to set up storage at that path or I could change this path to somewhere else uh but since I have uh these two hard drives that are 8 terabytes I want to set them up in a raid one array and that will let me have two hard drives that are both 8 tabt basically mirror each other at all times so if one hard drive fails I'll still have all the data on the other hard drive it depends on how important that footage is to you to have persistent um and of course just having it in raid even if it's mirrored doesn't mean it's backed up so if you are really wanting that footage you should also have this thing back up to another device like an assas on your network but I do want to put these two discs into raid and I have a guide for that on jeffg ling.com raid how to guide without ads let's get our information about it so it looks like it's there it's going to do a resync that takes a while you can still use it while it's doing this uh but it will take a while and you could monitor that if you want and I can actually hear the hard drives over there they're not actually in a vibration Mount or anything they're just mounted to the metal so that is one concern some hard drives can handle that better than others if you get a Nas or they make actually special hard drives for surveillance or for nvrs uh those generally can can handle the vibration a little bit better than like a desktop hard drive so get the right hard drive for the thing that you're going to do with it formatting is complete so now I have a formatted raid volume but I need to mount it so if I say LS spk I can see I have md0 which is an 8 TB raid r one array and here it is so I have 8 terabytes there so let's make sure that the uh the raid actually comes back up after a reboot because that would be very sad if we did all that work making a nice little raid one array and it doesn't show up next time you reboot and frig starts writing files to the local file system uh so let's see I just logged back in and we have it's now md17 I don't know why it does that it was md0 when I created it but now it's 127 I'm sure there's a reason for that but it is mounted at Mount slf I'll follow the directions here to run frig main. yaml and this will set up frig for me while that's setting up I actually did plug in uh one of my cameras I have it set up as C M1 gear. net it is another of these HIC Vision cameras that came with the office space and I have it plugged in right now through a little power over ethernet adapter you plug that into the wall and then you plug the network into it and then the camera into its Poe Jack and it provides the power but like I said I should be able to plug this straight into the back of the box but I'm not 100% sure if that networking setup will work yet with Raspberry Pi OS out of the box so um we'll test that later okay so if I log in let's check if the Docker Docker containers running I'll say Docker PS and it looks like it's been running and it says it's healthy and if I go over to pv. local what uh what port are we running on 5,000 if I go here I should see frig which I am seeing it come up let's see what happens there it is so this is frig's main interface and forgive the camera being upside down I don't have a mount for it and this is not mounted yet in the studio but uh this is camera 01 the the dashboard kind of gives you an overview of all your cameras and a snapshot from when you load the page so if I refresh this you'll see that the time stamp here updates and yes it's a little bit off I need to set the time and date for this camera uh but it has for each camera events recordings and then some some toggles you can turn on and off motion detection which also turns on and off the object detection based on the motion uh you can turn on and off recording 24/7 I have it configured right now to be recording all day long but if I go to events I've moved in front of the camera and I waved my hand in the camera and it already detected those so it it saves those and you can have this trigger sending them out to uh home assistant which is what most people do with frig uh or you can do other things with these too it it publishes a feed using mosquito mqtt and then you can do do with that what you want if you click on it it just gives you the the clip with a little bit of padding before and after and here you can see me walking by and then I come up to it and there I am so it it gives you I don't know it looks like maybe 15 seconds before 15 after and this player is also nice it lets you uh Play Back in Faster speeds and slower speeds if you want and here's one where I think I just wave my hand it's a good little player for in the browser I actually use this a lot at home when I hear something outside I can just go in pop in find the event and then go to it the other option is you can go to recordings and that just gives you all the recordings and as time goes on this will go 9:00 10:00 11:00 Etc and you just click on the hour and then it'll also give you a breakdown of events detected that hour or you can just go to the hour and then hide this and you can scrub through all the footage from that hour so you can see all the different things that go on the other option is in addition to going to events and clicking download to grab one you can go to to exports and you can pick any camera and you can choose a Time range and you can either export the full video in real time or you can export a time lapse which is really cool if you have a camera set up outside and you want to see like sun set um and and have It sped up you can just grab a time lapse of it uh the other things that frig gives you out of the box is a little page showing you your storage on your device uh how much space you have left how much is used up and that'll help you to figure out uh especially the stream bandwidth um it'll help you figure out how much storage you might need so in my case with one camera it's saying 400 Mega megabytes per hour uh it also gives you an overview of your whole system so it's showing me that I'm using a coral uh TPU for a detector it doesn't use much CPU it doesn't use much memory and it takes about 35 milliseconds to uh take one frame that has Motion in it and detect whether there's an object in it that can actually get a little bit faster if you use USB 3 or PCI Express on the pi5 uh but this is plenty fast it's faster than using the CPU on the Raspberry Pi by quite a bit and then uh each camera it shows you stats for it uh how much CPU that camera is using for the stream and how much it's using to capture footage and how much it's using to detect um Motion in it so this is a good way to see like is my computer fast enough for the types of cameras and the number of cameras that I have and in this case with these stats I'm you you could probably get four to six cameras at 1080p on a on a compute module 4 with no issue at all uh it'll show you the full configuration this is basically the same configuration that that I just showed you from the anable Playbook and then some logs and you can see that uh right now it's having trouble publishing the uh the mosquito feed that's cuz I haven't configured that all the way yet the next step here is to get one of these cameras installed in the space and start actually recording real footage and using it as an NVR for the space I'm actually going to cover camera installs in my next moving Vlog so subscribe for that and there are a few things I didn't cover here that are really useful features in frig like masking camera feeds to exclude areas from motion detection but for this video I'm overall pretty happy with this access box and I love that I can build my own open source NVR using a Raspberry Pi and it looks pretty good could I get more camera feeds or faster object detection with other Hardware sure but the Raspberry Pi has great support it's efficient frig runs just fine even on my older compute module and it's been really stable in my testing check out the links in the description for more and also my blog posts with guides for resetting these older hick vision cameras and optimizing frig performance until next time I'm Jeff gearing
Info
Channel: Jeff Geerling
Views: 294,550
Rating: undefined out of 5
Keywords: frigate, raspberry pi, surveillance, cctv, camera, security, system, cameras, cam, hikvision, annke, nvr, network, video, recorder, dvr, software, shinobi, blueiris, commercial, interceptor, axzez, cm4, compute module, coral, tpu, npu, ai, ml, machine learning, object, recognition, motion, detection, detector, home assistant, integration, rackmount, enclosure, professional, closed, circuit, local, inference, project, networking, networked, poe, power, over, ethernet, switch, integrated
Id: 7wkVGcdI2vk
Channel Id: undefined
Length: 23min 45sec (1425 seconds)
Published: Fri Apr 19 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.