gpt4 book ai didi

php - 在php中找到正确的FFmpeg路径

转载 作者:太空宇宙 更新时间:2023-11-04 03:47:17 26 4
gpt4 key购买 nike

我在 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

那么正确的路径是什么。

最佳答案

使用简单的代码:

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

关于php - 在php中找到正确的FFmpeg路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27709861/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com