How to generate images from a video?

Asked

Viewed 263 times

1

I wonder if there is any way to generate images from a video, that video can be local or youtube.

I basically have a video and I would like through a routine "taking prints" of the video.

1 answer

1


You need to install the ffmpeg

After installed use the code below.

<?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.'">';
    }
}
?>

Follow this link to better understand the use of ffmpeg

Browser other questions tagged

You are not signed in. Login or sign up in order to post.