Setting up linux webcam server Juho Launonen Sami

  • Slides: 11
Download presentation
Setting up linux webcam server Juho Launonen & Sami Kulmala

Setting up linux webcam server Juho Launonen & Sami Kulmala

At the beginning we. . . Created new virtual machine with default settings and

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 v 4 l (video for linux),

Then the problems started It appeared that the v 4 l (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 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

Installing Ubuntu

So. . . Ubuntu server was succesfully installed with GUI Apache was installed sudo

So. . . Ubuntu server was succesfully installed with GUI Apache was installed sudo apt-get install apache 2 Webcam server package sudo apt-get install webcam-server

Configuration We had to make startup script for the webcam server so that we

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 640 x 480 -p 8888 -c JUMI' start()

#!/bin/sh SERVER_BIN=webcam-server LOCK_FILE=/var/lock/$SERVER_BIN RTRN=0 OPTIONS='-v -g 640 x 480 -p 8888 -c JUMI' start() { [ -f $LOCK_FILE ] && echo "$SERVER_BIN already started" [ -f $LOCK_FILE ] && return echo -n "Starting $SERVER_BIN: " export LD_PRELOAD=/usr/libv 4 l/v 4 l 1 compat. 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

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! http: //localhost: 8888/ Juho was pretty scared when he realized that

IT'S WORKING! http: //localhost: 8888/ Juho was pretty scared when he realized that

Webcam stream to a webpage To use the webcam stream on a webpage we

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/webcamserver/applet/* /var/www/ Then we made webpages with following applet for the camera <APPLET CODE = "Web. Cam. Applet. class" archive="applet. jar" WIDTH = "640" HEIGHT = "480"> <param name=URL value="http: //<OUR_IP>: 8888"> <param name=FPS value="60"> <param name=width value="640"> <param name=height value="480"> </APPLET>

That's it! Now lets see that amazing site!

That's it! Now lets see that amazing site!