Last active
December 28, 2015 04:49
-
-
Save sng2c/7445177 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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