This multi-part series explores DIY surveillance, so you can create your own powerful (or tiny) surveillance solution.
The Big Why
These days, you can buy a pretty great surveillance system for a few hundred dollars, with sensational features and reliable performance. But there are many circumstances you might want to create your own.
Ultimately the question of WHY you would want to build your own surveillance system is a big one. There are a few considerations that might take you down this path.
Flexibility
With off-the-shelf systems, you are limited to their features and options offered by the system you purchase. While the feature-list for these systems is ever-growing, it still may not cover your particular requirements.
Ultimately the biggest aspect of flexibility comes from cameras. The cameras available for your system become virtually unlimited. When building your own surveillance system you can select from a broader range of cameras, as well as mixing different brands. Having the ability to combine dome cameras with vari-focal cameras, as an example, has some major benefits.
Additionally, you can make the system as small as you like - just a single camera, even a web cam. While there’s a load of these single-camera devices on the market now, and they’re great options, we’re makers. Sometimes we just want to build one anyway!
Expansion
With a software driven solution, you’re really only limited to the processing power of the host computer (server), and the storage you have available. Outside of that, and software limitations either by design or licensing, there’s really no limit to how large or small your system can be.
We’re going to explore everything from a small Raspberry Pi system, to large multi-camera systems using a computer / server to run the system.
In this installment, we're going to fire up a Virtual Machine running Ubuntu to test-drive AgentDVR, then some other options too.
NVR vs DVR
Network Video Recorders (NVRs) and Digital Video Recorders (DVRs) are the main types of surveillance systems around. Both connect cameras to a recording device, but the major difference is how the camera transmits data to the recording device.
For a Digital Video Recorder, cameras are sending analogue or digital video signals to the recording device. A dedicated cable is required for each camera between the camera and recorder. Some commercial DVRs can actually be expanded with additional network cameras too.
For Network Video Recorders, signals are sent over standard networking technology, either WiFi or Ethernet connections. They’re generally IP-based, so network routers and existing wiring can usually be used to make installation easier.
NVRs in our opinion are superior, and that’s what we’ll be tackling from a DIY perspective too. You can indeed create your own DVR too, and much of the software we’re exploring supports that too. The main issue is that you require an additional capture card.
This is however good news, if you have some existing analogue/digital cameras which you’d like to integrate into a system, even if you plan to use IP cameras for any new additions.
Power over Ethernet (PoE)
As makers, we're no strangers to Power over Ethernet technology. It's also used extensively in surveillance systems to reduce cabling. It's also been used in phone systems, access control systems, and other devices where it's more convenient than ensuring mains power is available at the device. Many IP cameras will support local power too, but realistically PoE is much more convenient.
While there are a few different standards, PoE supplies at least 44VDC and is capable of delivering up to 71W of power. The high voltage helps avoid voltage drop over long cable runs.
If you don't have a PoE network switch already, you can purchase a small PoE switch which has a large power supply, and converts a regular Ethernet connection into PoE-enabled ports, perfect for a surveillance system.
Off-The-Shelf Solutions
If you read this project series and decide that an off-the-shelf solution is going to satisfy your requirements, then this is a sensible route to take. While we all love a good project, sometimes retail is the more sensible option. Particularly for "set and forget" operation. Building your own can likely achieve a system with greater power for less cash, but the system may not function flawlessly, as is the nature of DIY.
SELF CONTAINED SINGLE CAMERAS
SMART PAN/TILT IP Camera
- WiFi connectivity
- Intelligent motion tracking
- MicroSD recording
RRP: $79.95 - S9017A from Altronics
www.altronics.com.au/p/s9017a-smart-wi-fi-pan-tilt-and-digital-zoom-indoor-camera/
SMART PAN/TILT IP CAMERA
- WiFi connectivity
- Pan/tilt (controlled via mobile app)
- Infrared night vision
RRP: $99.95 - QC3900 from Jaycar
www.jaycar.com.au/1080p-smart-wi-fi-ip-pan-tilt-camera-smart-life-compatible/p/QC3900
TPLINK KASA SPOT CAMERA
- 3MP video quality
- Alexa / Google Assistant compatible
- Motion alerts
RRP: $89 - TK-KC105 from Wagner
www.wagneronline.com.au/kasa-spot-security-camera-tp-link/surveillance-ip/security/tl-kc105-100311/1001490/pd/
SMALL SURVEILLANCE KITS
4 X CAMERA 5MP CAMERA & DVR PACKAGE
- AHD camera to DVR transmission for long range
- BYO hard disk up to 8TB
- Includes 18m camera cables
RRP: $499 S9901 from Altronics
www.altronics.com.au/p/s9901j-5mp-cctv-hybrid-dvr-4-channel-bullet-package/
4 x WIRELESS NVR PACKAGE
- Full HD cameras, up to 40m range
(point to point, not WiFi). - 20m night vision
- 1TB hard disk included
RRP: $699 QV5500 from Jaycar
www.jaycar.com.au/concord-4-channel-wireless-nvr-package-4x1080p-cameras/p/QV5500
4 CHANNEL 4MP NVR PACKAGE
- 4x PoE cameras (PoE provided by NVR)
- Motion and facial detection
- Remote app for iOS / Android / Windows phone
- 1TB hard disk included
RRP: $779 NVR350 from Wagner
www.wagneronline.com.au/4-channel-4mp-fixed-lens-ip-kit/watchguard-ip-compact-nvr-kits/ip-nvr-camera-kits-vip/surveillance-ip/security/nvr350-86532/1000863/pd/
LARGER SURVEILLANCE KITS
8 X CAMERA 5MP DVR PACKAGE
- 4 x Bullet and 4 x Dome Cameras
- 18m camera cables included
- Up to 6TB hard disk capacity (not supplied)
RRP: $1599 S9907D from Altronics
www.altronics.com.au/p/s9907D-5mp-surveillance-cctv-dvr-and-8-camera-package/
CONCORD 4 x 4K NVR PACKAGE
- 4 x 4K IP weatherproof cameras
- Intelligent motion detection
- 2TB hard disk included
RRP: $1399 QV5700 from Jaycar
www.jaycar.com.au/concord-8-channel-4k-nvr-package-4x4k-cameras/p/QV5700
4 x 8MP NVR KIT
- 8MP high resolution cameras (2 x dome / 2 x bullet style)
- Built-in PoE for camera connectivity
- 2TB hard disk included
RRP: $1195 NVR379 from Wagner
www.wagneronline.com.au/4-channel-8mp-ip-fixed-lens-cam-kit/surveillance-ip/security/nvr379-99147/1006446/pd/
Diving Deep on DIY
NETWORK STREAMING
Before we jump into surveillance, it’s important to understand how everything works.
Most surveillance cameras which are equipped for network-based streaming use RTSP, which stands for Real Time Streaming Protocol.
RTSP was once widely used for streaming video of any sort, however is now really only found in surveillance type equipment. These days, DASH (Dynamic Adaptive Streaming over HTTP) dominates internet bandwidth, with both Netflix and YouTube using DASH due to its improved flexibility. However RTSP has retained its place in surveillance equipment, perhaps due to its simplicity and reliability.
DASH dominates Internet movie streaming because it evolved due to the need to be more adaptive than RTSP. When you have a blockbuster movie in 4K HDR to stream, but you’re streaming into thousands or millions of households with different internet bandwidth.
RTSP is far simpler, and can’t really cater for this type of delivery the same way. Under RTSP, if you don’t have enough bandwidth to receive the data, you’ll experience frame drops and other playback issues.
It’s also a little slow to sync initially, generally taking a few seconds. Of course, while this would be a source of frustration while you’re scrolling Netflix previews, but makes little difference to surveillance applications which tend to connect and retain the connection perpetually.
RTSP does still support multiple streams of video, however. Under surveillance applications this often takes the form of a primary stream (usually the highest resolution) and a sub-stream (often a configurable low-resolution version of the same video). Stream settings can often be configured in the camera themselves.
In surveillance applications the server can record the high resolution stream, while using the low resolution stream for multiplexed displays for monitoring. This reduces the burden on display where the full resolution isn’t going to be seen anyway. Of course, this is just an option, not all systems will use this functionality.
WHERE TO START
Before we get to the selections of surveillance software, it’s important to consider the hardware requirements. There’s a huge degree of flexibility, however as the idiom goes, with great power comes great responsibility.
Server Hardware
When we say “server”, we don’t mean it needs to be an actual server. Depending on the complexity of your setup, you can probably get away with an old computer you might have lying around, or could pick up online or a garage sale for a few dollars. Some of the software we’ll explore runs on a Raspberry Pi and similar too.
Of course, depending on what you’re using it for (casual monitoring of your dog compared to surveillance for a retail business) will determine how far to go here, as well as the size of system you’re planning.
While an old PC might be totally capable of running your surveillance system, if it’s considered “mission critical”, then something a little beefier might be the best option.
Enterprise-grade servers which are past their prime often make really great surveillance servers. They’re overqualified for surveillance work, but ultra reliable.
You can get all the benefits of dual redundant power supplies, top quality RAM and CPU(s), and hardware that’s designed to run 24/7. A decent dual-processor server might only cost a few hundred dollars from eBay or similar.
If you have a server rack available then you’ll have loads of options for rack-mounted servers, often coming out of datacentres when they reach end of life. Though this means they’re no longer actively supported by the vendor, not that they don’t work any more.
Unfortunately rack servers are generally quite noisy and aren’t something you can tuck under your desk or hide in a cupboard. Their small-form fans can create substantial noise even when running at low speeds. They’re designed to keep the server cool, not quiet.
If you don’t have a server rack, you can still leverage retired servers, just look for a tower option. These have larger fans (120mm compared to 25 or 40mm) so they’re much much quieter - comparable to a normal PC. Tower servers are more likely to have come from small offices than a datacentre,
so in our experience can be a little less reliable. Often they’re tucked away in a dusty corner with the rest of the IT gear, whereas datacentres are extremely clean, climate controlled areas.
As long as you check out whatever you’re purchasing, it’s still great quality hardware to use for this purpose.
Storage
Storage is a perpetual issue for surveillance, since you’re capturing streaming video.
The good news is, you also have virtually unlimited options for storage. If you can format the disk for use by the host operating system, you can use it to record your surveillance footage.
You can use a single hard drive, or a large disk array, internal or external. Realistically the storage required will be determined by the number of cameras you have, as well as the resolution and recorded frame rate.
The great thing is that it’s totally configurable, often at a camera level, but at the server level too.
The server will also record and store as much as you specify, before removing old footage to avoid running out of disk space.
Networking
Everything in a software-based surveillance system will use ethernet-style connectivity, though many of the software options we'll explore support other video capture devices too.
The fantastic part of a DIY system is that it can be a combination of WiFi-based and Ethernet-based cameras, should you wish.
One consideration that needs to be taken regarding network is bandwidth. If you only have a few cameras then it's likely no issue, but as you start to add more, they'll start to use more and more bandwidth on your network switches and routers.
For complex systems, you may even want to separate your surveillance network from your regular network to retain bandwidth for your main network. This of course, is a complex topic and really outside the bounds of this article.
Virtual Machines
For anyone familiar with using virtual machines, I know you’re probably thinking “i’m sure this would work on a VM?”. The short answer is absolutely! We're going to tackle precisely this in the build in this project to get some software up and running.
There are several reasons why this approach makes sense, as long as a few considerations are made.
If you have a server (or server-like computer) operating 24hrs a day, with spare resources (free memory & CPU) then a Virtual Machine makes plenty of logical sense. All you need to ensure is that you provide adequate storage for recording too.
Making additional disks from the host computer available to the Virtual Machine generally isn’t too difficult. However if you want to run external storage that’s not a simple USB connection, it can be a little challenging getting certain types of storage to present as available to your VM.
Virtual Machines can also have limited access to host capture cards, so if you do require hardware interfacing and you’re not just using network-based hardware, you may run into a few challenges too.
If you don’t have a server and you’re thinking about using your regular computer to host your VM, then this is possible too. The major consideration here is generally that your computer will shut down when not in use. While you’re at school, work, or sleeping, unless it’s tasked with downloading large files or similar operations, it’ll try and shut down, and that’s really what you want.
Obviously it’s not difficult to prevent your computer from sleeping - a few clicks at most, however you should consider the additional power usage (though any surveillance system requires power too), and additional wear and tear on your computer. If you have a nice gaming computer with a high end GPU etc, you’ll probably find hardware failing sooner if it never gets switched off.
In this circumstance, a simple old computer you can repurpose may be a better choice. Keep your gaming hardware for gaming, and let the cheap computer do the boring work.
If it’s a temporary setup or you’re just playing around to explore network surveillance, then this is absolutely perfect.
OUR OWN SURVEILLANCE SYSTEM
You might be curious to know what we do here at DIYODE. So here’s a little information. We did want the whole "sharks with laser beams" approach, but ended up creating a powerful high resolution system of our own.
Our in-house system is running on a HP Proliant DL380 G5 server. These are one of the most popular server models of their generation.
We actually acquired this server with no cost at all! It was deemed “dead” by its previous owners, who failed to replace drives in the RAID array and it ultimately collapsed on them when failures exceeded what the array could handle.
However the server works perfectly. After replacing the failed drives, rebuilding the storage array, and a fresh Linux installation, it was good to go. A little dust removal didn’t hurt either.
This server model came with a bunch of processor configurations, but ours has two dual-core Xeon processors. That gives us four 3GHz cores of CPU processing, with 32GB of RAM.
We’re running 9 cameras, most of which are 4K, and the server barely notices it. Average loads are around 6% CPU usage and about 5% memory usage. That's the total load for the system running Ubuntu 18.04 LTS for the operating system and BluecherryDVR server software, which is a very solid base.
Obviously this system is well over-spec and would run perfectly with far less CPU or memory, but for something running 24hrs a day, over spec is often a good idea.
As for storage, we have an old 32TB Promise vTrak array. This was part of our main storage array at one point in history, but is now too slow. However it’s top-quality enterprise equipment, even though it’s aged, with fully redundant power and connectivity, SMART disk management, and a host of other features to ensure reliability for many years, despite it being past service life.
The data is also sent offsite to an Amazon Web Services (AWS) storage bucket for archival purposes, but we’re not going to go into that one too much for security reasons.
WHY DID WE GO DIY?
Let's face it, it doesn't take too much for us to go down a DIY route, but there were several considerations which confirmed the deal.
MIXED CAMERAS
When we first moved to our current location, there were perhaps half a dozen cameras installed already. After some testing, we discovered that these cameras were all in great working condition. As is often the case, it was probably easier and cheaper for the previous occupants to leave these cameras installed than it was to remove them and patch the holes etc.
What was challenging however, was the mix of brands and camera types. We found some heavy duty HIKVision outdoor cameras with integrated IR spotlights, as well as some regular Samsung dome cameras. We also found a few low-quality HIKVision cameras too.
We tested everything by direct-accessing the cameras with a browser / factory resetting them, and everything was operational.
UPGRADES & EXPANSION
While everything was indeed working, we found the low quality Samsung cameras (not low quality for their time, but were a good few years old) didn't have the resolution we were after. The image was OK, but they would struggle to provide meaningful identification of a person in the event of providing evidence.
The outdoor cameras however, were much better, with about 5MP of resolution (similar to 4K but not widescreen).
We then upgraded the old Samsung cameras with 4K cameras from Concord, available at Jaycar and stockists. We also installed a handful of additional cameras to provide important coverage.
Bluecherry server
With the cameras upgraded, we quickly got to work setting up our Bluecherry server, which has now been running for several years.
Software Options
There’s a seemingly endless number of software options out there for software surveillance systems. Some great, and some not so great. But the open-source community is thriving, and there’s loads of development going in there. You can even run one on a Raspberry Pi fairly easily.
Agent DVR
Website: ispyconnect.com
Platform: Virtually everything.
Cameras: Unlimited for personal use.
Originally started as iSpy, an open source surveillance project for Window computers, it’s since been transformed. Relaunched as a multi-platform system, it now runs on Windows, MacOS, Linux, even Raspberry Pi.
AgentDVR is feature packed, with no limit to the number of cameras that can be added. Motion sensors and other inputs can be easily integrated. Externally, AgentDVR can integrate with DeepStack AI and License Plate Recognition, as well as most IoT platforms. There’s even a VR mode for an immersive experience reviewing footage! We're going to give that a run soon enough too!
ZoneMinder
Website: https://zoneminder.com/
Platform: Linux
Cameras: Unlimited
ZoneMinder is somewhat multi-platform, supporting most Linux Distributions. With source available, it is likely possible to roll a macOS version, but that can be challenging too. Windows however, is definitively unsupported. So it’s not something you’re going to run on the average PC. It can run on a Raspberry Pi, which we’ll road test later.
Virtually any camera is supported, as is the case with most of these solutions.
ZoneMinder can also use 3rd party integrations for object and person detection, with GPU optimised processing available too.
A well-featured mobile app zmNinja provides Android and iOS access for remote viewing.
One thing I really like about ZoneMinder is that it can show the bandwidth usage of the cameras connected. This is useful for various situations, but in reality it just satisfies our love for numbers.
Shinobi
Website: https://shinobi.video/
Platform: Ubuntu 20.04
Cameras: Unlimited
Written with a modern Node.js framework, Shinobi provide a free to use Community Edition, as well as Shinobi Pro which has a monthly license, but enables tech support and other benefits.
There are no code differences between the Community and Pro editions, and it’s an honesty-based licensing system. The major benefit here is that it does allow you to test-drive the full feature set before licensing, if you’re exploring options. Often trials or restricted versions don’t enable you to do this.
While the server software is geared to Linux, there are various warnings about trying to run it on anything but Ubuntu 20.04. It does technically support other Linux distributions and MacOS, but Ubuntu is recommended.
While this is likely the most restrictive of the solutions we're including here, it can give it something of an edge. When its dedicated to a single operating system, the support for that system can be better. Bugs regarding installation and operation are all geared towards Ubuntu. We'll be running this in the next installment of this project.
Kerberos
Website: https://kerberos.io/
Platform: Raspberry Pi or any OS which supports Docker.
Cameras: Unlimited
Kerberos.io project is focused on accessibility and committed to being Open Source with the MIT license.
For the record, Kerberos is pronounced as "kuh buh ruhs", you're welcome.
Loading onto Raspberry Pi is made simple thanks to a modified Etcher-based installer.
There's also a Kerberos demo you can check out online at
https://demo.kerberos.io/welcome
Kerberos is heavily focused on solving problems for surveillance, with extensive integrations. It's really designed to be far more than just a recording platform, with the ability to analyse and process the footage too.
Kerberos Vault integrates machine learning and artificial intelligence, while the door is left open for integrating your own machine learning models. An extensive API also allows custom extension, further allowing customisation of the platform for specific purposes.
Bluecherry
Website: https://www.bluecherrydvr.com/
Platform: Linux server, multi-platform clients.
Cameras: 4 free, unlimited paid.
We’re big fans of Bluecherry, which has been our choice of surveillance software for several years. While it’s claimed as open source, it’s really more of a freemium model now.
The server software runs on Linux, while the Bluecherry client runs on Windows, macOS, and there’s a mobile app too.
The free community edition supports up to 4 cameras, but you have to license to use more. This is a reasonably new addition to Bluecherry, but the system is very reliable so it deserves inclusion here.
There’s a built-in database of thousands of available IP cameras to make configuration easy. We’ve occasionally had to add custom configurations too, which is also very straight forward.
Aside from a few memory leaks in the client software we've observed, the server software is very efficient and stable, running for years with no faults observed.
Exploratory Build: Ubuntu Test Rig with Camera
We've shown you 5 of our favourite software surveillance packages, but that's only scratching the surface. Unless there's a clear option that stands out to you, you probably want to test-drive a few to see if it'll work for you.
The simplest way to do this is to fire up a Linux virtual machine. You can do this using VirtualBox which runs on MacOS, Windows, and Linux platforms. It makes the process of testing and even reverting your installation back to a base install ultra easy, and if you decide to go in another direction it's just a few clicks to start all over again.
If you don't have VirtualBox already, head over to
https://www.virtualbox.org/ and download the version most appropriate for your operating system.
We won't go through installation here as it's different for each operating system, but relatively foolproof and you can just follow the prompts.
Now we'll grab a copy of Ubuntu Desktop 20.04 LTS and get it going. Head to https://ubuntu.com/download/desktop and grab the latest version. LTS (Long Term Support) versions are always our go-to as they have a longer service life.
You'll need enough spare disk space on your hard disk (it can use an external disk too) - about 25GB is recommended.
CREATE YOUR VIRTUAL MACHINE
This process is fairly straight forward, and we've explained it in detail for creating a Virtual Raspberry Pi also. But we'll cover it here too.
Step 1: Click on the NEW star in VirtualBox to commence configuration of your new VM. Give it a name, specify the location, and importantly select Linux as the Type, and Ubuntu 64-bit as the version, as this matches the operating system we're going to install.
Step 2: Ubuntu recommends a minimum of 4GB of RAM for it to run properly. You can change this later if required, but we'll start with 4GB. Of course, you need to have at least this much RAM spare on your host computer.
Step 3: You do not have to create a virtual hard disk, but this function is usually reserved for "throw away" machines. If you want to be able to install software, restart, and reconfigure things, even just for testing, you need a disk.
Step 4: Select VirtualBox Disk Image (VDI) for the disk type. We'll go through the other disk types another time.
Step 5: Specify whether the hard disk is dynamically allocated or a fixed size. Dynamic disk isn't always used, but for this installation it works great. It'll keep the virtual machine from using too much disk-space from your host computer unless it's actually needed.
Step 6: Specify where your virtual disk lives. This can be on external media if you like, just make sure it's reasonably fast. If you use a slow external disk, it's just the same as having a slow hard drive in your own computer, things will be very slow to boot and run.
Install the operating system
Step 7: Now that your virtual machine is configured, you're ready to use it! But just like a new physical computer with a blank hard drive, there's nothing there yet. So it's time to "power it on" and install the operating system.
Click the "Start" arrow at the top to begin.
Step 8: You'll be prompted to add installation media to your virtual machine. Navigate to where the Ubuntu ISO has downloaded to and select it.
Step 9: Double check you've selected the right file (or you'll have to repeat this process) and click Start.
Step 10: VirtualBox will now boot the ISO. This is exactly the same as what you see when you put a bootable CD/DVD or USB drive into a new computer.
Step 11: Ubuntu can be run directly from the ISO with no hard installation required, which is great. But we're going to do a proper installation so we can use it fully. Click the Install Ubuntu button.
Step 12: We're installing the "Minimal" version to keep the disk usage to a minimum. All the software we'll need we can add via packages later, and we don't need games or office software on our surveillance machine anyway.
Step 13: Check Erase Disk and Install Ubuntu. This is only erasing the virtual disk we've created via VirtualBox.
Step 14: Follow the prompts for localisation. This will help the time and date stay correct, important for surveillance timestamps and locating footage.
Step 15: Create your login and give the computer a name. You'll need your password to log in, so make it something memorable.
Step 16: Installation will take a few minutes to run, so go grab a coffee or do something else while it finishes.
Step 17: Once completed you'll be prompted for a restart.
Step 18: When Ubuntu restarts, you'll likely be prompted to "Remove Installation Media" to continue. Ubuntu normally "ejects" the virtual optical drive post-installation and you might have to press Enter in the VM to proceed. To confirm it's ejected (virtually), check the "Optical Drive" in your VirtualBox console. If you still see the Ubuntu ISO file attached there, simply remove it before pressing enter on the VM.
Step 19: All going well, you should be greeted with the rather plain looking Ubuntu login screen. Time to sign in!
Step 20: Now you're in! Follow the prompts and connect online accounts if you wish. We'll skip this step. Follow the prompts to suit your preferences for updates and data sharing, location services etc. Realistically none of this is required for a surveillance machine, particularly for testing.
Step 21: Even though we downloaded the latest package, there's usually updates to run. It's often a good idea so Install these and restart when prompted.
InstallING AGENTDVR
At this point, you now have a fully working Virtual Machine running Ubuntu 20.04 LTS. You can now proceed to install whatever software you like in order to start testing surveillance options. Or you can continue following along.
Step 1: We're going to start with AgentDVR as it's super friendly to get configured. If you head to the AgentDVR download page, you will see all the various installation packages available.
Step 2: About half-way down the Linux tab you'll find a script to run. As with most things Linux, this will be done in terminal.
Step 3: Go to your applications and search "Terminal", then click on it to open a new window.
Step 4: Before pasting the script provided by AgentDVR, you need to install Curl. Curl is a package for making remote requests, which will be used to download AgentDVR to the machine. Make sure you type Y to approve the additional files which are required.
sudo apt install curl
Step 5: Now you can paste the script which came from the AgentDVR website into your terminal window and hit enter.
Step 6: As with many open source packages, AgentDVR relies on other open source packages. Most dependencies will install, but you'll need to approve the installation of FFmpeg which is the major video-handling library. Fortunately, while there's no package, the script will completely take care of building the source for AgentDVR.
There's a lot for the system to do here, so be patient while it runs. FFmpeg is free and GPL licensed for a large number of CODECs (more than enough to use).
Please note that this process can take quite some time, and during "make" operations, it's compiling software and if you're looking at CPU / memory usage you'll see that it's high.
Be patient and avoid the temptation to cancel thinking that it's crashed or not progressing. Linux installation scripts can be a little light on the feedback (which probably spawned the creation of progress bars in Windows and Mac, no matter how erratic the "estimated time remaining" may be).
If you've only provisioned 4GB RAM like we have for the virtual machine, that's all it can use. At this point it's a relatively low-spec computer by modern standards. If you've installed your VirtualMachine on an old computer, it's a low-spec computer inside a low-spec computer!
Your patience will be rewarded.
This does raise one important point about the VirtualMachine workflow too. If your host computer goes to sleep after 5 minutes of inactivity like many do by default, this will also halt your VirtualMachine processes.
If the computer's asleep or shut down, your VirtualMachine can't run magically in the background either.
You can indeed run the VirtualMachine without the VirtualBox window open (common in production when it's just there to do the work but you don't need access to the virtual screen), but that's another thing entirely. So if you're thinking about doing something else while these installation scripts are running, check your power settings first.
INSTALLATION FAILS
If your installation fails during the FFmpeg stage, this is a package issue. Fortuntely the workaround is reasonably easy. AgentDVR is installed, and you just have to fix FFMPEG.
sudo add-apt-repository ppa:savoury1/ffmpeg4
This is a package no longer in development, but it provides a suitable build for FFmpeg and will get around the problem. You'll be prompted to confirm you wish to continue.
Once that command has completed, run the installation for FFmpeg too:
sudo apt install ffmpeg
Once complete, restart Ubuntu. Go to the menu or use this command in terminal.
sudo shutdown -r now
INSTALLATION COMPLETE
You should be pretty well there now! All that's left is to load AgentDVR in browser (install Chrome if you prefer, or use Firefox which comes with Ubuntu Desktop).
http://localhost:8090
You should see a setup screen similar to below:
CONFIGURATION OF AGENTDVR
Step 1: You should be greeted but configuration options. Click through these for language and security as per your preferences.
Step 2: You should now see a blank AgentDVR screen.
Step 3: You're now ready to add cameras, but before you do, we need to make a chance to how the Virtual Machine connects to your network.
The default behaviour for a VirtualBox Virtual Machine is to use NAT routing. This is handy as it allows the machine to connect to the internet (virtually required these days to do anything), while preventing it from interfering with other computers on your network.
However this very benefit is what will cause issues when we try and find cameras on the network.
Fortunately it's easy fixed, as most things with a Virtual Machine are. Along the bottom of the VirtualBox window, you'll see a series of icons, including one that has two computer monitors (often used to represent network).
Click on the icon, then click on Network Settings from the options that pop up. You should see a screen similar to this.
On the dropdown that says "NAT", click on it and select "Bridged Adaptor" and click OK. This will allow your Virtual Machine to receive an IP address the rest of your network uses.
You can verify that you now have a normal IP address from the network settings top-right of screen.
BEFORE YOU START ADDING CAMERAS
You're all set to start pushing forward, but we've been working at the default Virtual Machine screen resolution, which is 800x600 pixels for Ubuntu. It's plenty for running terminal commands and such, but we're moving on.
It's worth reconfiguring for something higher resolution, particularly for video. At least HD or better would be my recommendation, but use whatever suits.
Right click on the desktop to show the dialogue menu, and select Display Settings. Then under Resolution, select your preferred resolution for the Virtual Machine.
We have selected 1920x1440. It's a good resolution, and sits as a reasonable sized window on a 4K monitor. But it's purely personal preference.
CAMERA SETUP & CONFIGURATION
Now it's time to get your first camera set up and see how things are running!
We're using a Concord 4K Dome Camera we picked up from Jaycar. It's a CNC81DP-A. Capable of being powered by PoE and such high resolution, it's a great camera, and we have a number of them in our proper setup here at DIYODE too.
As this is a demo setup, and we don't want to interfere with our proper installation where all the PoE switches are installed, we're using an 8-way switch YN8049 from Jaycar too.
The "link" side is connected to our regular network, so all this is doing is adding PoE to power the camera. The camera can be powered by a plugpack too, but PoE is easier if you have it.
Now we need to find the IP address that has been assigned to the camera. Fortunately, most cameras come from the factory ready to have the IP address dynamically assigned, but not always. So the best bet is to sign in to your router or firewall and go on the hunt. If your system shows you the date the IP was assigned, you can often find the one assigned in the last few minutes (assuming you just connected it to the network for the first time), and try that.
If it's not quite obvious, there are a few tricks.
No hostname: Most routers display the hostname of the connected devices to help with identification. Indeed you'll probably see the Virtual Machine there now too. However many devices such as cameras don't provide a hostname.
By looking for a device without a hostname you can usually start to narrow things down. Obviously if there's a listing with a hostname that matches your camera brand or model, then you can be fairly confident that's the one!
You can also test the IP address in a browser, however this doesn't always behave as expected. Browser-access to these cameras usually requires a plugin for it to work, which tends to be incompatible or blocked by many modern browsers.
If you have an older computer with Windows 7 or similar vintage, you might be able to get it to work. But for most computers, you'll get a message such as this:
This is because the script loaded by the camera in browser has identified you're using an incompatible browser.
It's handy to be able to access the admin control panel of your cameras directly, but not entirely essential either. So let's progress to adding this camera to AgentDVR.
Step 1: Top left of screen you'll find configuration menu. Select "New Device".
Step 2: The default grid is just for a single camera. You can change this layout, but since we're just testing at this point.
Click anywhere in the centre to get the New Device menu.
Step 3: Select IP Camera Wizard to try and save you some hassle setting up your device.
We'll explore the others later in this series, including ONVIF (Open Network Video Interface Forum) and other video sources. But for now you just need the IP Wizard and click OK to continue.
Step 4: The configuration dialogue provides different triggers you can optionally select. We'll leave them off for now.
Step 5: The IP Camera Wizard will do a great job of trying to help you out with credentials and configuration options.
Most cameras you can find the default username and password online with relative ease. They're often admin:admin or admin:12345 and other variants.
The directory may try and fill the username and password for you, but if it doesn't come up, you might have to track it down. Some user manuals will also provide these details. Either way, they're never terribly difficult to find.
Step 6: Different cameras will show different options here. Select the stream you want to connect to. The default for RTSP is usually Channel 0, so click on Use next to that.
Step 7: SUCCESS! You should see your video feed start streaming after a few seconds! If not, go back and double check your credentials used in Step 5. You can also try selecting other streams from Step 6.
Now we have a camera connected, we've successfully proven that the software is working, and your IP camera will stream video to AgentDVR!