PHP uses Php5-ffmpeg to capture video image instances,
A few days ago when playing FFmpeg, suddenly found that there are more php5-ffmpeg this expansion kit on Ubuntu, just want to play to see, optimistic about the bad use, there are two conclusions:
Reading the movie depends on the support of the FFmpeg, and it is recommended that you recompile the FFmpeg if you want to support any format.
Efficiency is not as fast as I expected, two minutes of the film take 10 pictures, about 30 seconds.
Installation method:
Copy the Code code as follows:
sudo apt-get install ffmpeg php5-ffmpeg PHP5-GD
Example of a map test:
Copy the Code code as follows:
<?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 '
';
}
http://www.bkjia.com/PHPjc/939418.html www.bkjia.com true http://www.bkjia.com/PHPjc/939418.html techarticle PHP use php5-ffmpeg capture video image instances, a few days ago when playing FFmpeg, suddenly found on Ubuntu more php5-ffmpeg This expansion kit, want to play to see, not good ...