WISRD Research & Engineering Journal

● In this method of giving a file a name it automatically puts the date and the time on file. This can be used for pictures, timelapse, and videos. Put this in the name portion of your command to have the pi automatically name your file with the date, and the time down to the second. Here is an example of a picture code. raspistill -o SOME-DIRECTORY/DATE=$(date +%Y-%m%d_%H%M%S).jpg Compressing the photos into videos: ● There are two commands that can be used to compress photos into a timelapse video, the first command: ls *.jpg > stills.txt ● It simply lists all the jpg files in the current directory into a text file called stills.txt in order of their name(make sure to run it in the directory of the time-lapsed photos) ● This is the second command: mencoder -nosound -ovc lavc -o tcam.avi -mf type=jpeg:fps=24 mf://@stills.txt ● It uses a piece of software called mencoder (which you have to install with this command: (```sudo apt-get install mencoder`) to compress the pictures listed in the stills.txt (in the order that they are listed) into a video file called tlcam.avi. Make sure to run in the same directory as the still.txt file. The value in bold (in our case 24) is the frames displayed per second in the video. This means that if plays 24 of the our photos taker per second Doing it all in one Script: ● You could put these commands that compress the photos into video, at the end of a python or shell script that takes the photos so that you only have to run one script that takes the photos and compresses them. Here is an example python script that takes the photos and compresses them: import os import time FRAMES = 1000 TIMEBETWEEN = 6 frameCount = 0 while frameCount < FRAMES: imageNumber = str(frameCount).zfill(7) os.system(“raspistill -o image%s.jpg”%(imageNumber)) frameCount += 1 time.sleep(time between - 6( #Takes round 6 seconds to [url][/url] take a picture os.system(ls *.jpg > stills.txt)

69

Made with FlippingBook Online newsletter creator