FFmpegとFFmpeg::Commandを組み合わせた。丁度半分の時間でサムネイルを作る。 ちなみにFFmpegはインストールする時テストでこけたけど、無理やり入れて動いた。
#!/usr/bin/perl
use FFmpeg;
use FFmpeg::Command;
use strict;
my $filename = "test.wmv";
my $jpgname = "test.jpg";
my $ff = FFmpeg->new();
my $ffc = FFmpeg::Command->new('/usr/local/bin/ffmpeg');
$ff->input_file($filename);
my $sg = $ff->create_streamgroup();
my $duration = $sg->duration();
$ffc->input_file($filename);
$ffc->output_file($jpgname);
$ffc->options(
'-y',
'-f' => 'image2',
'-pix_fmt' => 'jpg',
'-vframes' => 1,
'-ss' => $duration/2,
'-s' => '160x120',
'-an',
'-deinterlace',
);
$ffc->exec();

