Thursday, 11 February 2016

Beaglebone USB Webcam MJPG streamer

You might be thinking to stream video from your robot to your phone or laptop, or design a surveillance system like CCTV via beagle bone. So this post is for you. Here we will see how to install MJPG streamer on your Beagle bone and see its output on your WiFi enabled phone or other devices.
webcam
I am using Beaglebone Black Rev.C and Logitech C170 usb webcam. You can see a huge list of Raspberry Pi compatible peripherals list here. They are also compatible with BeagleBone. http://elinux.org/RPi_VerifiedPeripherals



Especially for webcams , http://elinux.org/RPi_USB_Webcams
So connect webcam using USB on beaglebone and connect miniusb of Beaglebone to you host PC. Login using SSH.
Then check first if the webcam is detected or not. For thatrun ‘lsusb’ command. and check whether detected or not.
The connect your beaglebone to internet via port forwarding on your Linux host PC.
Now lets install libraries needed to compile mpeg-streamer.
sudo apt-get install g++ curl pkg-config libv4l-dev libjpeg-dev build-essential libssl-dev vim cmake

sudo apt-get install imagemagick
Now we need to download mpeg-streamer.
wget https://github.com/shrkey/mjpg-streamer/raw/master/mjpg-streamer.tar.gz
So we will uncompress it now as it is in the tar.gz extension
tar -xvf ./mjpg-streamer.tar.gz
So now we are ready to compile it. So lets navigate to its folder and compile it.
cd mjpg-streamer

make

sudo make install

Now we are ready to proceed last step.
  ./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"
  MJPG Streamer Version: svn rev:
    i: Using V4L2 device.: /dev/video0
    i: Desired Resolution: 640 x 480
    i: Frames Per Second.: 5
    i: Format............: MJPEG
    o: www-folder-path...: ./www/
    o: HTTP TCP port.....: 8080
    o: username:password.: disabled
    o: commands..........: enabled
Now lets open this video on your browser using following address.
http://192.168.1.100:8080
That is nothing but the port 8080 on your beaglebone IP address assigned by your router.  You can press ‘ctrl+c’ to stop this streaming.
I appreciate and respect the work of ” www.shrkey.com ” for helping me for guidance of this tutorial. His efforts are valuable for this article.

No comments:

Post a Comment