The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/local/bin/perl
use strict;
use warnings;
use Pod::Usage;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init({category => "main", level => $INFO});

my($video, $time) = @ARGV;

if(!defined $video) {
    pod2usage("No movie file given");
}

my $grabber = Video::FrameGrab->new( video => $video );

if(!defined $time) {
    ($time) = $grabber->equidistant_snap_times(1);
}

use Video::FrameGrab;

$grabber->snap( $time );

my $jpeg_file = "frame.jpg";

INFO "Saved to $jpeg_file";
$grabber->jpeg_save($jpeg_file);

__END__

=head1 NAME

    video-framegrab - Grab a frame from a video

=head1 SYNOPSIS

    video-framegrab myvideo.avi 00:00:10

=head1 DESCRIPTION

video-framegrab uses mplayer to grab a single frame from a given video at
the specified time and saves it as a jpeg in frame.jpg.

=head1 LEGALESE

Copyright 2009 by Mike Schilli, all rights reserved.
This program is free software, you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 AUTHOR

2009, Mike Schilli <cpan@perlmeister.com>