This page is intended for anyone who wants to setup a simple camera capture and server for online access (viewing).While there are software packages that offer image and video grabbing, there are few that integrate it as a web server. webcam-server is a software project to view webcam images from a web browser. The browser requires a Java applet to run for the client, and thats about it! You will need to install: Standard development tools to compile C code: make, gcc, libjpeg Source code for webcam-server From my fresh install of Debian Linux with web server as install option: sudo apt-get install libjpeg If you have a Logitech camera you might need their drivers: sudo apt-get install qc-usb-source qc-usb-utils In the directory where you downloaded the webcam_server source code: tar zxf webcam_server-0.50.tar.gz cd webcam_server-0.50 ./configure && make Run the test to show if the video is being grabbed from device properly (as statistics). Your webcam light should also be on after this: cd src ./webcam_server -a Stop this process using Ctrl-C Run the server program as a foreground process of this terminal with: ./webcam_server Or as background: ./webcam_server & To run the client program, you first need to check if your web server works. Simply open a browser and visit (you will know if "It works"): http://localhost Go back to webcam server directory webcam_server-0.50 to copy the website page that you will be using, and change the default website page and permissions: cd src/client sudo cp * /var/www/ sudo mv /var/www/index.html /var/www/default_index.html sudo mv /var/www/webcam.html /var/www/index.html sudo chmod o+r-wx /var/www/* Open the website again to the same address http://localhost You should be seeing the webcam images at 1 FPS. If you can't then its possible you don't have Java installed for browser. Now edit the website file to the IP address or host name of your machine: sudo vim /var/www/index.html change localhost:8888 to your-ip-address:8888 or your-hostname:8888 e.g. 192.168.0.5:8888 or john.phduck.net.au:8888 you might want to change other options in this file, as the client is limited to those numbers. Now you should be able go to another computer type the address: http://your-ip-address or http://your-hostname ![]() Reducing CPU load for low FPSIf you are real pedantic about CPU resources you can edit the source code webcam_server-0.50/src/grabber.c This file is a separate thread that pulls image from the camera. Because I was satisfied with 1 FPS, then the grabbing rate can be reduced as well. All I did was add in a usleep(500000); // half a second after the optimal capture rate is computed in the while loop (kind of ironic there). This changed CPU usage on a Pentium M Dell Latitude X1 laptop with a Logitech for Notebook Pro USB webcam from 40% to 0%. Suffice to say it is so infrequent to grab the frame that it isn't noticeable. This was important because I intend to run this camera to stream out infrequent images (to the spying world) but still need to reserve the CPU grunt for Skype video calls (which requires around 60% CPU). |
People > John Stavrakakis >