Hi I have to convert video files to .flv format in php. any body have any simple scripts please give me.
hi I created like this but its not workingffmpeg -i /shob testing video.MPG -ar 22050 -ab 32 -f flv -s 320x240 /FLV/shob testing video.flv
php learner
2010-05-27 06:18:47
I am working in windows plat form if it make any problem
php learner
2010-05-27 06:20:52
add anything you've tried to the initial question: the complete command and part of the output with error.
zerkms
2010-05-27 07:07:22
+2
A:
check this out.. this code should work
<?php
class media_handler
{
function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate)
{
$outfile = "";
// root directory path, where FFMPEG folder exist in your application.
$rPath = $rootpath."\ffmpeg";
// which shows FFMPEG folder exist on the root.
// Set Media Size that is width and hieght
$size = $width."x".$height;
// remove origination extension from file adn add .flv extension, becuase we must give output file name to ffmpeg command.
$outfile =$filename;
$out=explode(".",$outfile);
// Media Size
//$size = Width & "x" & Height;
// remove origination extenstion from file and add .flv extension , becuase we must give output filename to ffmpeg command.
$outfile = $out[0].".flv";
// Use exec command to access command prompt to execute the following FFMPEG Command and convert video to flv format.
$ffmpegcmd1 = "/usr/local/bin/ffmpeg -i ".$inputpath."/".$filename. " -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."/".$outfile;
//$ffmpegcmd1 = "/usr/local/bin/ffmpeg -i ".$inputpath."/".$filename. " -b 500 -r 25 -s 320×240 -hq -deinterlace -ab 56 -ar 22050 -ac 1 ".$outputpath."/".$outfile." 2>&1";
$ret = shell_exec($ffmpegcmd1);
// return output file name for other operations
return $ffmpegcmd1;
}
}
?>
Vimard
2010-05-27 06:20:38
A:
include_once("media_handler.php");
$_objMda = new mandler(); //$_objMda as new mandler();
$rootpath =""; $nputpath = $rootpath."/Default"; $outputpath = $rootpath. "/FLV"; $ThumbPath = $rootpath. "/Thumbs";
if($_POST){ //Save original video in Default folder.
$source = $_FILES['file1']['tmp_name']; $name = $_FILES['file1']['name']; $fileSize = $_FILES['file1']['size']; $filetype = $_FILES['file1']['type']; $dest = '';
copy($source, $inputpath . $name);
// Convert it into FLV Format
$outfile = $_objMda->convert_media($name,$rootpath, $inputpath, $outputpath, 320, 240, 32, 22050);
I used ur class but no result sir. can I set any thing on my phpini for doing this?
php learner
2010-05-27 06:57:23