In the first part of this tutorial you learned how to configure your webcam with Arduino Yun and how to capture static images; today you’ll learn how to change the image resolution and how to watch the video stream in realtime…
Sometimes using fswebcam I got “ruined” images like the following one:
I was able to solve the problem using the –skip n option that tells fswebcam to skip the first n images from the webcam before capturing one:
Every webcam supports a fixed number of resolutions (= the number of pixels that form the image).
You can find the supported resolutions using a couple of Linux commands:
- first get the numeric ID (VID and PID) of your webcam with lsusb:
- then display the details of that device with lsusb -d 045e:0779 -v (change the ID with your one). EachVideoStreaming Interface Descriptor section contains one supported resolution:
- Using grep you can filter out only the resolutions list:
fswebcam has the -r option to specify the desired image resolution (widthxheight):
And the result:
In addition to capturing still images, we can use our Yun to display a video stream transmitted over the network.
Among the solutions available for Linux, I chose to use mjpg-streamer (official site), an application that is able to capture video from your webcam and make it available via a web interface.
The installation package for mjpg-streamer is not yet available in the official Linino repository, but thanks to two users of the Arduino forum (fibasile that compiled it and MadScience that made it available on his website) you can however install it:
move to the /tmp folder and download the package using wget:
install the package with opkg:
opkg install mjpg-streamer.ipk
Edit the /etc/config/mjpg-streamer file and change the enabled option to 1. In the same file you can change also resolution, frame rate…:
Now you can start the program:
Point your browser to the Yun’s IP Address and to port 8080 to open the web interface of mjpg-streamer:
Choosing the Stream menu item you can watch the live video coming from your webcam:
For more details,please refer to original post
Leave a Reply
You must be logged in to post a comment.