You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
timelapse/client/timelapse.sh

43 lines
1.4 KiB

#!/bin/bash
#
# Exposure mode options : --exposure
# off,auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks
#
# Flicker avoid mode options : --flicker
# off,auto,50hz,60hz
#
# AWB mode options : --awb
# off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon
#
# Image Effect mode options : --imxfx
# none,negative,solarise,sketch,denoise,emboss,oilpaint,hatch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon
#
# Metering Mode options : --metering
# average,spot,backlit,matrix
#
# Dynamic Range Compression (DRC) options : --drc
# off,low,med,high
QUALITY=70
MODE=2
AWB="auto"
EXPOSURE="auto"
TIMEOUT=4000
RASPISTILL_OPTIONS="--mode ${MODE} --quality ${QUALITY} --encoding jpg --thumb none --nopreview --awb ${AWB} --exposure ${EXPOSURE} --timeout ${TIMEOUT}"
OUTPUT_DIR="/timelapse"
SNAPSHOT_DELAY=10
while [ 1 ]
do
DATE=`date +%Y%m%d-%H%M%S`
SEC=`date +%s`
TIME_VALUES=`/usr/bin/time -v raspistill -v ${RASPISTILL_OPTIONS} -o "${OUTPUT_DIR}/${DATE}_${SEC}.jpg" 2>&1`
TIME_USED=`echo "${TIME_VALUES}" | grep "wall clock" | sed 's/^.\+\([0-9]\+\):\([0-9]\+\.[0-9]\+\)\s*$/\1:\2/'`
min=`echo ${TIME_USED} | cut -d":" -f1`
sec=`echo ${TIME_USED} | cut -d":" -f2`
sleep=`bc << EOF
${SNAPSHOT_DELAY}-(${min}*60+${sec})-0.1
EOF`
sleep ${sleep}
done
echo "Exiting $0 at `date`"