-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathslideshow.pl
More file actions
40 lines (31 loc) · 1.05 KB
/
slideshow.pl
File metadata and controls
40 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/perl
# Create a video slideshow from a collection of images, given a glob pattern.
# Usage:
# perl slideshow.pl 'glob_pattern*.jpg' 'output.mp4'
use 5.036;
use Getopt::Long qw(GetOptions);
my $width = 1920;
my $height = 1080;
my $delay = 2;
GetOptions(
"width=i" => \$width,
"height=i" => \$height,
"delay=i" => \$delay
)
or die("Error in command line arguments\n");
@ARGV == 2 or die <<"USAGE";
usage: $0 [options] [glob pattern] [output.mp4]
options:
--width=i : width of the video (default: $width)
--height=i : height of the video (default: $height)
--delay=i : delay in seconds between pictures (default: $delay)
USAGE
system('ffmpeg', qw(-framerate),
join('/', 1, $delay),
qw(-pattern_type glob -i),
$ARGV[0], '-vf',
"scale=${width}:${height}:force_original_aspect_ratio=decrease,pad=${width}:${height}:(ow-iw)/2:(oh-ih)/2",
qw(-c:v libx264 -s),
join('x', $width, $height),
qw(-crf 18 -tune stillimage -r 24),
$ARGV[1]);