- Created on 09 January 2014
- , Written by Calin Crisan
motionEye is a web frontend for a Linux video surveillance program called motion. This tutorial will walk you through the necessary steps to install and configure motionEye on a Raspberry PI. You will build yourself an intelligent video surveillance system based on afordable components and opensource software.
Special thanks go to Kenneth Lavrsen, the original author of motion, a great piece of software that does all the hard work for this project.
- web interface, responsive design
- user/password protection (administrator and normal user)
- mjpg streaming
- motion detection, output to jpeg and avi files
- timelapse capturing
- browsing, previewing and downloading of media files
- advanced camera settings
- a Raspberry PI
- a micro USB power supply (5V, 1A)
- an SD memory card (at least 4GB)
- an USB webcam or CSI camera board
- an USB WiFi adapter (optionally, if an ethernet connection is not available)
Installing The OS
Download the latest version of the Raspbian operating system. Here you'll find instructions on how to transfer the OS image to the memory card. Once the OS is on the SD card, boot your Raspberry PI. The commands presented with the following steps are to be executed exclusively in a terminal on the Raspnberry PI.
Before moving on, it is recommended that you update the packages on your system:
sudo aptitude update && sudo aptitude upgrade
Installing The Required Packages
motionEye requires a few libraries and extra programs. Install them with the following command:
sudo aptitude install python-tornado python-jinja2 python-imaging motion ffmpeg v4l-utils
Choose the latest version from the downloads list (use the Tags tab) and download it to /home/pi. Unpack (replacing xyz with the code in the filename):
cd /home/pi tar zxvf ccrisan-motioneye-xyz.tar.gz mv ccrisan-motioneye-xyz motioneye cd motioneye
After this step you'll have motionEye installed in /home/pi/motioneye, your current directory.
Create a settings.py file from the existing template:
cp settings_default.py settings.py
The default settings are good in most of the cases. If you wish to customize motionEye, you can later edit the settings.py file - you'll find a short description next to each of the available options.
CSI Camera Board
Follow this step only if you use the CSI Camera Board instead of a regular USB webcam.
- only a single camera module can be used with motionEye
- given the high resolution at which this camera can work, it is possible that the performance of Raspberry PI be not enough (processing of large images is CPU-hungry)
the uv4l driver
The camera module does not have a native v4l driver (at the time of writing). There is however a set of userspace components that emulate the v4l interface for such a camera module.
UPDATE: now it has :)
the bcm2835_v4l2 module
Append bcm2835_v4l2 to /etc/modules
sudo nano /etc/module
- make sure you run the latest version of the Raspberry PI firmware
- make sure you have enabled the camera module in raspi-config
- don't overclock your PI too much, using the camera module causes core overheating already
- allocate at least 64MB of RAM to the GPU
motionEye does not need root privileges to run; it can be started directly from the directory where it was extracted:
If everything was properly installed and configured, motionEye should emit an info message saying that the server started. Now point your browser to http://raspberrypi:8765 (replacing raspberrypi with the IP adress of your device). The motionEye web interface should show up. Use admin with no password, when prompted for authentication. Start by adding a new camera and feel free to experiment with the various available settings.
When you're done "experimenting", hit ctrl-c.
Autostarting At Boot
You'll probably want motionEye to start automatically at boot. Add the following line to /etc/rc.local (right before the exit 0):
sudo -u pi sh -c '/home/pi/motioneye/motioneye.py > /home/pi/motioneye/run/motioneye.log 2>&1' &
This will start the server with the user pi, put the log into motioneye.log and run the process in the background.
The motion daemon will be run automatically by motionEye - it should not run at startup.