diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 00:53:41 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 00:53:41 +0200 |
| commit | 5423095777af211553afcec1b98e0d1a5bd2a315 (patch) | |
| tree | 24d75092bc3649f93fd6473fe5a0fa3299d153cc | |
| parent | e76bb4fc2a6e7b83d1a2b7b16b6a363638177cd9 (diff) | |
add get script for grabbing urls and youtubes and zips
| -rw-r--r-- | get.pl | 30 |
1 files changed, 11 insertions, 19 deletions
@@ -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('../..'); |
