Código PHP:
<?php
// Establecer el archivo fuente
$srcFile = "reffight.avi";
$destFile = "clock.flv";
$ffmpegPath = "/usr/local/bin/ffmpeg";
$flvtool2Path = "/usr/bin/flvtool2";
// Crear nuestro class FFMPEG-PHP
$ffmpegObj = new ffmpeg_movie($srcFile);
// Guardar las variables
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
// Llamar al convertidor usando exec()
exec($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile);
// Función de Multiplicación
function makeMultipleTwo ($value)
{
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}
?>
Muchas gracias anticipadas y un saludo.