Setting up linux webcam server Juho Launonen & Sami Kulmala
At the beginning we... Created new virtual machine with default settings and linux debian distro Installed apache and loads of other stuff Connected webcam Got nice feed from the camera Tried to set up the server
Then the problems started It appeared that the v4l (video for linux), which is a video capture application programming interface for Linux, did not work for us at all That's when the shit hit the fan Nothing was working properly and we were desperate After 16 hours and thousands of useless attempts it was time to start all over again with a new distro...
Installing Ubuntu
So... Ubuntu server was succesfully installed with GUI Apache was installed sudo apt-get install apache2 Webcam server package sudo apt-get install webcam-server
Configuration We had to make startup script for the webcam server so that we could control it as a daemon and start it at startup We made the following script to the /etc/init.d directory...
#!/bin/sh SERVER_BIN=webcam-server LOCK_FILE=/var/lock/$SERVER_BIN RTRN=0 OPTIONS='-v -g 640x480 -p c JUMI' start() { [ -f $LOCK_FILE ] && echo "$SERVER_BIN already started" [ -f $LOCK_FILE ] && return echo -n "Starting $SERVER_BIN: " export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so nohup $SERVER_BIN $OPTIONS > /dev/null 2>/dev/null & RTRN=$? [ $RTRN -eq 0 ] && echo Started! || echo FAIL [ $RTRN -eq 0 ] && touch $LOCK_FILE } stop() { [ -f $LOCK_FILE ] || echo "$SERVER_BIN is not running" [ -f $LOCK_FILE ] || return echo -n "Stopping $SERVER_BIN: " pkill -f "$SERVER_BIN $OPTIONS" RTRN=$? rm -f $LOCK_FILE [ $RTRN -eq 0 ] && echo Stopped! || echo FAIL } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|restart}" RTRN=1 esac exit $RTRN
Configuration With following commands we made the startup script run when Ubuntu starts up sudo chmod +x /etc/init.d/webcam-server sudo update-rc.d webcam-server defaults Now everything was ready for a little test so we started the webcam server sudo /etc/init.d/webcam-server start
IT'S WORKING! Juho was pretty scared when he realized that
Webcam stream to a webpage To use the webcam stream on a webpage we had to copy the necessary java files to our webroot sudo cp /usr/share/doc/webcam- server/applet/* /var/www/ Then we made webpages with following applet for the camera :8888">
That's it! Now lets see that amazing site!