summaryrefslogtreecommitdiff
path: root/get.pl
diff options
context:
space:
mode:
Diffstat (limited to 'get.pl')
-rw-r--r--get.pl30
1 files changed, 11 insertions, 19 deletions
diff --git a/get.pl b/get.pl
index 83327f9..78f51b0 100644
--- a/get.pl
+++ b/get.pl
@@ -21,11 +21,10 @@ if (not defined $module || not defined $url || $s !~ /^http/) {
die "usage: ./get.pl pix2pix http://...\n";
}
-mkdir("$module/");
-mkdir("$module/sequences/");
-chdir("$module/sequences/");
+mkdir("sequences/$module/");
+chdir("sequences/$module/");
-my $fn, $new_fn;
+my $fn, $new_fn, $video_fn;
# ZIP file of spectrograms >:)
if ($s =~ /(zip)$/i) {
@@ -59,7 +58,7 @@ elsif ($s =~ /(mov|mp4|webm|avi|mpe?g)$/i) {
system('rm', $clean_fn);
print "downloading $clean_fn\n";
system('wget', '-O', $clean_fn, $s);
- $fn = $clean_fn;
+ $video_fn = $clean_fn;
}
else {
print "youtube-dl $s\n";
@@ -67,24 +66,17 @@ else {
my @partz = split("\n", $yt);
foreach $part (@partz) {
if ($part =~ /\[ffmpeg\] Destination\: ([^)]+)$/) {
- $fn = $1;
+ $video_fn = $1;
}
}
- if ($fn) {
- my $tag = sanitize($fn);
- mkdir('$tag');
- system('ffmpeg', '-i', $fn, './sequences/' . $module . '/' . $tag . '/frame_%05d.png');
- print "created_dataset: $tag\n";
- # $new_fn
- }
}
-my $tag = sanitize($fn);
-open(my $fd, ">>../run_slap.sh");
-print $fd "standard $tag\n";
-close $fn;
-
-$fn = undef;
+if ($video_fn) {
+ my $tag = sanitize($video_fn);
+ mkdir('$tag');
+ system('ffmpeg', '-i', $video_fn, "-filter:v", "crop=w:h:x:y, scale=256x256", $tag . '/frame_%05d.png');
+ print "created dataset: $tag\n";
+}
END {
chdir('../..');