Skip to content

Instantly share code, notes, and snippets.

@sng2c
Last active December 28, 2015 04:49
Show Gist options
  • Save sng2c/7445177 to your computer and use it in GitHub Desktop.
Save sng2c/7445177 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use 5.010;
my $path = '.';
my @types=qw( mov mp4 avi mkv m4v xvid divx wmv mpg mpeg );
my @files = `find $path`;
chomp(@files);
my @videos = grep{ my $f=$_; scalar(grep{ $f =~ /\.$_$/; } @types); }@files;
foreach my $v (@videos){
say "$v";
if( $v =~ /\.[^\.]+$/ ){
my $fname = $`;
my $jpg = $fname.'.jpg';
if( -e $jpg ){
say 'thumb exists.';
}
else{
say 'make thumb';
system qq(ffmpegthumbnailer -i '$v' -o '$jpg' -s160 -q10);
say 'done';
}
}
else{
say "ERROR";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment