Creating a Time-Lapse with Open Source Software

To make a time-lapse video in Ubuntu, we needed to gather many photos to compile into one video. To achieve this, I had to use the program avconv which runs from the terminal. The program is an audio and video converter that is pre-installed on your student laptop. I created a script and looped it so it takes photographs every few seconds.


Screenshot from 2016-03-08 09-28-03The command to capture photos is:

avconv -f video4linux2 -s 640×480 -i /dev/video0 -ss 0:0:2 -frames 1 /home/user/Desktop/CAMERA_SAVES/CAM_1/out.jpg

If you have more than one camera plugged then change /dev/video0 to video1, video2, etc.

You can also export the file to another directory as the desktop, just keep the file extension and file name.

Example of command changes:

avconv -f video4linux2 -s 640×480 -i /dev/video1 -ss 0:0:2 -frames 1 /home/user/Desktop/output.jpg

Screenshot from 2016-03-08 09-29-27This command is useful but there is one issue: when a photo is taken with this command, the original photo is over written. To create a time lapse, multiple photos need to be produced and merged into a a video editor to produce a time lapse video.


The script has been created to export a different file name every time the time changes, the output file is listed in seconds. Bash script download link here which can be edited for your needs: Script download

Enter the following command from the terminal with ./takepic_cam1.sh being the location of the script file. Replace 5 with the interval to take photos

watch -n 5 ./takepic_cam1.sh

The bash script can be edited by using the nano command:

nano ./takepic_cam1.sh


After letting the script run for about a day and a half taking a photo every 5 seconds it had generated about 11,000 photos.

Screenshot from 2016-03-08 09-34-38

Screenshot from 2016-03-08 09-35-16Screenshot from 2016-03-08 09-35-25

All the files can be exported into a video editor to create a time lapse video or a animated GIF.

snow

imgflip.com was used to create the gif.

This entry was posted in Applications. Bookmark the permalink.