hi every one . I am making a websit in which client want to show video gallery like u tube . on internet i found use of ffmpeg. i have download ffmpeg adn pest it in root directry. and create class
<?php
class media_handler
{
function convert_media($filename, $rootpath, $inputpath,$outputpath,$width, $height, $bitrate, $samplingrate)
{
$outfile = "";
$rPath = $rootpath."\ffmpeg";
$size = $width."x".$height;
$outfile =$filename;
$size = Width & "x" & Height;
$outfile = 'out_file.flv';
$ffmpegcmd1 = "ffmpeg -i '".$inputpath."'\'".$filename. "' -acodec mp3 -ar '" .$samplingrate."' -ab '".$bitrate."'
-f flv -s '".$size."' '".$outputpath."'\'".$outfile;
$ret = shell_exec($ffmpegcmd1);
return $outfile;
}
function set_buffering($filename,$rootpath,$path)
{
$_rootPath = $rootpath."\flvtool";
$ffmpegcmd1 = "flvtool2 -U '".$Path."'\'".$filename;
$ret = shell_exec($ffmpegcmd1);
}
function grab_image($filename, $rootpath, $inputpath,$outputpath, $no_of_thumbs, $frame_number, $image_format, $width, $height)
{
$_rootpath ="ffmpeg";
$size = $width. "x".$height;
$outfile = "sample.png";
$ffmpegcmd1 = "ffmpeg -i '".$inputpath."'\'".$filename."' -vframes '".$no_of_thumbs."' -ss 00:00:03 -an -vcodec '". $image_format."' -frawvideo -s '".$size. "''". $outputpath."'\'".$outfile ;
$ret = shell_exec($ffmpegcmd1);
return $outfile;
}
}
and where i have used this the code is
$outfile=$_FILES['videofile']['name'];
$rootpath =$videoPath;
$outputpath=$videoPath;
$thumbpath=$videoPath;
**$image_name = $_mediahandler->grab_image($outfile, $rootpath, $outputpath, $thumbpath, 1, 2, "png", 110, 90);**
but it is not working .