diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-08 01:49:27 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-08 01:49:27 +0200 |
| commit | 1efd2b67127b7a1c1b3840e33304d4f22827a2eb (patch) | |
| tree | c3b4b933b1a751195e61b8ee69ffc631125df851 /get.pl | |
| parent | 1efe73d462e027bd9b234154b535a384dd1c55cb (diff) | |
get script working. also FREAKY changes to live-mogrify.
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"; } |
