In this tutorial I am going to install Motion on to a Raspberry Pi Zero W so I can stream video from it’s camera to a mobile phone or tablet.
You will need:
- Raspberry Pi (I used a Zero W for it’s size)
- Network connection (WiFi dongle or on-board WiFi)
- Raspberry Pi Camera (or a compatible USB webcam)
- Power Supply
The first step is to get everything connected and to install the latest version of Raspbian. There are plenty of tutorials on this, so I wont bother explaining the process here.
Once you’ve logged in to Raspbian, open terminal and type the following to install Motion:
sudo apt-get install motion
Once that has installed, we need to edit the configuration file:
sudo nano /etc/motion/motion.conf
Scroll down the document and mimic these values:
The frame rate may need adjusting based on your network bandwidth. More frames result in smoother video, but requires more date throughput. If your network cannot cope with the higher bandwidth, it will result in jerky playback. 10 frames per second is quite low (TV is 25), but perfectly acceptable for my intended purpose.
The width and height refers to the size of the frame it streams, measured in pixels. If you’re using the Raspberry Pi Camera Module, using the values below should result in good video clarity and performance. If your camera supports HD, you could try something like 1280 by 720, but you may sacrifice performance for that added clarity.
Now save the file by holding Ctrl and pressing X. Press Y then return when asked if you want to save. Pop back into terminal and type:
sudo nano /etc/default/motion
and ensure you have:
Save your changes if you made any and in terminal, type:
sudo service motion start
The Raspberry Pi should now be streaming the camera feed. You can view it by typing in the IP of your Pi followed by the port specified for streaming e.g. 192.168.1.56:8081
You may want to use Kodi on the other end and use the stream as a video link to view it…