How to Build a Network Video Recorder With an Nvidia Jetson Nano
In the middle of working on an update to our articles on home video surveillance systems, I bought one of Nvidia’s new Jetson Nanos. While playing with the $99 board and using it to do object recognition using a variety of cameras, it suddenly occurred to me that it would be a pretty interesting starting point for a slick little Network Video Recorder (NVR) NAS device. It consumes very little power and is portable. Plus, the integrated GPU has more AI capacity than most larger NAS units, and the Nano comes with tons of AI tools pre-installed. So for those wanting to play with their own motion or person or package or pet recognition, it’d be ideal.
First Step: Setting Up Your Nano
Nvidia makes it really easy to set up the Nano. All you need is a microSD card and a computer to flash the L4T (Linux For Tegra) image. Technically, all you need is 16GB, but the system takes most of that, so I used a high-speed 64GB card. Once you’ve attached a keyboard, mouse, and monitor, all you need to do is plug in a micro USB power supply and you’ll be running Ubuntu 18.04. A wide variety of AI tools and demo applications are pre-installed for you.
You can definitely work directly on the Nano, as it has decent interactive performance, but I found it more convenient to use a Linux VM on my main Windows machine to connect with it. Thanks to X Windows, and web-server-based apps, I could do almost everything from my machine and not need to move over to the Nano. At first, I tried to get by with Hyper-V, but it really isn’t ideal for this usage, as I wanted to do some remote development where I could test peripherals on a host Linux system and then deploy to the Nano, so I switched to Oracle’s Virtualbox. I think VMWare would be even better as it reportedly has even better USB device support, but Virtualbox is free and has worked well. Of course, a native Linux host would be ideal, but I was able to do what I needed without firing up a dedicated Linux desktop.
Second Step: Beefing Up Your Nano
Out of the box, the Nano has a CPU, GPU, RAM, and comes on a carrier board that has lots of I/O options. The Nano has an Ethernet port, but if you want to use it with Wi-Fi you need to add that yourself. It’s pretty easy to add a Wi-Fi+Bluetooth card via the M.2 slot, but you could also use one of the four USB ports. For heavy duty computing, you’ll also want to get a 4-amp, 5-volt power supply with the appropriate barrel connector. And a fan. All of that is pretty easy, and Nvidia has helpfully provided some links to compatible parts on its Jetson Nano Developer site.
There are now even some 3D-printable enclosures you can make yourself or have a service bureau print for you. Several are linked in the Enclosure section of the excellent eLinux Nano site. Commercial efforts to create NVRs based on the Nano have added multiple Ethernet ports via M.2 adapters, but for a home-brew solution, as long as you have a way to get your cameras on the network (or can live with just a couple USB-connected models), there isn’t any need for that. One additional peripheral you will need is a storage drive for recorded videos. Almost any SATA drive is usable, but for performance and portability, an SSD would be best.
Fortunately, I happened to have the ideal SSD at hand. Seagate has introduced a NAS-optimized Ironwolf 110 SSD and I had a review unit to use. Used with an enclosure that had its own power supply it worked perfectly, with the only drawback being that it wouldn’t power up correctly when connected only to a USB port. As an alternative, I connected an M.2 SSD that also worked, but of course, wasn’t optimized for a NAS workload.
How much storage you need depends on your cameras, their resolution, and how long you want to keep recordings. I’ve been testing a home NVR on a Synology DS-1019+ 5-bay NAS with a 2-drive 2TB RAID 1 array successfully, so I used a 2TB Ironwolf 110 SSD. The small size of the SSD means that you have the basis for an ultra-portable video surveillance system. Seagate’s new Ironwolf 110 SSDs are also optimized to live with the heavy workloads typical of a network server, but you can certainly use something less expensive — the M.2 drive I used was the one I took out of my Dell laptop when I put a larger one in — if you’re trying to keep costs down.
Configuration Tips: First, once you get it set up, you don’t need to connect a keyboard, mouse, or display to the Nano for most things. You can run it remotely over an ssh or other terminal session, and use either web interfaces for managing the NVR or a remote GUI like X Windows. Second, I recommend making a backup of your system once it is the way you want it. One easy way to do that if you have Windows is using the free Win32 Disk Imager to make an image of your microSD card.
Third Step: Picking Your NVR Software
There are a lot of good NVR software solutions. The tricky thing about using the Nano is that it requires software that not only runs on Linux, but that runs on an ARM processor. In my case, I didn’t want to spend the time to build a solution from source, so I looked for one that was free and would run out of the box. That led me to ZoneMinder. ZoneMinder is easy to install and has a native web UI, so it is easy to manage from anywhere in your network. It is flexible and powerful, but on the downside, I don’t find the user interface intuitive.
There was also a glitch in the version I used with the Nano (running 18.04 Ubuntu L4T) when trying to use the Probe functionality, so I needed to enter camera details manually. It seems like some sort of odd library version problem that will hopefully get fixed as the Nano gets more popular.
Fourth Step: Picking Your Cameras
Most of the big-money investment in home security cameras is going into walled-garden, cloud-subscription-based, NVR-unfriendly cameras like the Ring (Amazon) and Nest (Google). Personally, I think that’s a terrible trend, as all those cameras could easily support RTSP & ONVIF, but the companies behind them have chosen instead to bet that they can make you pay to look at your own video. That said, there is, fortunately, a flourishing market in IP cameras you can use however you want.
The first camera I used with ZoneMinder on the Nano was the inexpensive, but powerful, Honic 4K. I’ll write more about it in our update to our security camera roundup, but in short it is a 4K outdoor PoE IP camera for a mere $80 (Note: I bought one for $80 when I started work on the articles two weeks ago, but it is now $104 on Amazon, so YMMV). It wasn’t obvious how to connect the camera to ZoneMinder without having access to the automated Probe functionality, but the Honic Support folks got back to me quickly with detailed instructions.
Finally: Configuring Your NVR
Assuming you’re using ZoneMinder, you add cameras as Monitors. To test them out, you can simply configure them with the “Monitor” action. But to start recording video, you’ll want to change them to either “Mocord” or “Modect.” Modect gives you the ability to detect motion in specified zones. At this point, as someone who has run a home video surveillance system for several years, I strongly recommend to record continuously if you can.
For me, the best strategy if you have a system capable of continuous recording is to have it record everything and then highlight motion events. There are several good reasons for recording everything, but the single most important is that you can be sure of things that didn’t happen. In our case, the most common use of our video footage has been proving that a delivery was never made. A corollary is that you can be sure that if something did happen, you’ll have a record. If you’re only recording detected motion events, you can never be sure whether you have full information.
That said, it’s really helpful to be able to get alerted only when motion is detected, and to be able to fast forward through recordings to see detected motion events. If you’re willing to do some programming, the Nano is a perfect device to code up some clever AI to detect events you’re interested in and have them handled specially. The Nano is powerful enough to run both my ZoneMinder install and AI-based detection apps that I have using a Logitech USB web camera. So there is plenty of room to add whatever custom capabilities you can figure out how to code.