Using php5-ffmpeg to retrieve video image instances in PHP

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.