时间:2021-07-01 10:21:17 帮助过:6人阅读
代码如下:
sudo apt-get install ffmpeg php5-ffmpeg php5-gd
代码如下:
<?php
$page = 10;
$prefix = 'screencap';
$mov = new ffmpeg_movie('gt.avi');
$count = $mov->getFrameCount();
$range = (int)round($count/($page+1));
for($i=1; $i<=$page; $i++){
$frameNum = $range*$i;
$imgFile = $prefix.'_'.$i.'.png';
$frame = $mov->getFrame($frameNum);
if(!$frame){ continue; }
$gdImage = $frame->toGDImage();
if(!$gdImage){ continue; }
imagepng($gdImage, $imgFile);
imagedestroy($gdImage);
echo '
';
}