Advertisement
  1. Code
  2. Coding Fundamentals

Turn a Mac into a Video Surveillance System

Scroll to top
Read Time: 14 min

Whether you want to keep an eye on the kids or keep watch over your property, there are many different types of security cameras and other CCTV equipment available to buy. These range from network-connected security cameras that you can place anywhere in your home, providing simple recording and streaming functionality, to dedicated CCTV systems that provide 24/7 recording and streaming from one or more cameras. Unfortunately, these setups can often be expensive and fairly difficult to configure and use.

In this tutorial, I'll show you how to build a budget video surveillance system to protect your home using an old Mac and some ultra-cheap USB webcams. Once finished, it will offers features such as motion detection, time lapse, web streaming and more.


SecuritySpy

The software I'm going to use to turn a Mac into a surveillance system is SecuritySpy. It's an app that turns any Mac into a multi-camera video surveillance system. Among its many features include:

  • Full motion detection with customisable hotspots
  • Realtime or time lapse recording
  • Web streaming for access over the internet or local network
  • Compatible with a wide array of USB, FireWire and network cameras
  • Support for cameras with pan and zoom
SecuritySpy provides a fully-functional video surveillance system that runs on the Mac SecuritySpy provides a fully-functional video surveillance system that runs on the Mac SecuritySpy provides a fully-functional video surveillance system that runs on the Mac
SecuritySpy provides a fully-functional video surveillance system that runs on the Mac.

Licensing and Demo

SecuritySpy's licensing is based upon the number of cameras you want to use. SecuritySpy starts from $50 for a single-camera license, up to $832 for unlimited camera support.

I'll only be using one camera throughout this tutorial though as there is a 30-day free trial, you won't need to purchase any software in order to complete this tutorial. Be advised that some features covered may be disabled within the trial.

You can download a demo of SecuritySpy from Bensoftware.

System Requirements

The minimum requirements for SecuritySpy depend on what your expected usage will be. Thankfully, the developers provide a System Requirements Calculator that will estimate what your minimum requirements would need to be.

For example, using a single 1MP camera over USB2, with H.264 compression and recording at 10FPS would only require a Mac with at least a 1GHz PowerPC G4 processor. In this instance, you could find a very cheap (though old) Mac online to use as a dedicated video surveillance server.

Whether you have an old Mac handy or decide to purchase a used one, I'd recommend nothing less than an Intel Mac as a PowerPC Mac will be pushed much more, resulting in a noisier and hotter Mac.

For the purposes of this tutorial, I'm going to assume you will have an old Intel Mac that has probably reached the end of its useful life as a daily use computer.

Tip: Old MacBooks with damaged screens make perfect lightweight, headless servers. As long as you have a display you can temporarily connect it to, enable screen sharing and then you have a fully headless server you can use.


The Camera: Xbox Live Vision Camera

SecuritySpy works with a wide number of different types of camera, ranging from webcams to dedicated network-attached cameras. In fact, there are literally hundreds of different cameras that the app works with. All compatible cameras are listed on the Supported Camera List.

What isn't immediately obvious on this list is that any camera that is supported by Mac OS X without any additional software is also supported. This includes the built-in FaceTime camera of your Mac as well as any devices that support the USB Video Class of cameras.

There are many compatible USB webcams available for the Mac that fall into the above category, though the one I've chosen is the Xbox Live Vision Camera.

The Xbox Live Vision Camera is a capable USB camera that is natively supported by Mac OS XThe Xbox Live Vision Camera is a capable USB camera that is natively supported by Mac OS XThe Xbox Live Vision Camera is a capable USB camera that is natively supported by Mac OS X
The Xbox Live Vision Camera is a capable USB camera that is natively supported by Mac OS X.

Low Cost

This USB webcam was originally intended for use with the Xbox 360 and supports the USB Video Class standard. This means the camera isn't just compatible with SecuritySpy, it's compatible with our Mac without the use of any extra software or drivers, making it ideal for using with Skype or FaceTime if you have a desktop Mac without a built-in camera, such as a Mac mini or Mac Pro.

