View Single Post
Posts: 59 | Thanked: 71 times | Joined on Sep 2009 @ Brazil
#8
I'm glad you liked it... but the first version I posted doesn't work well with higher resolutions. In fact, it reseted my device when I tried to capture images slightly larger than 900 lines...

I found out a better pipeline and improved the script a bit. It's still rough and there's very little error checking, but still, it's better than nothing. :P

Code:
#!/usr/bin/perl -w

# A simple intervalometer for the Nokia N900.
# Author: Ricardo Mendonca Ferreira - ric@mpcnet.com.br
# http://talk.maemo.org/showthread.php?t=38275

# This script requires gstreamer installed on your N900.
# See the link above for more info.
# Run this script on an X Terminal in your device with:
#   perl intervalometer.pl

# 2009.12.17  First version.
# 2009.12.24  Better gstreamer pipeline; more options, with better descriptions.

use strict;

#---- CONFIG SECTION ---- [BEGIN] ----

 my ($x,$y) = (640, 480);               # image resolution - try (2592, 1968)
 my $cam    = 0;                        # camera: 0 = back, 1 = front
 my $dir    = '/home/user/MyDocs/test'; # folder where images will be saved
 my $max    = 10;  # total number of images to take
 my $delay  =  5;  # interval between pictures

#---- CONFIG SECTION ----  [END]  ----

die "$dir not found!\n" if !-d $dir;

my $gst = "/usr/bin/gst-launch v4l2camsrc device=/dev/video$cam num-buffers=1 ! ffmpegcolorspace ! video/x-raw-yuv,width=$x,height=$y ! jpegenc ! filesink location=";

my $num=0;

print "Intervalometer started - will take $max pictures at $x x $y\n";

while ($num < $max) {
	$num=sprintf'%05d',$num;
	`$gst$dir/$num.jpg`;
	printf "saved %d of %d", $num+1, $max;
	$num++;
	if ($num < $max) { print " - sleeping $delay sec."; sleep $delay; }
        print "\n";
}
And BTW, Merry Xmas to all!
 

The Following 19 Users Say Thank You to Ricardo For This Useful Post: