<?php
set_time_limit(0);
// число кадров которые нужно вырезать
$count_of_frames=20;
// путь до файла
$file = "./test.flv";
// поехали =)
$movie = new ffmpeg_movie(realpath($file));
// всего кадров
echo " Всего кадров:".$num_of_frames=$movie->getFrameCount()."<br>";;
// через сколько будем брать кадры
$counter=round($num_of_frames/$count_of_frames);
$gif=new ffmpeg_animated_gif(realpath('./primer.gif'),$movie->getFrameWidth(),$movie->getFrameHeight(),24);
for($i=1;$i<=$count_of_frames;$i++)
{
echo "Frame : ".($i*$counter)."<br>";
echo "<i>".$movie->getFrameNumber()."</i><br>";
$img=$movie->getFrame($i*$counter);
//$gif->addFrame($img);
if($img)
{
$pict=$img->toGDImage();
imagejpeg($pict,'./img/img_'.$i.'.jpg');
imagedestroy($pict);
echo "$i<br>";flush();
}
}
/*/
// создаём анимацию
/*
for ($frame = 150; $frame <= 200; $frame++) {
$image = $movie->getFrame($frame);
$gif->addFrame($image);
}
/*
//получаем скриншот по средствам php ffmpeg
// путь до файла
$file = realpath("./test.flv");
// кадр который будем выхватывать
$frame = 1100;
// получаем кадр
$movie = new ffmpeg_movie($file);
$image = $movie->getFrame($frame);
$show_img = $image->toGDImage();
// выводим его
header("Content-type: image/jpeg");
imagejpeg($show_img);
imagedestroy($show_img);
*/
?>