Skip to content

Commit

Permalink
a helper program for processing timelapse videos from gopro sd cards.
Browse files Browse the repository at this point in the history
  • Loading branch information
gugod committed Apr 25, 2016
1 parent bd32937 commit afef13a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions gopro-build-timelapse-video.pl
@@ -0,0 +1,31 @@
#!/usr/bin/env perl
use v5.18;
use strict;
use warnings;

use File::Basename 'basename';
use List::MoreUtils 'uniq';

my $output_dir_base = "/tmp/gopro-timelapse";
mkdir($output_dir_base) unless -d $output_dir_base;

my @pic = </Volumes/*/DCIM/*GOPRO/G*.JPG>;
my %pic_groups;
for my $f (@pic) {
my $g = substr(basename($f), 0, 4);
push @{$pic_groups{$g}}, $f;
}

for my $g (keys %pic_groups) {
my @files = sort { $a cmp $b } @{$pic_groups{$g}};

my $output_dir = $output_dir_base . "/$g";
mkdir($output_dir) unless -d $output_dir;

my $counter = 0;
for my $f (@files) {
$counter++;
my $f2 = sprintf("%s/pic-%05d.jpg", $output_dir, $counter);
symlink($f, $f2);
}
}

0 comments on commit afef13a

Please sign in to comment.