summaryrefslogtreecommitdiff
path: root/dir-to-movie.pl
diff options
context:
space:
mode:
Diffstat (limited to 'dir-to-movie.pl')
-rw-r--r--dir-to-movie.pl27
1 files changed, 27 insertions, 0 deletions
diff --git a/dir-to-movie.pl b/dir-to-movie.pl
new file mode 100644
index 0000000..ac51aef
--- /dev/null
+++ b/dir-to-movie.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+my $i = 0;
+my $ls = `ls -1v *.png`;
+my @lines = split('\n', $ls);
+my $pwd = `pwd`;
+chomp $pwd;
+$pwd .= '/';
+
+system('mkdir', 'tmp');
+
+for my $line (@lines) {
+ chomp $line;
+ system('ln', '-s', $pwd . $line, sprintf('./tmp/frame_%05d.png', $i));
+ $i += 1;
+}
+
+system("ffmpeg",
+ "-i", "./tmp/frame_%05d.png",
+ "-y", "-c:v", "libx264", "-vf", "fps=25", "-pix_fmt", "yuv420p",
+ "-s", "456x256",
+ $tag . ".mp4"
+);
+
+END {
+ system('rm', '-rf', 'tmp');
+}