• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoLinux ApplicationsCreate Time Lapse Video using pcDuino3 with USB Ca ...
Previous Next

Create Time Lapse Video using pcDuino3 with USB Camera

Posted by: admin , August 28, 2014

Time is flying. Its fall already. We would like to create a time lapse video recording the season changes when tree leaves are still green to Colorado’s first snow.  Time lapse video consists of a serial of pictures that are taken at certain intervals. We install the pcDuino3 with the USB camera in our backyard:

0828_1 0828_2 0828_3 0828_4

 

 

Snapshot

The first thing we need to figure out is how to take a snapshot using pcDuino. Well, there are a number of ways. One way is to use fswebcam (which can be installed using ‘$sudo apt-get install fswebcam’).  We tried fswebcam. However, we got problem that sometimes the picture captured has a large area of dead pixels. So we use another snapshot tool ‘steamer’. It can be installed on pcDuino3 using:

$sudo apt-get install steamer

To  take a picture, simply use:

$streamer -f jpeg -o image.jpeg

Script to take snapshot and name it using time stamp

 

As each picture needs to be named sequentially using time stamp, we use a bash script as following:

#!/bin/bash

DATE=$(date +"%Y-%m-%d_%H%M")

streamer  $DATE.jpg

We name the newly created script as camera.sh. To make it executable, we need to do:

$chmod +x camera.sh

Repeatedly take snapshot at certain interval

To make time laps video, we need to take pictures repeatedly. pcDuino3 has a cron function to execute task at certain time. Please refer to cron post.

We use

$crontab -e

to add new task.

We would like to take the picture every minute, so we ddd the following line:

<code>* * * * * /home/ubuntu/camera.sh


</code>

After tens of minutes, we will get many pictures:

serialspicture

Make time lapse video

In the end, we would like to merge all these pictures into a video. We will use a tool called mencoder, which can be installed using:

$sudo apt-get install mencoder

There are so many picture. We can get the filenames by doing the following trick:

%ls *.jpeg > stills.txt

Then we execute mencoder as:

 

$mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o timelapse.avi -mf type=jpeg:fps=24 mf://@stills.txt

 

timelapse.avi is the video we want!

Tags: Linux Applications

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors