Can any one give me a script to create thumb from 3gp or mp4 video?I have ffmpeg.I have a code also.But it didnt work in wamp server.If any one have solution,then replay plz
Video Thumb Creator
Collapse
X
-
PHP Code:<?php
if (!class_exists(ffmpeg_movie))
{
die('This script wont work, you need to ffmpeg hosting !!');
}
//creating an object (a test file test.3gp)
$file='test.3gp';
if (file_exists($file))
{
$mov = new ffmpeg_movie($file);
}
else
{
die('Error !! Can not find file !!');
}
//frame number
$frame = 50;
//width
$w = $mov->GetFrameWidth();
//height
$h = $mov->GetFrameHeight();
//extract frame
$ff_frame = $mov->getFrame($frame);
if ($ff_frame)
{
//format GD
$gd_image = $ff_frame->toGDImage();
if ($gd_image)
{
//output (for example, in the gif)
header('Content-type: image/gif');
imagegif($gd_image);
/*You can make a change in size, causing copyrights and watermarks, in general all that apply for GD*/
}
else
{
die('cannot be converted to GD');
}
}
else
{
die('can not extract frame');
}
/*
descriptions of all methods ffmpeg_movie look here
http://ffmpeg-php.sourceforge.net/doc/api/ffmpeg_movie.php
*/
?>
Comment