How to make a www camera

1. Install packages fswebcam wput

2. Make a ftp-account and folder to your web-server

3. Make a folder for pictures
mkdir ~/webcam

4. Check your webcam
ls /dev/video*

5. Make a script which takes pictures and upload pictures to your server. An example webcamera.sh:
…. the contens

#!/bin/bash

cd /home/username/webcam/ && rm latest.jpeg && fswebcam -d /dev/video0 -p YUYV -r 1600x1200 --jpeg 85 -D 2 -F 15 /home/username/webcam/$(date +\%Y\%m\%d\%H\%M).jpeg && sleep 3 && cp `ls | tail -1` latest.jpeg && wput -u -nc latest.jpeg ftp://the_ftp_user_here:the_ftp_password_here@ftp.your_domain_here

6. Make a scipt to run your webcam.sh continuously
…. the contents of runforever.sh

#!/bin/sh
while [ true ]
do
sh webcamera.sh
sleep 10
done

7. make the scripts executable
a+x runforever.sh
a+x webcam.sh

8. Make an index.html file which incudes auto refresh option and upload that index.html file to your webserver.

An example:

frefress code

Kuvakaappaus-1