Last active
June 11, 2022 11:15
-
-
Save graeme-winter/f0adeaaf50a372358ce1c24c5e003e73 to your computer and use it in GitHub Desktop.
Raspberry pi wildlife camera script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# any questions to my.name@gmail.com | |
TODAY=$(date +%Y%m%d) | |
START=${1} | |
HOURS=${2} | |
# how many ms to run | |
MS=$((3600 * ${HOURS} * 1000)) | |
# how many ms between frames | |
RATE=1500 | |
echo "Sleeping until ${START} then run ${MS} ms to ${TODAY}" | |
mkdir ${TODAY} | |
cd ${TODAY} | |
sleep $(( $(date -f - +%s- <<< "${START}"$'\nnow') 0 )) | |
raspistill -n -v -hf -vf -ex night -sa -100 -t ${MS} -tl ${RATE} \ | |
-l /home/pi/html/latest.jpg \ | |
-w 1640 -h 820 -o ${TODAY}_%05d.jpg 2>&1 | tee camera.log | |
N=$(ls ${TODAY}_*.jpg | wc -l) | |
python3 ~/bin/movify.py ${TODAY}_%05d.jpg 1 ${N} | |
mv out.mp4 ${TODAY}.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment