...

View Full Version : PHP FFMEPG Encoding to FLV not encoding but no error



barkermn01
01-26-2010, 06:23 PM
My Server allows the system command and has got all of the ffmepg files required install i used the ffmpeg-installer

but for some reason i cant get ffmpeg to encode the files now this script is copied from another site in google after my way would not work and i get the same result can any one provide some insight into why this is not working?


function encodeFile($srcFile){
$ext = end(explode('.',$srcFile));
$destFile = str_replace($ext, 'flv', $srcFile);
$ffmpegPath = "/usr/bin/ffmpeg";
$flvtool2Path = "/usr/bin/flvtool2";
// Create our FFMPEG-PHP class
$ffmpegObj = new ffmpeg_movie($srcFile);
// Save our needed variables
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
// Call our convert using exec()
exec($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile);
}
// Make multiples function
function makeMultipleTwo ($value)
{
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}
if(!empty($_POST['tabTitle'])){
if(!empty($_POST['vidChanged'])){
/* The Video has changed and needs reencoding */

$folderPath = "";
$path = explode('/', $_SERVER['SCRIPT_FILENAME']);
for($i = 0; $i < count($path); $i++){
if($i != (count($path)-1) && $i != (count($path)-1)){
$folderPath .= $path[$i]."/";
}
}
$folderPath .= "files/flash/";
$target_path = "";
$names = explode('.', $_FILES['tabVideo']['name']);
for($i = 0; $i < count($names) -1; $i++){
$filenameTemp_1 .= $names[$i];
}
$filenameTemp_1 .= time().".".end(explode('.', $_FILES['tabVideo']['name']));
$target_path = $folderPath . $filenameTemp_1 ;

move_uploaded_file($_FILES['tabVideo']['tmp_name'], $target_path);

$tmp = end(explode('.', $_FILES['tabVideo']['name']));
$tmp = str_replace($tmp, 'flv', $_FILES['tabVideo']['name']);

encodeFile($target_path);

$sql = "UPDATE `flash_content` SET `video`='/files/flash/".$tmp."' WHERE `id`='2'";
mysql_query($sql);
}
$sql = "UPDATE `flash_content` SET `title`='".$_POST['tabContentTitle']."' AND `text`='".$_POST['tabContent']."' WHERE `id`='11'";
mysql_query($sql);
header("Location: index.php?state=home");
}

And the file is being saved to the filepath provided /files/flash/video.avi



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum