Using php5-ffmpeg in PHP to retrieve video image instances ,. PHP using php5-ffmpeg to capture video image instances, a few days ago when playing FFmpeg, suddenly found that Ubuntu with more php5-ffmpeg this expansion kit, I want to play to see, optimistic about the use of php5-ffmpeg in PHP to capture video image instances,
A few days ago when playing FFmpeg, suddenly found that Ubuntu more php5-ffmpeg expansion kit, I want to play to see, optimistic about the bad use, there are two conclusions:
Reading a video depends on FFmpeg's support. if you want to support all formats, we recommend that you recompile FFmpeg.
Efficiency is not as fast as I think. ten images are taken for two minutes, about 30 seconds.
Installation method:
The code is as follows:
Sudo apt-get install ffmpeg php5-ffmpeg php5-gd
Example of a pie chart test:
The code is 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 = paiprefix.'_'.baii.'.png ';
$ Frame = $ mov-> getFrame ($ frameNum );
If (! $ Frame) {continue ;}
$ GdImage = $ frame-> toGDImage ();
If (! $ GdImage) {continue ;}
Imagepng ($ gdImage, $ imgFile );
Imagedestroy ($ gdImage );
Echo'
';
}
Ghost, a few days ago after playing FFmpeg, suddenly found Ubuntu more php5-ffmpeg this expansion kit, you want to play to see, optimistic about not good...