Use Php5-ffmpeg to capture video image instances in PHP, _php tutorial

Source: Internet
Author: User

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 ...

  • 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.