time elapse video with raspberry pi camera module (RP_OV5647) [raspberrypi]

maybe try motioneyeos instead of this tutorial (cause it is easy and has lot of features):

this is outdated, have a look at my newer tutorial at:

install this software:
sudo apt-get update
sudo apt-get install -y imagemagick libav-tools #mencoder
#for time elapse not avaliable in jessi use libav-tools instead

time elapse of 1h in a video of 30 sec with 24fps

make some folders:
mkdir /home/pi/cam
mkdir /home/pi/cam/time_lapse

make a record script:
touch /home/pi/cam/time_lapse/a_record.sh
chmod +x /home/pi/cam/time_lapse/a_record.sh
nano /home/pi/cam/time_lapse/a_record.sh

echo --------------------- >> /home/pi/cam/time_lapse/camlog.txt
echo start taking pics
(date "+%H:%M:%S--%d.%b.%Y start taking pics") >> /home/pi/cam/time_lapse/camlog.txt
raspistill -w 1280 -h 960 -o /home/pi/cam/time_lapse/img_%05d.jpg -tl 5000 -t 3600000 -hf -vf
echo add date to pics
(date "+%H:%M:%S--%d.%b.%Y add date to pics") >> /home/pi/cam/time_lapse/camlog.txt
for file in /home/pi/cam/time_lapse/*.jpg ; do
   convert "$file" -pointsize 72 -fill white -annotate +100+100  \
      %[exif:DateTimeOriginal] "${file}"
	echo "add_date $file"
echo generate video from pics
(date "+%H:%M:%S--%d.%b.%Y generate video from pics") >> /home/pi/cam/time_lapse/camlog.txt
#mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1280:960 -o /home/pi/cam/time_lapse/$(date "+%H-%M-%S--%d-%b-%Y").avi -mf type=jpeg:fps=24 mf:///home/pi/cam/time_lapse/*.jpg
avconv -r 10 -i /home/pi/cam/time_lapse/img_%05d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 /home/pi/cam/time_lapse/$(date "+%H-%M-%S--%d-%b-%Y").mp4
echo remove old pics
(date "+%H:%M:%S--%d.%b.%Y remove old pics") >> /home/pi/cam/time_lapse/camlog.txt
rm /home/pi/cam/time_lapse/*.jpg

start the script with:

now you can download your video from the folder /home/pi/cam/time_lapse/

you do not want to be connected over ssh all the time?
use screen:
sudo apt-get install screen -y

start process with screen:
screen -dmS longrun sh -c 'echo hihi;/home/pi/cam/time_lapse/a_record.sh'

get back screen session:
screen -S longrun -x
screen -d -r longrun

detach screen session:
ctrl+a d

quit screen session inside the session:

quit screen session outside the session:
screen -S longrun -X quit

trigger the video time elapse script on start:
crontab -e
@reboot screen -dmS longrun sh -c 'echo hihi;/home/pi/cam/time_lapse/a_record.sh'

have a look at the pics from commandline with:
sudo pip install Shellpic #very usefull to watch images when only connected over a ssh client to the pi

to watch the video remote on a linux computer:
ssh -X pi@192.168.1.x
mpv file.mp4

maybe have also a look at:


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s