Make a script like this called “save”. Make it executable.


if [ -f "ct" ]; then
ct=`cat ct`

ct=`expr $ct + 1`

mv snap.jpg snap-$ct.jpg
echo $ct > ct

Run “uvccapture -x648 -y480 -c./save -t20” to take a photo every 20 seconds.

Then you can use a script like this to continually re-encode it and send it to your webserver:

while true
rm out.mpg
cat snap-*.jpg | ./ffmpeg -f image2pipe -r 1 -r 20 -vcodec mjpeg -i - out.mpg
scp out.mpg [email protected]

You can get ffmpeg from here, and not deal with all the problems of library compatibility, if “apt-get install ffmpeg” doesn’t just work.

Leave a comment