我正在尝试.avi
使用 ffmpeg-PHP 将服务器文件夹中的视频文件转换为“.flv”格式。我尝试“安装”ffmpeg-PHP 是将“ffmpeg-php-0.6.0.tbz2”存档的内容提取到一个单独的文件夹中。我使用的视频转换脚本引用了从“ffmpeg-php-0.6.0.tbz2”中提取的文件的目录位置
这是转换脚本:
<?php
// Set our source file
$srcFile = "/videos/clip.avi";
$destFile = "/videos/clip.flv";
$ffmpegPath = "/install"; //where I extracted "ffmpeg-php-0.6.0.tbz2"
// 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();
function makeMultipleTwo ($value)
{
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}
// Call our convert using exec()
exec($ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile);
?>
运行转换脚本后,我得到输出“致命错误:在 [转换脚本位置] 中找不到类 'ffmpeg_movie'”
我已经阅读了 ffmpeg-PHP 页面上的说明,但这对我来说没有意义。如何执行这些 linux 代码行来安装 ffmpeg-PHP?
tar -xjf ffmpeg-php-X.x.x.tbz2
cd ffmpeg-php-X.x.x/
phpize
./configure && make
sudo make install
我想我正在使用安装了 linux 的 Inmotion 共享托管服务。