diff options
Diffstat (limited to 'get.pl')
| -rwxr-xr-x | get.pl | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -5,7 +5,7 @@ $SIG{TERM} = $SIG{INT} = sub { exit 1 }; sub sanitize ($) { my $s = lc shift; $s =~ s/\.[^.]+$//g; - $s =~ s/\W//g; + $s =~ s/\W/_/g; $s =~ s/\s+/_/g; if (length($s) == 0) { print "fn is empty"; @@ -63,18 +63,31 @@ elsif ($s =~ /(mov|mp4|webm|avi|mpe?g)$/i) { else { print "youtube-dl $s\n"; my $yt = `youtube-dl -o "%(title)s.%(ext)s" $s`; + # print $yt; my @partz = split("\n", $yt); foreach $part (@partz) { - if ($part =~ /\[ffmpeg\] Destination\: ([^)]+)$/) { + print "$part\n"; + if ($part =~ /\[download\] Destination\: ([^)]+)$/) { $video_fn = $1; + print ">>> $video_fn\n"; + } + if ($part =~ /\[download\] (.*) has already been downloaded and merged/) { + $video_fn = $1; + print ">>> $video_fn\n"; + } + if ($part =~ /\[ffmpeg\] Merging formats into "(.*)"/) { + $video_fn = $1; + print ">>> $video_fn\n"; } } } if ($video_fn) { + print "Video filename: $video_fn\n"; 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 "creating dataset: $tag\n"; + mkdir($tag); + system('ffmpeg', '-i', $video_fn, "-filter:v", "scale=256x256", $tag . '/frame_%05d.png'); print "created dataset: $tag\n"; } |
