ffmpeg and php video conversion
Hello
I have recently been trying to covert uploaded video into flv so that its playable on a flash player. I trying to use ffmpeg which is installed
on my hosting plan server.
I have been able to grab thumbnails using ffmpeg but now need to convert the video into flv. The code I have does a conversion but the
file is 0kb when its outputted to the Videos folder;
This is the code:
$src = "Videos/robot.avi";
$output = "Videos/robot.flv";
$ffmpegPath = "ffmpeg";
$flvtool2Path = "flvtool2";
$ffmpegObj = new ffmpeg_movie($src);
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
exec($ffmpegPath . " -i " . $src . " -ar " . $srcAR . " -ab " . $srcAB . " -vcodec wmv1 -acodec adpcm_ima_wav -s " . $srcWidth . "x" . $srcHeight . " " . $output. " | " . $flvtool2Path . " -U stdin " . $output);
// Make multiples function
function makeMultipleTwo ($value)
{
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}
I dont have flvtools but they are not nessary as they only collect meta data.
Thank you,
