【发布时间】:2018-11-29 09:38:20
【问题描述】:
我在不同的论坛和在线资源中搜索了如何在共享主机上的 laravel 5.7 应用程序上使用 ffmpeg,但没有得到任何解决方案。我实际上按照此链接How to Install FFMPEG in Laravel.的说明在我的项目上安装了ffmpeg
我还下载了二进制文件并将它们保存到我的本地驱动器 C:// 在我的带有 windows 8.1 操作系统的系统中。然后我连接了我的二进制文件,如下所示;
$ffprobe = FFMpeg\FFProbe::create([
'ffmpeg.binaries' => 'C:/FFmpeg/bin/ffmpeg.exe', // the path to the FFMpeg binary
'ffprobe.binaries' => 'C:/FFmpeg/bin/ffprobe.exe', // the path to the FFProbe binary
'timeout' => 3600, // the timeout for the underlying process
'ffmpeg.threads' => 12, // the number of threads that FFMpeg should use
]);
我还在系统环境变量设置中进行了路径设置,从 XAMPP Server 为网站提供服务时一切正常。
我遇到的问题是我已将项目上传到一个共享主机,我无权检查他们是否在服务器上安装了 ffmpeg,并且主机提供商无法真正为我提供有用的信息。因此,我将二进制文件上传到 cpanel 上我的文件管理器中的一个文件夹中,并将其命名为“二进制文件”。然后我更改了我的代码,如下所示;
$ffmpeg = FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => '/home/username/binary_files/bin/ffmpeg.exe', // the path to the FFMpeg binary
'ffprobe.binaries' => '/home/username/binary_files/bin/ffprobe.exe', // the path to the FFProbe binary
'timeout' => 3600, // the timeout for the underlying process
'ffmpeg.threads' => 1, // the number of threads that FFMpeg should use
]);
但我仍然收到无法从代码中加载 FFProbe 的错误,如 this Image 所示
public static function create($configuration, LoggerInterface $logger = null)
{
if (!$configuration instanceof ConfigurationInterface) {
$configuration = new Configuration($configuration);
}
$binaries = $configuration->get('ffprobe.binaries', array('avprobe', 'ffprobe'));
try {
return static::load($binaries, $logger, $configuration);
} catch (BinaryDriverExecutableNotFound $e) {
throw new ExecutableNotFoundException('Unable to load FFProbe', $e->getCode(), $e);
}
}
我在我的项目中做的主要事情是将视频转换为适当的编码流视频,并在上传时自动从视频生成 .png 或 .jpg 缩略图。因此,如果有除 ffmpeg 之外的替代方案来解决此问题,或者之前在共享主机上使用过 ffmpeg 库的任何人都应该提供帮助。 请!
【问题讨论】:
标签: php ffmpeg hosting shared laravel-5.7