-
Notifications
You must be signed in to change notification settings - Fork 11
Timelapse
HerbFargus edited this page Oct 24, 2016
·
5 revisions
Just a simple how to on getting a timelapse working with a raspberry pi.
sudo raspi-config
Enable camera and reboot
mkdir camera
sudo nano /home/pi/camera.sh
#!/bin/bash
DATE=$(date +"%Y-%m-%d_%H%M%S")
raspistill -o /home/pi/camera/$DATE.jpg
sudo chmod +x ./camera.sh
crontab -e
* * * * * /home/pi/camera.sh 2>&1
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 6) (Sunday=0 or 7)
# | | | | |
* * * * * command to be executed
so for example if you wanted it every 10 minutes:
*/10 * * * * /home/pi/camera.sh 2>&1
navigate to camera folder:
ls *.jpg > stills.txt
Rename your files:
ls *.jpg| awk 'BEGIN{ a=0 }{ printf "mv %s image%04d.jpg\n", $0, a++ }' | bash
Install gstreamer:
sudo apt-get install gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-omx gstreamer1.0-plugins-bad
examples:
mp4
gst-launch-1.0 -v multifilesrc location=image%04d.jpg caps="image/jpeg,framerate=\(fraction\)30/1" ! jpegdec ! queue ! videoscale ! video/x-raw, width=1296, height=976 ! queue ! omxh264enc target-bitrate=15000000 control-rate=variable ! video/x-h264, profile=high ! h264parse ! mp4mux ! filesink location=todays_video.mp4
avi
gst-launch-1.0 multifilesrc location=image%06d.jpg index=1 caps="image/jpeg,framerate=24/1" ! jpegdec ! omxh264enc ! avimux ! filesink location=timelapse.avi
nonworking so far...
install libav-tools
sudo apt-get install libav-tools
create timelapse (adapt path to where your images are)
avconv -r 24 -f image2 -i /home/pi/camera/*.jpg -r 24 -vcodec libx264 -crf 20 -g 15 timelapse.mp4
sudo apt-get install mencoder
ls *.jpg > stills.txt
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mf type=jpeg:fps=24 mf://@stills.txt
this assumes all the image are the same dimensions and type, and all the files are named sequentially.
C:\Users\username\Desktop\TIMELAPSE_WORKING\PICTURES>C:\Users\username\Desktop\TIMELAPSE_WORKING\FFMPEG\ffmpeg-20161023-5867234-win64-static\bin\ffmpeg.exe -start_number 1 -i plant%d.jpg -c:v libx264 timelapse.mp4
- set a fake time on boot e.g.
sudo date -s "10 JAN 2016 0:0:00"
- set crontab to take image every x amount of time
- set crontab to run shutdown script after x hours