Inhaltsverzeichnis

Raspberry Pi B+ als (Zeitraffer) Kamera

Quellen:

Basissystem

Kamera testen - einzelne Aufnahme auslösen

# get image directly from camera:
christoph@christophs-nb:~$ ssh pi@raspberry-test-wlan 'raspistill -o cam.jpg'; DATE=$(date +"%Y-%m-%d_%H%M"); scp pi@raspberry-test-wlan:~/cam.jpg $DATE.jpg

USB-Stick einbinden

sudo su
echo "/dev/sda1  /mnt/sda1               ext4    defaults,noatime  0       1" >> /etc/fstab

Bilder aufnehmen

pi@raspicam:~ $ cat time-laps.sh 
#!/bin/bash
#
#FOLDER=/home/pi/time-laps
#FOLDER=/mnt/sda1/time-laps
DATE=$(date +"%Y%m%d")
echo "DATE: $DATE"
TIMESTAMP=$(date +"%Y-%m-%d_%H%M")
echo "TIMESTAMP: $TIMESTAMP"
FILE=$TIMESTAMP.jpg
echo "FILE: $FILE"
FOLDER="/mnt/sda1/$DATE"
echo "FOLDER: $FOLDER"
 
if [ -d $FOLDER ]; then
 echo "Folder $FOLDER already exist!"
else
 mkdir $FOLDER
fi
 
echo -n "take a picture and store it to: $FOLDER/$FILE ... "
raspistill -o "$FOLDER/$FILE"
echo "done"

Automatische Aufnahmen via CRON Job

crontab -e
...
# execute every 5 minutes between 07:00 and 20:00 am:
*/5 7-19 * * *  /home/pi/time-laps.sh

Check crontab for user pi:

sudo su
cat /var/spool/cron/crontabs/pi

Aufnahmen vom Pi holen

christoph@christophs-nb:~$ DATE=20210408; mkdir $DATE; scp pi@raspberry-test-wlan:/mnt/sda1/$DATE/* $DATE/

Zeitraffer erstellen

ffmpeg -r 30 -pattern_type glob -i "*.jpg" -c:v libx264 -pix_fmt yuv420p -movflags +faststart timelapse.mp4