Video Thumb Creator

Started on the old forum in May 2011 · view the original in the archive · old links redirect here

1 reply · 591 views · started 15 years ago · 1 min read

2 participants
bdspice Junior · 38 posts #1

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

Mr-59 Developer · 137 posts #2
<?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
*/
?> 

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close