As marto has said, use ffmpeg. Here is a little wrapper script that will extract 10 frames ('-frames:v', $num_frames) from the input video "filename.mp4", starting at 4 seconds ('-ss', $start_time) and save them as PNGs named "filename_1.png" to "filename_10.png"
my $input_file = '/path/to/filename.mp4';
my $output_files = '/path/to/filename_%d.png';
my $start_time = 4;
my $num_frames = 10;
my @args = (
'/path/to/ffmpeg',
'-loglevel', 'quiet',
'-ss', $start_time,
'-i', $input_file,
'-frames:v', $num_frames,
$output_files
);
my $response = system( @args );
if ($response == 0) {
print "system command success";
}
else {
print "system command failed";
}
|