The Raspberry Pi’s lightweight, compact properties mean it can be used as a hidden camera when combined with the popular camera module and portable battery. With that in mind, I recently shot five amazing time-lapse videos. You can too.

What will you need

To get started with slow motion on your Raspberry Pi, it’s a good idea to prepare your device by finding a waterproof, weatherproof, and maybe even rugged Raspberry Pi case. You can find something suitable on Amazon. Make sure it has room for the camera and clearance for the lens. If such a case is not currently available, consider a closed case with no slots to access GPIOs, etc.

Next, you’ll need a battery to make the Pi portable. You can do it yourself. or buy a compact battery. I used one from RAVPower (UK) which gives you 36-48 hours on a full charge.

In addition, you’ll need a tripod (the type designed for smartphones should be ideal) and extra duct tape to protect the Pi in certain circumstances.

Time lapse and Raspberry Pi in place

We’ve covered various ways to use the Raspberry Pi camera module in the past, and setting the time lapse is surprisingly easy.

Since then, however, things have gone a little further. For this project, we will use the command raspistill which is included in the latest versions of Raspbian Jessie :

raspistill -t 30000 -tl 2000 -o image%04d.jpg 

The options specify a timeout (-t) after 30 seconds (30000 milliseconds) and an interval (-tl) of 2 seconds between each frame (2000 ms). Each image will be saved in the current folder with filenames in the image000x.jpg format as specified in the image%04d.jpg condition. This calculator can help you get the right numbers.

By default, the camera takes pictures at a resolution of 2592 x 1944, and the resulting image is about 2.5 MB each. For a few hours of time-lapse, this can be a bit of a strain on your Pi. Therefore, it is recommended to specify a slightly lower resolution. So the command can read

 raspistill -t 30000 -tl 2000 -o image%04d.jpg -w 1280 -h 960 

All I’ve done — and all you’ll need to do — is adjust the script’s timeout and timeslot conditions to match the specific script.

Remote connection to Raspberry Pi

If you are using your Raspberry Pi outside and outside of your home network, you will need to set up a dedicated network to connect to your Pi from your smartphone via SSH. This is the best way to start capturing time-lapse images remotely; You can use an ad hoc network with a laptop if you like, but a smartphone or tablet is more portable.

Several options are available here, but the most reliable is to use an Ethernet cable and SSH.

You will now be able to directly connect to your Raspberry Pi via SSH, making slow motion shooting a lot easier. Alternatively, you can use a script and a Python button, as explained in our stop motion studio tutorial

If any of this seems like too much work, you can always rely on a standard SSH connection over a wireless network to start capturing the time lapse and then bring the Pi to its intended location. As long as your battery has sufficient life and you have specified a suitable duration in the burst script, everything should go well. Before compiling images as videos (see below), just discard the ones you don’t need!

At this point, you can exit and start setting up and capturing your footage. Read on if you’re short on ideas, but first we’ll walk you through the process of fixing images and turning it all into a video.

Viewing time spans

If you create images every five or ten seconds for an hour or more, you will probably have a lot of these images. Please note that by default they are in high resolution. This means they eat up space on your Raspberry Pi very quickly. Thus, it is a good idea to limit yourself to one film project at any one time. Once you’ve finished capturing, create a movie (see below) and delete the original shots.

For now, you only have pictures. You will need to edit them together into a video file.

Start by looking at the images and make sure they are oriented correctly. If not, you can use the ImageMagick software to rotate them as needed.

 sudo apt-get install imagemagick for file in *.png; do convert $file -rotate 90 rotated-$file; done 

This will rotate every image in the current directory 90 degrees clockwise. In some cases, I had to rotate .JPG files counterclockwise by 90 degrees:

 for file in *.jpg; do convert $file -rotate -90 rotated-$file; done 

Create a slow motion video

Once that was done, I removed the original files and used the avconv software to create a video file compiling each shot into a video. You will find avconv as part of the libav-tools package.

 sudo apt-get install libav-tools avconv -r 10 -i rotated-image%04d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 -s 1280x720 timelapse.avi 

The above command specifies the filename format for the images (image%04d.jpg), codec (-vcodec), compression quality (-crf) and of course the filename for the generated video. It will also resize to a resolution of 1280 x 720 — very important if you are compiling videos on a Raspberry Pi as it will take a long time to keep the default HD resolution. You will also find that it is resource intensive, so choose the lighter option. Or copy the images to a PC and create an AVI file there.

(For example, FFMPEG is available for Windows. After copying images using and installing FFMPEG, you must copy open a command prompt window in the images folder (in Windows Explorer, select File > Open Command Prompt ) and enter something like:

 ffmpeg -r 15 -start_number 0001 -i image%04d.jpg -s 1280x720 -vcodec libx264 outputfilename.mpg 

Doug’s world will give you a great explanation of all this.)

With the output movie created, use something like omxplayer to play the finished file. VLC Player should also work just fine, especially if you’re making videos on Windows.

Time lapse ideas

1. Watching the clouds

For starters, I decided to take advantage of my immediate surroundings. This meant I would head to the back of the garden and set up my Raspberry Pi to watch the constant activity over a nearby industrial plant. Clouds, flames, steam and more is the place of industrial recycling and waste disposal.

And ducks.

I used a 10 second interval for this capture and left a time interval of six hours.

2. Driving in my car

It’s amazing how many miles we travel on the road and how boring the whole process seems. I mounted the Raspberry Pi on a smartphone tripod and then hung it under the rearview mirror to get the following effect.

This was my first mobile attempt and it didn’t take as long as I would like. The interval should be shorter and the total length longer for a smoother result. Here I used a 3 minute timeout and shot every 10 seconds.

3. Shadows, breaking bad style (or not)

This time I decided to capture the movement of the shadows on a (sufficiently) sunny day. To do this, I set up the «pi» and the battery on a pole in the garden and pointed to the deck. It captured the movement of the shadows, despite the breaks from the clouds.

Dissatisfied with focusing on previous videos (stuck in portrait mode), I found that I needed to add the option -rot 90 to the team raspistill to get a landscape picture.

Watch the end of the video where you will see rainwater accumulating on the table. The danger of living in North Yorkshire and waiting for the weather to do what you want!

It was calculated for several hours, from morning to noon. I set a 10 second interval to match the fixed camera position… and then I pulled the project when it was raining!

4. time lapse, baby

What do children do when they are not noticed? Obviously walking isn’t that much, but how much do they move their limbs or fight the pacifier?

To find out, I set my young daughter up for this slow motion video, using a smartphone tripod to safely mount the Pi on the back of our sofa.

It ran for 35 minutes with a five second delay with a shutter speed set to 30000 (-ss 30000) due to low light.

5. Every day people drink coffee.

Have you ever wondered how busy (or not) you are in a cafe? I decided to take my trusty Raspberry Pi to a local chain of coffee shops and spend some time observing the behavior of the patrons. How much tea and coffee will they drink?

Did they sit for a long time, or did they make the purchases more important? The answer is right here. We ran this period of time just under an hour with an interval of 10 seconds.

I found five obvious time-lapse photographic projects. I’m sure you can do better. Show us what you can do in the comments!

Похожие записи