Welcome to another Raspberry Pi Post, This time we will get to know more about Motion, A highly configurable program that monitors video signals from many types of cameras. We will configure and Install MotionEye on Raspberry Pi raspbian stack, and see how to setup, record and activate motion services across your home or office.
What Is Motion/Eye?
Motion (Github) is a Unix CLI-tool to watch, record and manage multiple types of cameras under one roof. In Short it can :
- Create videos or save pictures of the activity
- Passthrough recording from many IP cameras
- View live stream of cameras
- Invoke scripts when activities occur
- Log activity into multiple types of databases
- Fully customizable masks for privacy or motion detection
- Full TLS(https) support with authentication for webcontrol and streams
MotionEye (Github) is a Web-Frontend written in Python. It sets up a very aesthetic view on a defined port, Which you can access over network via IP address or a Domain name.
Does MotionEye suffice your project requirements ?
MotionEye is a utility to collect video via different camera hardwares, It provides us with hitbox type of Motion Detection, Also it can send you notifications, Save video streams and control camera functions.
People often mistake MotionEye for a Computer Vision program, IT IS NOT. For facial-recognition, Speed tracking and object detection, OpenCV is what you want.
Installing MotionEye On Raspberry Pi :
We shall install Motion, Its repos and the GUI on our Raspbian stack on a Raspberry Pi 3B+. We have also set another Pi zero as a sleeper camera (Active Mediacenter) inside the house, And we have another IP Camera mounted outside the house. Assuming our Pi is updated, and we have root access by issuing
sudo -i,We start the installation progress :
apt-get install ffmpeg libmariadb3 libpq5 libmicrohttpd12
wget https://github.com/Motion-Project/motion/releases/download/release-4.2.2/pi_buster_motion_4.2.2-1_armhf.deb dpkg -i pi_buster_motion_4.2.2-1_armhf.deb
- Get the dependencies from the repositories:
apt-get install python-pip python-dev libssl-dev libcurl4-openssl-dev libjpeg-dev libz-dev
motioneye on Raspbery Pi, which will automatically pull Python dependencies (
pip install motioneye
- Prepare the configuration directory:
mkdir -p /etc/motioneye cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
- Prepare the media directory:
mkdir -p /var/lib/motioneye
- Add an init script, configure it to run at startup and start the
cp /usr/local/share/motioneye/extra/motioneye.systemd-unit-local /etc/systemd/system/motioneye.service systemctl daemon-reload systemctl enable motioneye systemctl start motioneye
8. To upgrade to the newest version of motionEye, just issue:
pip install motioneye --upgrade
systemctl restart motioneye
Setting Up MotionEye and our Cameras :
After completing the above steps, Our MotionEye on Raspberry Pi will be visible at IPofPi:8765, Like This :
When accessing the portal for the first time, You can use root as username and login, No password is necessary. Its a good choice to update it after log-in.
Go to Add Camera, and paste the address of the stream of your camera. Once successfully paired, Motion-eye will present you with dozens of options :
You can now enable Video Recording, Motion Detection and other features by following on-screen steps.
Congratulations on having a successful setup of MotionEye on Raspberry Pi, And a step towards making your home more secure.