As for why I chose this camera, it's simple. This camera cost less than £1! It has long since been discontinued, replaced by Kinect, and was never a popular device to begin with. This has meant many retailers such as Amazon are just wanting to clear their stock. You can find this camera brand-new on Amazon for just $14, though I'd recommend picking up a used one. Retailers such as GameStop sell this camera as used for just $4.99.

Features

While the Xbox Live Vision Camera isn't the highest resolution camera available, it only supports 640x480 resolution, it does include a focus ring that lets you manually adjust the focus of the camera. Not many USB cameras do this and it makes it quite versatile, useful for both indoor use and looking out of a window.

What's more, because the camera is so cheap, you could by a couple of them to use at the same time with SecuritySpy. The camera includes a 3m USB cable and USB cables can be extended to a maximum of 10m. If you don't mind having some cables either running along the wall or in the ceiling, you're equipped to have a low-cost indoor security system.

Getting Started

Whatever camera you decide upon, make sure it is either listed on the SecuritySpy compatibility list or is natively supported by the Mac.

Now that we have our security software and camera decided upon, it's time to get started.

1. Connect Your Camera

Connect your USB camera and, if it's Mac compatible, it will be automatically detected. You won't be prompted or notified that a camera is connected, so the best way to test is launch Photo Booth.

If youre using a webcam or other camera designed for Mac OS X it should work fine with apps such as Photo BoothIf youre using a webcam or other camera designed for Mac OS X it should work fine with apps such as Photo BoothIf youre using a webcam or other camera designed for Mac OS X it should work fine with apps such as Photo Booth
If you're using a webcam or other camera designed for Mac OS X, it should work fine with apps such as Photo Booth.

If your USB camera is connected and working, you should begin to see whatever the camera sees. In this case, I've got the camera pointed out of my office window.

Tip: Photo Booth mirrors the image that is displayed in the camera so don't worry if the image appears to be inverted, that's the correct behaviour.

2. Install and Launch SecuritySpy

First, download the demo of SecuritySpy, open the DMG and drag the app to your Applications folder.

Once that's done, make sure that Photo Booth is quit and launch the SecuritySpy.

When you first launch SecuritySpy any compatible cameras are detected and displayed automaticallyWhen you first launch SecuritySpy any compatible cameras are detected and displayed automaticallyWhen you first launch SecuritySpy any compatible cameras are detected and displayed automatically
When you first launch SecuritySpy, any compatible cameras are detected and displayed automatically.

SecuritySpy will automatically detect any attached cameras and immediately begin displaying a live feed, along with a separate Camera Status window, displaying any motion it detects.


Configure Web Server Settings

SecuritySpy features a built-in web server to provide a video and audio stream, as well as access to saved footage, through an internet browser. With the right setup, you could access your cameras from anywhere in the world. Let's enable the web server so you can stream what you see over your network.

Tip: If you're not able, or wanting, to follow the tutorial but would like to see what the live feed is like, the developers of SecuritySpy have a live demo available by clicking here.

Step 1

Click on Settings > Web Server Settings…. From here, the web server preferences will open and you can begin setting it up how you want.

Accessing the web server settings is done via the menuAccessing the web server settings is done via the menuAccessing the web server settings is done via the menu
Accessing the web server settings is done via the menu.

Step 2

Check the Web server enabled on port… box and specify the port you'd like to use. I'd recommend leaving it on the default one for now, which is 8000. This port number will be required later on when you want to view the stream.

Theres a number of different options that can be customised depending on your requirementsTheres a number of different options that can be customised depending on your requirementsTheres a number of different options that can be customised depending on your requirements
There's a number of different options that can be customised, depending on your requirements.

The current address for the security camera web server is displayed in the lower-left corner. In my case, it's 10.0.1.30.

Step 3

As this is a security system, let's make it secure! Enable Password protection and then click Account Settings…. A further preference pane will open to manage users who have access.

Different users can be created with different access rightsDifferent users can be created with different access rightsDifferent users can be created with different access rights
Different users can be created with different access rights.

By default, there are no users enabled. Add a user by clicking Add User, then entering a username and password.

Make sure to provide the user with some privileges below, such as Receive live video. You can tweak the rest of the settings later but, for the purposes of this tutorial, you just need to be able to access the live stream.

Click OK to save the changes and click OK again to confirm the web server settings.

Step 4

Now to test if the web server is now working. On another device on the network (I'll be using an iPad), visit the address that SecuritySpy provided, followed by the port number. For example, my SecuritySpy web server address is http://10.0.1.30:8000 where the first part is my Mac's IP address and the port number is added to the end.

Once entered, you'll be required to enter the username and password you specified earlier.

Step 5

By now, you should be logged in and ready to start watching a live stream of your security camera. As SecuritySpy supports a number of cameras, you simply select the camera you want to view and then click View Live Images. If all goes well, you should see a stream of video from your Mac's attached video camera.

With the web server enabled I can view the camera via my iPad through SafariWith the web server enabled I can view the camera via my iPad through SafariWith the web server enabled I can view the camera via my iPad through Safari
With the web server enabled, I can view the camera via my iPad through Safari.

Port Forwarding

Something that goes beyond the scope of this tutorial is making this publicly accessible. Sites such as PortFoward provide great instructions no how to do this as it can vary wildly, depending on what type of router or internet connection you have.

Correctly configuring port forwarding will allow access to your Mac over the internet for the purposes of viewing the security cameras.


Configure Camera Settings

Now that you have a simple way of viewing our security cameras on another Mac or device, let's configure some of the recording settings.

Setup

While you could have the camera record video 24/7, that would cause your Mac's hard drive to fill up incredibly quickly, especially if you decide to use more than one camera. As you can see from the images I've provided, I live along a busy road. This means that the motion detector within SecuritySpy will constantly detect vehicles driving past, making it useless if I wanted my camera to detect and record if anyone entered the driveway.

By painting over the area of the video preview we can select what we want the motion sensor to ignoreBy painting over the area of the video preview we can select what we want the motion sensor to ignoreBy painting over the area of the video preview we can select what we want the motion sensor to ignore
By "painting" over the area of the video preview, we can select what we want the motion sensor to ignore.

Thankfully, SecuritySpy provides a way of "blocking" out areas of the video feed. By simply drawing on the camera preview, I can paint over the areas where I want SecuritySpy to ignore any motion.

As you can see, I've painted over the main road and across the street, only keeping the driveway and pavement immediately outside the house clear so that any motion will be detected.

Audio

As the Xbox Live Vision Camera has no built-in microphone and I'm using it to record outdoor footage, I have disabled this function. Only use audio recording when indoors and, even then, when absolutely necessary. Audio will add to the file size of any recordings you make so make sure to use it only when appropriate.

Continuous Capture

This section dictates how if SecuritySpy will constantly record video. To enable this function, check the box labelled Capture Continuous.

You can specify the frequency at which images are captured. A setting of 1 second between frames will mean a time lapse of 1 frame per second.

The higher the frames per second or lower the seconds per frame the larger the video files recorded will be The higher the frames per second or lower the seconds per frame the larger the video files recorded will be The higher the frames per second or lower the seconds per frame the larger the video files recorded will be
The higher the frames per second, or lower the seconds per frame, the larger the video files recorded will be.

If you have plenty of hard drive space and want to capture a constant video feed, set the capture frequency to 30 and change the method of capture from seconds between frames to frames per second. This will record a video feed but be warned, this will very quickly fill up your hard drive.

SecuritySpy is best used to capture a single frame within a given time period, the best being one frame per second. It's a good tradeoff between functionality and use of space.

Motion Capture

Now, while one frame per second / second per frame is a good tradeoff for general recording, you'll likely want full video recording if the motion sensor is triggered. After all, since you've blocked out any areas that you don't want the motion sensor to detect, the areas left are certainly ones you probably want to record in as much detail as possible if any movement is picked up.

Motion Capture will capture full video when triggered, all within a separate movie file. You can specify the FPS rate anywhere up to 30 for full motion video and recording will begin and stop only when motion is detected.

In addition to selecting areas of the image we want the motion sensor to ignore we can customise what happens when motion is detected In addition to selecting areas of the image we want the motion sensor to ignore we can customise what happens when motion is detected In addition to selecting areas of the image we want the motion sensor to ignore we can customise what happens when motion is detected
In addition to selecting areas of the image we want the motion sensor to ignore, we can customise what happens when motion is detected.

To enable this, select the tab Motion Capture and check the box labelled Capture movie when motion is detected. Set the frame rate to anything between ten and 30. Again, the higher the FPS, the bigger the video file generated.

In addition to capturing video, SecuritySpy will also be able to capture image files separately so that you have both video footage and images available. To enable this, check the box Capture image files when motion is detected.

Displayed on the Camera Status window is a motion sensor, showing how much motion is being detected. Should the meter rise above the red line for any length of time, SecuritySpy will proceed to record according to the settings you chose above.

Save Footage to Dropbox

SecuritySpy features built-in functionality to upload videos to an FTP server. For many, this is going to be a feature that isn't used all that often.

Instead, SecuritySpy can be altered to save any recorded video or images to a folder of our choice. To do this, head back to the Setup tab within Camera Settings.

SecuritySpy records video in QuickTime movie format and stores them in an organised way SecuritySpy records video in QuickTime movie format and stores them in an organised way SecuritySpy records video in QuickTime movie format and stores them in an organised way
SecuritySpy records video in QuickTime movie format and stores them in an organised way.

At the bottom of the main window, you'll see an option for Capture Destination. Click on Set… and then select a folder within Dropbox, or any other sync service, to save captured files there. Now whenever your Mac captures video footage, it will always be stored on Dropbox.

You can specify where youd like recordings to be saved to You can specify where youd like recordings to be saved to You can specify where youd like recordings to be saved to
You can specify where you'd like recordings to be saved to.

There are a few things to consider when doing this. First and foremost, make sure you're not recording full motion video. As I mentioned earlier with regards to file size, if they're too big then you'll just end up not only filling your Dropbox account but the files will be too large and take too long to upload.


Active and Passive Mode

Having configured some useful camera recording functionality, I need to actually start using it. SecuritySpy features an on/off switch that is, rather confusingly, called Active & Passive Mode.

You can toggle active and passive mode using the appropriate menuYou can toggle active and passive mode using the appropriate menuYou can toggle active and passive mode using the appropriate menu
You can toggle active and passive mode using the appropriate menu.

Basically, this just means whether it's recording or not. To enable the recording and motion detection, use the menu and select Control > Set all cameras to active mode. This turns on the recording functions and motion detection we have configured. You can stop recording and just preview what the camera is showing by using the same menu to select Control > Set all cameras to passive mode.


Scheduling

If you're using a camera to keep an eye outside and it isn't a night camera that supports IR, then it'd be pointless to have it recording if the lighting is dark and the camera can't detect anything.

The schedule lets you set when SecuritySpy will record and when it will drop down to passive mode The schedule lets you set when SecuritySpy will record and when it will drop down to passive mode The schedule lets you set when SecuritySpy will record and when it will drop down to passive mode
The schedule lets you set when SecuritySpy will record and when it will drop down to passive mode.

You can specify a recording schedule within SecuritySpy by using the menu Settings > Schedule settings…

To specify the times that SecuritySpy will run in Active Mode, use the cursor to draw in the times for each day. You can fine-tune the exact times (as it's quite hard to do simply using the cursor) with the time selection box at the bottom of the window.


Wrapping Up

By the end of this tutorial, you should have a fully functional Mac-based security system, capable of capturing footage, detecting motion and accessible over your network - not to mention saving footage to Dropbox!

SecuritySpy still has a lot of functionality and attempting to cover it all would take a long time to do. Instead, build upon what you've learned with this tutorial and explore the app in further detail and configure a security system that works exactly how you need it to.

I've been using SecuritySpy for a number of years simply for my peace of mind and it's an app that, although may take a little time to set up, will never require any continued interaction once it's set up properly. Once you've spent some time tweaking it to your exact needs, it can be simply left running for you to access.

Advertisement
Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.