Using motion to stream image from a webcam
Motion is probably best capturing software if you need to store and stream image from webcam connected to your Raspberry Pi. It don’t consume much ram and it is fully configurable. To install it on Raspbian simply run as root that command:
apt-get install motion
Ok, we’ve got it installed. Now it requires little configuration. Edit /etc/motion/motion.conf with your favourite text editor (I use nano). Everything there is clearly described so I’ll show here only the most important options and describe some of them.
Motion should automatically detect your video device, if you’ve got more than one connected to RPI change that value. To check all of them type:
- width and height
These values are based on parameters of your webcam.
If you want to stream image slower than 2 fps put there value that in equal to number of seconds you want to wait between every capture.
That is useful only for those who want to keep not only images but also video. I turned it off on my device. To use it you’ll need to have ffmpeg installed.
Location where motion will store its files. I strongly recommend to change default setting because /tmp on Raspbian is mounted on smaller partition (about 60MB). /tmp is also automatically cleaned during every booting so if you can easily lost your photos.
Set it to off to be able to connect from another computer.
You can use that to manage motion from another computer without editing motion.conf.
Save file (if you’re using nano press ctrl + x). Now type in console:
After that you should be able to connect to it with your browser. Just type its address and port, for example: