Today we will see how to run, on Arduino Yun, a webcam protocol compatible UVC (virtually every recent webcam supports this protocol).
First, install the sftp to read and write files into the Arduino Yun. From SSH do the following commands:
opkg update opkg install openssh-sftp-server
Now we can access via SFTP with the same username and password that we used for the SSH to our Arduino Yun. For example I used FileZilla.
Then proceed with the installation of the driver to handle the webcam.
opkg update opkg install kmod-video-uvc opkg install fswebcam
Extract the files and place them with sftp in the annex for example in the /www/webcam/ . Position itself in this folder with cd /www/webcam/ and do the following command to install the mjpg-streamer :
opkg install mjpg-streamer_r148-4_ar71xx.ipk
Now you can connect the webcam with USB cable. If you have problems with the following commands reboot and try again with the following commands.
To view the current snapshot you must do:
mjpg_streamer -i "input_uvc.so -d /dev/video0 -y" -o "output_http.so"
It allow you to use the browser and, for example in my case, from http://192.168.1.10:8080/?action=snapshot you can view a snapshot in real time, if you refresh the page you can get a new snapshot. This method have the best image quality!
Another way to save an image is to use fswebcam. If you want to save on the /www/ you must do it:
fswebcam --device /dev/video0 --input 0 --resolution 640x480 --jpeg 95 --save /www/viewcam.jpg --palette MJPEG --no-banner
Another way to save images is to use a config file such as .fswebcam.conf with this content:
device /dev/video0 input 0 loop 15 skip 20 background resolution 640x480 set brightness=60% set contrast=13% top-banner font /usr/share/fonts/arial.ttf title "ArduinoYunCAM" timestamp "%d-%m-%Y %H:%M:%S (%Z)" jpeg 95 save /www/viewcamC.jpg palette MJPEG
And to use it go in the same directory and run:
fswebcam -c .fswebcam.conf
Other information are on:
- WebCam: Using mjpeg streamer to stream video over HTTP
This is all for today...stay tuned to the next post, it will be about leds strips!
PS: If anyone have a problem with mjpg-straemer, my configuration file /etc/config/mjpg-streamer is:
config mjpg-streamer core option enabled true option device "/devices/platform/ehci-platform/usb1/1-1/1-1.1/1-1.1:1.0/input/input1" option resolution "640x480" option fps "5" option www "/www/webcam" option port "8080"
Another tips is to do:
/etc/init.d/mjpg-streamer enable /etc/init.d/mjpg-straemer start