In this lesson, we will install a web camera and video stream server in Raspberry Pi. After installation, you can use your browser to monitor surveillance video captured by your Pi camera. To do this, we need install an open source software called jpeg-streamer. Webcam function is quite useful in the robot control. It equipped your robot car with an eye!
If you want to know the details of jpeg-streamer installation and working principle, you can google the tutorial on how to jpeg-streamer software. You might find the configuration and installation procedure are quite boring.
To save your time, we make a quick shell script file. You can simply follow this tutorial and type some simple command to complete the installation in a couple of minutes.
CSI Web Camera Must be installed and connected CSI Slot with CSI ribbon cable
You also need to enable Camera in Raspberry Pi by typing following command
Then select ->5 Interfacing Options->P1 Camera->Yes->Ok->Finish
You need reboot your Pi to activate the setting.
Step 1) Type following command to install mjpeg-streamer software :
wget http://osoyoo.com/driver/picar/webcam.sh wget http://osoyoo.com/driver/picar/camstart.sh bash webcam.sh
After running above commands, mjpeg-streamer software is installed in your raspberry pi. So Simple!
Step 2)Start jpeg-streamer server in your Raspberry Pi
Run following command in your Pi terminal will start your mjpeg-streamer server
You will see following message in your terminal:
pi@raspberrypi:~ $ bash camstart.sh MJPG Streamer Version: svn rev: Unversioned directory i: Using V4L2 device.: /dev/video0 i: Desired Resolution: 640 x 480 i: Frames Per Second.: 30 i: Format............: YUV i: JPEG Quality......: 80 o: www-folder-path...: www/ o: HTTP TCP port.....: 8899 o: username:password.: disabled o: commands..........: enabled
These message means your video server is running at port 8899 in your Pi. Now we can use your browser to test the surveillance video.
Step 3) Find your Raspberry Pi IP address:
In your Pi terminal, type following command:
Your will see raspberry pi IP address as following:
pi@raspberrypi:~ $ hostname -I 192.168.0.32 2601:647:4b00:e80::1ef0 2601:647:4b00:e80:72a2:bfaa:719f:3e4
In above result, 192.168.0.32 is my raspberry pi IP address.
Now please visit http://your_raspberry_pi_ip:8899 (in my case http://192.168.0.32:8899), you will see following page:
click stream link or direct visit http://your_raspberry_pi_ip:8899/?action=stream, you will see the video surveillance.
DownLoad Url osoyoo.com