There are some reasonably priced video surveillance products available on the market. If however you have a USB Web Cam and a Raspberry Pi (or equivalent or an old PC) you can make your own.
If you are working in the Unix world I would recommend motion , it’s super easy to setup and it’s got lots of added features if you want to turn them on. To install:
sudo apt-get install motion
Once you have motion installed you’ll need to tweek some of it’s parameters by:
sudo nano /etc/motion/motion.conf
The /etc/motion/motion.conf file contains a lot of cool parameters to tweek, some of the more important ones are:
# Image width (pixels). Valid range: Camera dependent, default: 352 width 800 # Image height (pixels). Valid range: Camera dependent, default: 288 height 600 # Maximum number of frames to be captured per second. framerate 1 # Maximum framerate for stream streams (default: 1) stream_maxrate 1 # Restrict stream connections to localhost only (default: on) stream_localhost off
The speed of your hardware and network will determine how many frames per second you can use.
To run the video server enter:
sudo motion
The motion package has a built in web server that is accessed by: http://your_ip:8081
Hardware Setup
There are lots of options for the mounting of your video server. I like to use Lego Pi cases about ($8) and then use some Lego to secure the rest of the components. Below is an example where I used a PIR (Pyroelectric Infrared) module ($3) to manually turn the motion software on/off, and I added a USB card reader to enable/disable the system.

Performance and Tuning
Ideally it would be nice to run at 24 frames per second (or better) to get smooth video action. Unfortunately I found that the Raspberry Pi 3 would often freeze up at this refresh rate with a USB camera. The linux command line tool vmstat can be useful to show your CPU and I/O status. Below is some sample vmstat output:
$ vmstat # Pi 3 video server at 24 fps procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 593552 17808 269856 0 0 41 57 803 180 7 1 74 18 0
The id is the idle time (74%), which isn’t bad. The problem however id wa, waiting for I/O.
You will have to do some trial and error to get a refresh rate that works best for you.
Port Forwarding
With the basic setup you will be able to access the video server from your local LAN/WAN. If however you want to access your video server from the Internet then you will need to allow a connection through your router to your video server, this is called port forwarding.
Unfortunately the configuration of port forwarding will vary from manufacturer to manufacture, so please see the documentation for your specific devices.