mercoledì, settembre 18, 2013

Timelapse video with raspberry and raspberry pi camera module

Today I did some tests with the raspberry camera module

First you need to decide how many photos you take and how often, in my test I've took a photos per minute for fours hours.
To do this, the command is very simple:

  1. raspistill -o name_%04d.jpg -tl 60000 -t 14400000

-tl = timelapse mode, takes a picture every <t>ms (60.000 is 1x60x1000ms) = 1 minute
-t = time before taking picture (14.400.000 is 4x60x60x1000ms) = 4 hours
name_%04d = will result filenames with sequential number.

See man raspistill for more options

When taking photos is over we need to merge them into a video:

  1. avconv -r 10 -i name_%04d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 videoname.mp4

-r = is a fps
-crf = is a quality video, lowers value = best quality = large file size, I think that 20 is a good value

With this parameters the file size result is 140 Mb (original size 2592x1944). If you want to resize a video use this option during video creation:

  1. avconv -r 10 -i name_%04d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 -vf crop=2592:1944,scale=1280:720 videoname.mp4

With crop option the file size result is 15 Mb, perfect for youtube

Posta un commento