Generate thumbnail of video in php [duplicate]

2

I wanted to get the thumbnail of a video after the video has been uploaded on the site, I've already looked for a lot and only what I think is about ffmpeg and the "tutorials" basically tell you the commands (do not teach or install). Would it have some other way without being ffmpeg?

    
asked by anonymous 05.06.2017 / 18:25

1 answer

0

As this response in the English OS, you must install FFMPEG . Once installed, you would need to use the following code:

<?php

$frame = 10;
$movie = 'test.mp4';
$thumbnail = 'thumbnail.png';

$mov = new ffmpeg_movie($movie);
$frame = $mov->getFrame($frame);
if ($frame) {
    $gd_image = $frame->toGDImage();
    if ($gd_image) {
        imagepng($gd_image, $thumbnail);
        imagedestroy($gd_image);
        echo '<img src="'.$thumbnail.'">';
    }
}

?>
    
05.06.2017 / 19:12