I need a php file that automatically grabs a screen cap of the first second of a flv video, using ffmpeg. I want to be able to use it in LongTail Video's flash player.
Anyone know how to do this?
Anyone know how to do this?

<?
$video = $_GET['f'];
$movie = new ffmpeg_movie($video, false);
$frames = $movie->getFrameCount();
$frame = $movie->getFrame(50);
$im = $frame->toGDImage();
imagejpeg($im,"$video.jpg");
imagedestroy($im);
header("Content-type:image/jpeg");
readfile("$video.jpg");
?>
so.addVariable("image", "imgflv.php?f=video.flv");

for i in *.flv; do ffmpeg -an -y -t 00:00:01 -i "$i" -f image2 "`echo $i |sed 's/.flv$/.jpg/'`" ;done

<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(50);
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
so.addVariable("image", "imgflv.php?f=video.flv");
<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(50);
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
function grabScreen($clip, $thumb, $dimensions) {
//$dimensions should be in WxH format
//$thumb should contain the full path to the image you want created
$screengrab = "/usr/local/bin/ffmpeg -y -i '{$clip}' -f mjpeg -ss 10 -vframes 1 -s {$dimensions} -an '{$thumb}'";
@system($screengrab);
}
function grabScreen($clip, $thumb, $dimensions) {
//$dimensions should be in WxH format
//$thumb should contain the full path to the image you want created
$screengrab = "/usr/local/bin/ffmpeg -y -i '{$clip}' -f mjpeg -ss 10 -vframes 1 -s {$dimensions} -an '{$thumb}'";
@system($screengrab);
}

<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(50);
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(rand(1, getFrameCount());
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(rand(1, getFrameCount());
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>

Comment