I wonder if there is any way to generate images from a video, this video can be local or youtube.
Basically I have a video and I would like it through a routine "strip prints" of the video.
I wonder if there is any way to generate images from a video, this video can be local or youtube.
Basically I have a video and I would like it through a routine "strip prints" of the video.
You need to install ffmpeg
Once 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