I have already answered how to do this on Stack Overflow here using ffmpeg and PHP.
Sorry about the code-centric answer but doing this in a batch process is most easily done by writing some actual code.
/**
* ExtractThumb, extracts a thumbnail from a video
*
* This function loads a video and extracts an image from a frame 4
* seconds into the clip
* @param $in string the input path to the video being processed
* @param $out string the path where the output image is saved
*/
function ExtractThumb($in, $out)
{
$thumb_stdout;
$errors;
$retval = 0;
// Delete the file if it already exists
if (file_exists($out)) { unlink($out); }
// Use ffmpeg to generate a thumbnail from the movie
$cmd = "ffmpeg -itsoffset -4 -i $in -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 $out 2>&1";
exec($cmd, $thumb_stdout, $retval);
// Queue up the error for processing
if ($retval != 0) { $errors[] = "FFMPEG thumbnail generation failed"; }
if (!empty($thumb_stdout))
{
foreach ($thumb_stdout as $line)
{
echo $line . "\n";
}
}
if (!empty($errors))
{
foreach ($errors as $error)
{
echo $error . "\n";
}
}
}
Doesn't get much more cross-platform than that.
Here's a breakdown of the flags:
- -itsoffset flag is the time in the video that the snapshot is taken
- -vcodec is the output type (change to png for png, etc...)
- -vframes is set to one because you're extracting only one frame (IE an image)
- you may also need to add -deinterlace
That's about it. Doesn't get much easier than that. If you're doing multiple screenshots for a movie just change the -itsoffset flag. Other than that, it's a complete package unless you chose to add better error information or suppress outputs.