在php中找到正确的FFmpeg路径

时间:2014-12-30 17:30:58

标签: php linux ffmpeg

我在CentOS服务器上使用FFmpeg和PHP。 php代码是

$thumbnail = $this->generateRandomString(25);
$ffmpeg = "/usr/bin/man"; // or /usr/share/ffmpeg {not working}
$videoFile = $_FILES['file']['tmp_name'];
$imageFile = "uploads/images/video_thumbnail/$thumbnail.jpg";
$size = '340x250';
$getFrom = 10;
$cmd = "$ffmpeg -i $videoFile -an -ss $getFrom -s $size $imageFile";
shell_exec($cmd);

运行命令$whereis FFmpeg

输出为:ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz

那么正确的道路是什么。

1 个答案:

答案 0 :(得分:0)

使用simpe代码:

$ffmpegPath = exec('which ffmpeg');
$ffprobe = exec('which ffprobe');