Build The BEST Security Camera NVR: Free Locally Processed AI Computer Vision with Blue Iris.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today on the hookup I'm going to show you the inner workings of my totally locally controlled non cloud-based surveillance system including three AI person detection and 24/7 secondary resolution recording even if you're not interested in the ultimate surveillance system stick around for some crazy home assistant tricks that you probably don't know about you've got a ton of options when it comes to video surveillance there's dedicated and the are packages IP cameras with on device recording user-friendly wireless cameras and many more and every system has its merits and use cases but one of the questions that I get asked the most on this channel is what is the best solution for video surveillance so today I'm going to show you my system and then I'm going to show you how to do it yourself so here it is my pc-based blue iris surveillance system that records all nine of my outdoor cameras 24 hours a day seven days a week at a low 640 by 480 resolution locally processed AI computer vision checks each standard motion event for relevant objects personally I use it to detect people in cars but you might have a use for some of the other available detection objects like dogs cats or even bears in the event that a relevant object is detected it starts recording at full 4k resolution and sends an mqtt message to my home assistant to be used in automation using this system I can sort through my alerts and not have to deal with a bunch of false motion events like shadows moving or trees blowing every clip corresponds to a positive a eye detection event which I found to be over 98% accurate meaning less than one out of 50 events is a false trigger using this method my four terabyte surveillance grade hard drive gives me over 30 days of 24/7 recording at 640 by 480 and all relevant motion recorded at 4k in contrast recording 24/7 at 4k would fill up a four terabyte hard drive in less than five days and significantly shorten the life span of the drive one of my favorite parts about the blue iris system is its excellent web-based interface that allows you to monitor your cameras and view recorded footage right in chrome without the need for any plugins or special settings blue irises ui3 is light on resources and it is hands-down the best way to remotely monitor your security system on your PC I actually prefer the web interface to the full blue iris program for monitoring and reviewing footage and I only open up the main blue iris program when changing settings or adding cameras in the blue iris ui3 interface I can view high resolution live views review all my AI motion events from a specific camera or quickly scrub through the lower resolution 24/7 recording each motion event generates an animated thumbnail preview just by hovering over it making it by far the easiest way to review security footage I also love the server status system monitor that tells me the CPU and memory usage of my server because my motion alerts are around 98% accurate I can reliably use them in automations like sending notifications if there's a person at the door or someone in the back yard when we're not home I use AI person detection to turn the patio light on and off reliably and I even have a text-to-speech event that announces to trespassers that they are being recorded and then I have been notified to their presence if they're detected in the backyard while the house alarm is on attention intruder you are being recorded in the home owners have been notified the best part about all this is that it is all locally controlled and hosted 100% functional without an internet connection and it doesn't rely on any cloud services sound interesting here's how it works before we get started I have to address the elephant in the room the biggest hurdle for many to overcome with the system is not price or technical ability but the fact that Blue Iris is a Windows based program and cannot be run on Linux I'd like to be able to tell you that a linux version is on its way but that is just not the case blue iris is and will remain windows only for the foreseeable future I personally run my blue iris system on the same computer that handles my plex server and hosts the virtual machine where I run home assistant which is a 6th generation intel core i7 with 32 gigs of ram and 2 4 terabytes spinning hard drives and a 256 gigabyte solid-state boot drive personally mine was a hand-me-down but you could build something similar for around four to five hundred dollars using eBay or Facebook marketplace for reference here's what the resource usage looks like running to transcoded plex streams home assistant VM and AI person detection on all of my nine cameras the other common complaint about blue iris relates to something called feature creep which causes the number of settings and options to be completely overwhelming for new users I'm not going to cover every setting in this video but I'll hit the most important once to that end the most important setting and the one that will ultimately make or break your blue iris experience is something called direct to disc recording this basically means that blue iris will take the exact RTSP stream from your camera and record it without modifying the resolution bitrate or frame rate which means that your system doesn't need to waste any processing power on re-encoding the video stream if you don't use this setting your computer will absolutely not be able to handle nine camera streams but I mentioned that we need access to both a low resolution stream for 24/7 recording and a high resolution stream for motion events so how is it possible without reading coding well almost all security cameras have the option to output both a main stream and a second sub stream so we're going to utilize the main stream for our high resolution recordings and the sub stream for our 24/7 recordings every camera sets this up a little bit differently but here are the settings that I use on my Anki C 800 which is the camera that I chose for my best all-around 4k camera for this stream I want to use the maximum resolution at 15 frames per second using a variable bitrate and I'm going to select h.265 encoding which will result in much lower file sizes go ahead and save that profile and then select the substring from the drop-down for this stream I want 640 by 480 resolution 15 frames per second and variable bitrate at only medium quality I also choose h.265 encoding for this with our feeds correctly setup it's now time to add them to blue iris and set them up for computer vision and by the way I am NOT taking credit for any of this computer vision stuff the IP cam talk user gentle pumpkin is the mastermind behind all of this link to his awesome how to post is down in the description as I mentioned before starting out in blue iris can be a bit overwhelming so let's cover the most basic settings first go to main menu and then general settings the clips an archiving tab at the very least you need to set up a new footage folder to store your video files you should limit the total amount of space on the drive that can be occupied by this footage and when that amount of space is occupied you can choose to either delete the clips or archive them on a different location like an ass drive using the stored folder for this setup you'll also need a folder to host their still images that will be used for computer vision so select ox7 and rename it to AI input you can give it a really small size limit like one gigabyte since it's only going to contain low resolution images while we're in setup click over to the web server tab in this tab you'll need to decide which port you want to use for your blue iris web server I recommend changing it from the default port 80 which is often used by other services I personally use port 81 check the box that says use UI 3 for non ie browsers which is the awesome web-based UI make sure that the correct IP is listed for your local internal land access and if you want to set up blue iris to be accessible from outside of your network you can also set up remote access but the most secure way to set it up is without external access and instead use a VPN to simulate local access when you're away last hit advanced and set your authentication to require from non-land only meaning if you log into your blue iris from within your network you won't need to enter a username or password also deselect the use secure session keys and login page and then hit OK last click on users and create a new user with a secure password and admin privileges to use with your computer vision system the next step is to add a camera the first camera we're going to add is our low resolution 24/7 recording sub stream camera click on main menu and then add new camera on the next screen give your camera a descriptive name I'm gonna call mine Anke SD select network IP as the camera type and check enable motion detector and direct to disc recording hit OK and the camera configuration window will appear this is where you're gonna put in the URL for the RTSP sub stream for your camera along with the username and password of that camera I'm not a hundred percent what this setting does but I always like to click little box that says limit decoding unless required because that sounds like a pretty good thing to do in the general window you can assign this camera to as many groups as you'd like I'd recommend at least adding it to a group called sub streams that you can use to comb through any of your twenty-four-seven recordings that you need to in the trigger window you can click the configure button next to motion sensor to increase the sensitivity of motion detection because we want to err err on the side of too much detection since the computer vision is going to be checking them all out anyways deselect the capture and alert list image box and set the breaks on to four seconds in the record tab select continuous from the drop down and leave the folder as new also check the box that says JPEG snapshot each and changed the time period to five seconds and the quality to a hundred percent select your AI input folder and then check the only wind triggered box this will take a new still image every five seconds whenever motion is detected and will save it to your computer vision folder for analysis I like to have my continuous recording divided up into one-hour files but it's really up to you the last thing to do on this page is to deselect the box that says include JPEGs in the all Clips timeline last head over to the alerts tab and select never from the drop down box after that you're all done with your 24/7 recording standard definition stream with JPEG capture on motion you'll repeat this exact same process for each of your cameras luckily when you create a new camera it allows you to copy settings from an existing camera which significantly shortens the process since you'll only need to update the camera stream URL and camera name to set up the full resolution cameras go to main menu and then add camera and then use the same name as before but HD instead of SD and this time select direct to disc but not motion detection for this camera you'll enter the URL for your cameras main high-resolution stream and again check that mysterious limit decoding and less required box under trigger the only box that you want to have checked is the capture and alert list image and then under record you'll select when triggered and give yourself at least a five-second pre trigger video buffer as far as I can tell the video pre sugar is stored in RAM so it shouldn't be too taxing on your drive but if you have a low RAM system with 4k cameras you might run into issues I found that five seconds of pre trigger is plenty for cameras that are spotting people but I use ten seconds for cameras that are going to be detecting carbs repeat this process to add each of your high-resolution camera streams you may have noticed that we set this cameras record to be on trigger but then we disabled motion detection which is the primary way to trigger a camera and that's because the AI program is going to be in charge of triggering these cameras so let's get that set up the AI program has two components the computer vision server that processes the images using an API and a custom built program made by gentle pumpkin that watches the AI input folder for specific files and then sends those images to be processed by the computer vision server the computer vision server we're going to use is called deep stack by deep quest AI and it has both a paid and free level pricing we're going to utilize the free version you have two main options for installing the deep stack server either as a Windows program or as a docker container the huge downside to using the Windows program is that there is no way to auto start the program after restart because it can't be run as a service and you also need to click specific buttons to start the server so to get a consistent and reliable system we need to use the docker container install you could install docker for Windows to accomplish this but if you're already running home assistant in a virtual machine there is another option you can install additional docker containers in your home assistant instance since hass OS uses docker you just need to access it by installing the port ainur add-on from the community add-ons repository a quick warning this gives you way more access than you're used to having in home assistant and the likelihood of breaking everything is actually really high if you mess something up so make sure you've got a backup of your virtual machine and know that this method is not for the faint of heart after installing port Ainur toggle the switch at the top to turn off safe mode and then hit start after giving it a few seconds to load hit the open web UI button to get to the port ainur interface click on primary then containers then add container name your container something descriptive like deep space and then for the image we're gonna pull it straight from the docker server by entering deep quest AI front slash deep stack we need to send commands to the server so we need to map a port I use port 83 so click publish new network port and map port 83 on the host to port 5,000 on the container under advanced container settings go to volumes and hit map additional volumes you're gonna type in slash datastore and then click on local storage local from the drop down go to the env tab and add an environmental variable called vision - detection in all caps and set it equal to true last click on restart policy and set it to always then hit deploy container if everything went well you should now have a computer vision server running on the IP address of your home assistant virtual machine on port 83 that will automatically start any time your virtual machine is running access your deep stack server by putting that IP address in your web browser followed by the port next we need to set up the program that serves your blue iris images to the vision server grab the zip file for the latest version of the AI tool from the link in the description and unzip it somewhere permanent on your blue iris computer you'll set it up as a Windows service later to automatically start whenever your computer boots but for now let's just get it set up so double-click on AI tool to get it started under the settings tab go to input path and browse to the AI input folder that you set up in blue iris then for the deep stack URL you'll enter the IP address of your virtual machine : 83 which is the port that the service is running on then you'll set up a camera by clicking on add camera give it a name and then when it says input file begins with you put the name of the low resolution camera that we set up in blue iris so Anki SD in my case if you're not sure what this is you should be able to just go look at the AI input folder and see what prefixes your JPEG files have select which objects you'd like to detect and leave your confidence limits at 0 and 100 we'll adjust those later once we have some data I chose not to use the cooldown timer but you can set this to only analyze one image from that camera in a specific period of time this would be useful if you have a limited system resources and you're noticing high CPU usage the last thing you need is the trigger URL this uses the blue iris API to trigger a specific camera by feeding it the command trigger with the camera name username and password as attributes if you don't get this URL correct nothing is going to work so check the command by putting it into a normal web browser if you got it correct you should get a response that looks something like this hit save and then test it out you should see on the overview page it should switch between processing image and running if it seems to be stuck on the processing image step you likely have an issue with your deeps tag server URL or your deep stack server might not be running in the history URL you can see images that are being fed into the AI server and which objects are being detected along with how confident the AI was that it was actually that object type if you're noticing too many false positives you can raise or lower the confidence limit but I recommend getting a feel for each camera and the confidence levels it generates before tweaking those values a problem that I personally ran into was detection of objects that were not because of motion for instance I wanted to detect cars with my second story front yard camera but it always detected the cars that were parked in my neighbor's driveway resulting in a lot of false motion the good news is that it was pretty easy to make a mask for that specific area which blocks triggers from objects in that area there's a good tutorial about doing this on gentle pumpkins post but the result is that the computer vision still works but it doesn't trigger the camera if the object was in a masked zone I recommend checking in the history tab for the first couple days you're running the server to see what issues your computer vision might run into with your specific camera setup and then when you feel confident with the accuracy of the detection you can set up the AI tool to run as a window service in the background which will start immediately whenever your computer reboots again the exact method for that is outlined in detail in gentle pumpkins post now that your motion detection won't be tricked by shadows spiderwebs raining or moving trees you can reliably use that data in automations Blue Iris can send and receive nqt T messages allowing you to easily get this information into node-red or even set up binary sensors in home assistant to setup MQTT and blue iris click on main menu and then digital i/o and IOT and then hit the configure button in the MQTT section inputting your credentials for your MQTT broker then to actually send a message you'll need to go to the settings for a full resolution camera click alerts select fire when this camera is triggered and then under actions will go to on alert and add an mqtt topic and payload and then hit ok you can test out that alert by hitting the lightning bolt icon to set up a motion sensor in home assistant we can add the entry to the configuration file under binary sensors and then set its device class to motion put in the MQTT topic for that camera and since we're only sending positive motion events we need to have an off delay for a certain number of seconds you can tweak this for your liking but I use 30 seconds without a new motion event to revert back to the clear status once in home assistant you can use this binary motion sensor to do any number of things like send actionable notifications warn intruders or control outdoor lights only when it's dark and only when a human has been detected the possibilities here are endless this video wasn't sponsored by Blue Iris I just happen to think that they are the best option out there for video surveillance in fact this video was sponsored by PCB way PCB way offers full-featured PCB services including PCB production of all types assembly and PCB design services in the next few months I'll be releasing some easy to build plug-and-play versions of some of my most popular projects and I've been using PCB ways great service for all of my prototyping new customers are eligible for $5 off their first order which should make your first 10 circuit boards basically free check out the links down in the description thank you to all of my awesome patrons over at patreon for continuing to support my channel if you're interested in supporting my channel please check out the links down in the description if you enjoyed this video please hit that thumbs up button and consider subscribing and as always thanks for watching the hook-up you
Info
Channel: The Hook Up
Views: 547,387
Rating: undefined out of 5
Keywords: home assistant, hassio, home automation, hass.io, smart home, diy, electronics, arduino, esp8266, nodemcu, wemos d1, automation, nvr, dvr, record, person detection, ai, computer vision, opencv, deepstack, deepquest, blue iris, tutorial
Id: fwoonl5JKgo
Channel Id: undefined
Length: 19min 56sec (1196 seconds)
Published: Wed May 06 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.