What is it?The Raspberry Pi Camera Module can be programmed to take a series of photographs over a period of time. This creates a time lapse video of events that usually take a lot longer to complete and as humans, we would not normal see. If your Camera is not set up or installed, click here first, here
Installing the Stitching SoftwareBefore making or stitching together the individual photographs together software will need installing. This software will stitch the photos together and is very easy to use. A simple program called Mencoder, prepares, converts and exports the photographs into a video.
To install the Mencoder software type: sudo apt-get install mencoder Part 1: The -tl CommandThe time lapse camera feature code is broken down into several sections:
raspistill -o n00b_%5.jpeg -tl 100 -t 18000 raspistill -o n00b_%5.jpeg in this example the name of the files created will each called n00b, as it is my first attempt at time lapse photography! _%5.jpeg this command adds 5 decimal places to the file name, so creates files from n00b.00001 to n00b.99999, -tl 100 is the time in milliseconds to take a picture, ie every 100 milliseconds, every second -t 18000 is the total time that the camera will take pictures for, 18000 milliseconds, 3 minutes Part 2: Calculating the shooting timesThe tricky part is calculating the times and the number of photos that you want taken. In the example, I wanted to shoot for 3 minutes and take a photo every second. Because the times are in milliseconds the overall time needs calculating, 3(min) x 60 x 100 = 18000
18000 / 100 = 180, ie 180 photos will be taken in total. Therefore -tl = 100 and -t 18000, (the camera takes a picture every second for 3 minutes) Combining these elements together gives the code, raspistill -o n00b_%5.jpeg -tl 100 -t 18000 |
First AttemptIn this first attempt I shot a syrup bottle being turned upside down and the syrup falling to the top of the bottle. The whole process took 2 minutes and 31 seconds. The video below shows the process in just under 8 seconds.
Part 3: Create a Folder and CollateOnce up and running, the shots will soon fill up a folder. It is good practice to make a new folder to store the photographs in.
In the LX terminal type: mkdir pics This makes a new directory in the /home/pi folder called pics (replace with your folder name), then all the photos can be moved / copied into this new folder. Next, while in the LX terminal navigate to the new folder and create a list of all the files which will then be passed to the Menconder. Move to the new folder: cd /home/pi/name_of_your_new_folder Then create the list with the code: ls * .jpeg >timelapse.txt Part 4: Stitching it all TogetherThe last part of the project is stitching together all the photos. While you are still in the /home/pi/pics folder type the following code: (it is a handful!) All this goes in the LX terminal on the same line, as shown below, watch for all the colons, : the file is called myfirstvid but can be changed to a more suitable file name.
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080
-o myfirstvid.avi -mf type=jpeg:fps=24 mf://@timelapse.txt |
- Home
- Python
- Ras Pi
-
Pi Hardware
- Pi-Hacks
-
Pi-Hacks 2
- The Joker
- Hologram Machine
- Google Vision: Camera Tell
- Yoda Tweets
- Pi Phone
- Darth Beats
- Twitter Keyword Finder
- Crimbo Lights Hack
- Xmas Elf
- Halloween 2016
- Halloween Hack 2015
- Socrative Zombie
- Voice Translation
- The Blue-Who Finder
- GPIO, Twitter
- Pi Chat Bot >
- PiGlow & Email
- Pibrella Alarm System
- SMS with Python >
- Pi-Hacks 3
- Minecraft
- Computing
- Contact Me
- Random Hacks