Skip to content

How to Make a Timelapse Video from Images

Claude Pageau edited this page Jan 6, 2018 · 22 revisions

makevideo.sh uses avconv to create timelapse videos from images

How to Make a Video from Images

makevideo.sh script creates a timelapse video from motion or timelapse images. avconv is used to create an mp4 or avi timelapse video from the source jpg files in source folder (default is /home/pi/pi-timolo/timelapse). A temporary working folder is created since avconv requires consecutively numbered filenames. I often cull small images (very black or very white) so there will be gaps in the numbering. The soft links created in the working folder are created with consecutive numbering thus eliminating the need for the source folder files to have consecutive numbering.

See How to Run and Edit Settings

Edit video.conf Settings

Use nano editor to change the makevideo.sh script variables per code comments.

cd ~/pi-timolo
nano video.conf

Edit video.conf Settings

ctrl-x y to save changes and exit nano editor

IMPORTANT - The variable tl_delete_source_files=true will delete source files (except the most recent) after encoding. Per code comments use this option with Caution.
For Details see GitHub Code here makevideo.sh

How to Run makevideo.sh

To run makevideo.sh

cd ~/pi-timolo.py
./makevideo.sh

This will use avconv to create a video from the images in the designated source folder. default is media/timelapse.

Copy Archive Video to a Network Share

To manage local device storage space, makevideo.sh has an option to copy/move the encoded video to a network share mount folder or alternatively a locally attached USB storage device eg thumb drive or external disk. The specified folder must already exist. If it is a network share in must be mounted with read/write permissions per example below for window share setup with read/write permissions.

cd ~/pi-timolo
mkdir mnt
sudo mount -t cifs -o username=loginname,password=password,uid=pi,gid=pi //serverIP/sharename ./mnt

Add an /etc/fstab entry to connect share at boot time.

See detailed wiki instructions regarding creating network and device mounts here

How to Automate makevideo.sh

You can run makevideo.sh in a crontab

sudo crontab -e

Then add a crontab entry per example below to run makevideo.sh as pi user every day at 10 pm. ctrl-x y to exit and save changes

0 22 * * * su pi -c "/home/pi/pi-timolo/makevideo.sh > /dev/null"
# Optional start of sync.sh and convid.sh 
# */5 * * * * su pi -c "/home/pi/pi-timolo/sync.sh > /dev/null"
# */1 * * * * su pi -c "/home/pi/pi-timolo/convid.sh > /dev/null"

ctrl-x y to exit nano and save changes

For Details see Github code here makevideo.sh

How to Convert h264 Video to MP4

Clone this wiki locally