nook6
Posts: 5
Joined: Wed Jan 17, 2018 3:43 pm

fswebcam take photo save twice

Thu Mar 05, 2020 7:46 pm

Hi all

Im trying to take a photo with fswebcam and save it in the same place under two names (lol i think i need to explain)

Im taking a photo and i want to save it as webcam.jpg (so i can show it on webpage)
I also want to save the same photo under a different name so i have a copy of all the photos taken.

i have tried the following in a script and ran it every minute by cron BUT this only saves the webcam.jpg.

Its possibly something easy im over looking but any help would be appreciated thank you

Code: Select all

#!/bin/bash
fswebcam -r 1280x720 /var/www/html/webcam/webcam.jpg

DATE=$(date +"%Y-%m-%d_%H%M")
SLEEP(1)
 cp /var/www/html/webcam/webcam.jpg /var/www/html/webcam/webcam$date.jpg


Nook6

nook6
Posts: 5
Joined: Wed Jan 17, 2018 3:43 pm

Re: fswebcam take photo save twice

Thu Mar 05, 2020 9:10 pm

hi
thanks for looking but its now sorted found and article with this.

Code: Select all

DATE=$(date +"_%H%M%S")
fswebcam -r 1280x720 /var/www/html/webcam/webcam.jpg --scale 640x480 /var/www/html/webcam/webcam$DATE.jpg
tried its and working fine

Nook6

TheoPA3DSS
Posts: 29
Joined: Fri Nov 09, 2018 9:27 am
Location: Netherlands

Re: fswebcam take photo save twice

Fri Mar 06, 2020 2:22 pm

I use this script:

Code: Select all

#!/bin/bash
# Timelapse controller for USB webcam

DIR=/home/pi/timelapse

x=1
while [ $x -le 1440 ]; do

filename=$(date -u +"%d%m%Y_%H%M-%S").jpg

fswebcam -d /dev/video0 -r 640x480 $DIR/$filename

x=$(( $x + 1 ))

sleep 10;

done;
I got it from here https://www.makeuseof.com/tag/how-to-ca ... sb-webcam/
Anyway, i have changed it for myself a bit :)

Return to “Beginners”