hi i use below code for video convert in flv.
code work perfectly but when the out put comes file become 0kb.
$srcFile = "upload_v/veer.avi";
$destFile = "upload_v/veer.flv";
$ffmpegPath = "/usr/bin/ffmpeg";
$flvtool2Path = "/usr/bin/flvtool2";
$ffmpegObj = new ffmpeg_movie($srcFile);
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
//$srcWidth = 320;
//$srcHeight = 240;
//$command = $ffmpegPath . " -i " . $srcFile . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;
extension_loaded('ffmpeg') or die('Error in loading ffmpeg');
$command =$ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;
$type='flv';
$size='512x384';
$quality='450000';
$audio='11025';
if($type=="flv"){ $call="/usr/bin/ffmpeg -i ".$srcFile." -vcodec flv -f flv -r 30 -b ".$quality." -ab 128000 -ar ".$audio." -s ".$size." ".$destFile;}
$convert = (popen($call." >/dev/null &", "r"));
pclose($convert);
function makeMultipleTwo ($value) {
$sType = gettype($value/2);
if($sType == "integer") {
return $value;
} else {
return ($value-1);
}
}
echo $convert = shell_exec($command);
if(!$convert)
{
echo "FAILED!!!";
}
else
{
echo "SUCCESS";
}