Jcam - Java Webcam Server and Web Client

Author: Tony Murray
Email: tonymurray128@hotmail.com
SourceForge: sourceforge.net/projects/jcam
License: GPL License

 

The Skinny: JCam is a Java server that runs on linux and is linked to the V4L API by JNI (Java Native Interface). The web client, which is served up by a web server, connects to the server. Once they are conected the server starts a thread to capture the pictures from the camera then send it to each client. If there are no clients, the thread will stop. Thus, it wastes no CPU cycles (well probably a few, it is Java :-). The client can stop and start receiving images from the server at any time, that is if the server is running...

 

 

How to Setup: Install and configure Java SDK 1.4 or greater.

You will need to setup JV4L to get the webcam server to work. You can get it from Freshmeat. Thanks to Nicholas Christopher for creating this. This is also now included in the download.

Configure and make jv4l, then place the resulting libVideo4Linux.so somewhere like /usr/local/lib. Add the line LD_LIBRARY_PATH={path to library} to your /etc/profile file. (Thanks to Scott Jacobs) If you have ant just run 'ant makejv4l' then 'ant installjv4l' as root to install jv4l and complete this step for you.

Then place the CamClient.jar and the index.html files in your webroot. Update the index.html with the proper server address and you may want to consider setting scaleimage to true and experiment with the applet dimensions also.

Then simply start the server with the command: java -jar jcam.jar

Arguments:
-h Help with the command line options.
-c The JPEG quality % 0-100. The default is 60.
-t The delay between capturing pictures in milliseconds. The default is 1000 ms.
-s The socket number to wait for connections on. The default is 6787.
-m The maximum number of clients allowed to connect. 0=no limit. The default is 0
-f The name of the file or directory to use, mostly for testing purposes. To capture the picture from the camera as normal, do not specify this argument.

 

 

History: This project was created for a robot that I am working on. The robot is controlled by a java program running under linux and it was able to be remotely controled through the web. However I did not develop all of that software so it will probably never released, it's very specific anyway.

For the web client, each person needs a view through the webcam to control it remotely. Before, we were capturing a picture from the camera, saving it to a backup file then copying to the real file. Then each client would do a http get to get the picture. This was very inefficient, and we got many corrupted frames.

In comes jv4l, I found this and immediate thought, hey why don't I just have the java server send the pics directly from the cam to the client.

 

SourceForge Logo