Skip to content

Instantly share code, notes, and snippets.

@shantigilbert
Last active August 5, 2021 04:20
Show Gist options
  • Save shantigilbert/4391d25af284b65c04be5c0dd36648da to your computer and use it in GitHub Desktop.
Save shantigilbert/4391d25af284b65c04be5c0dd36648da to your computer and use it in GitHub Desktop.
Small script to create timelapses with the Raspberry Pi (Zero W) using Raspistill
#!/bin/bash
# Edit interval (in seconds), number of photos and arguments from raspistill --help
INTERVAL=5
NUMPHOTOS=10000
#ARGS="-n -vf -hf -w 1920 -h 1080"
ARGS="-n -vf -hf -w 2592 -h 1458"
DATE=$(date +"%Y-%m-%d_%H%M_%s")
SAVEPATH="/home/pi/camera/timelapse_${DATE}"
mkdir -p "${SAVEPATH}"
i=0
while [ ${i} -le ${NUMPHOTOS} ]; do
DATE=$(date +"%Y-%m-%d_%H%M_%s")
sec=$(printf "%02d" ${i})
raspistill ${ARGS} -o "${SAVEPATH}/${sec}_${DATE}.jpg"
((i++))
sleep ${INTERVAL}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment