致命错误:未捕获的异常"Alchemy\二进制驱动程序\异常\可执行文件未找到异常",消息"找不到可执行文件,建议



我已经在 Linux 上安装了 https://github.com/PHP-FFMpeg/PHP-FFMpeg

托管路径为

/public_html/videoconversion/

我收到此错误。

Fatal error: Uncaught exception 'AlchemyBinaryDriverExceptionExecutableNotFoundException' with message 
'Executable not found, proposed : 
    public_html/videoconversion/' in 
        /home/deveducate/public_html/videoconversion/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:160 Stack trace: 
        #0 /home/deveducate/public_html/videoconversion/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php(48): 
            AlchemyBinaryDriverAbstractBinary::load('public_html/vid...', NULL, Object(AlchemyBinaryDriverConfiguration)) 
        #1 /home/deveducate/public_html/videoconversion/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFProbe.php(226): FFMpegDriverFFProbeDriver::create(Array, NULL) 
        #2 /home/deveducate/public_html/videoconversion/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php(117): FFMpegFFProbe::create(Array, NULL, NULL) 
        #3 /home/deveducate/public_html/videoconversion/convert_to_mp4.php(10): FFMpegFFMpeg::create(Array, NULL) 
        #4 {main} Next exception 'FFMpegExceptionExecutableNotFoundException' with message 
           'U in /home/deveducate/public_html/videoconversion/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php on line 50

文件

require 'vendor/autoload.php';
$ffmpeg = FFMpegFFMpeg::create(array(
'ffmpeg.binaries'  => '/opt/local/ffmpeg/bin/ffmpeg',
'ffprobe.binaries' => '/opt/local/ffmpeg/bin/ffprobe',
'timeout'          => 3600, // The timeout for the underlying process
'ffmpeg.threads'   => 12,   // The number of threads that FFMpeg should 
 use
 ), $logger);
 $video = $ffmpeg->open('video.mpg');
$video
->filters()
->resize(new FFMpegCoordinateDimension(320, 240))
->synchronize();
$video
->frame(FFMpegCoordinateTimeCode::fromSeconds(10))
->save('frame.jpg');
$video
->save(new FFMpegFormatVideoX264(), 'export-x264.mp4')

任何人都可以让我知道在哪里更新路径。

谢谢

根据文档:

FFMpeg 将自动检测 ffmpeg 和 ffprobe 二进制文件。如果要显式提供二进制路径,可以将数组作为配置传递。

例:

$ffmpeg = FFMpegFFMpeg::create(array(
    'ffmpeg.binaries'  => '/opt/local/ffmpeg/bin/ffmpeg',
    'ffprobe.binaries' => '/opt/local/ffmpeg/bin/ffprobe',
    'timeout'          => 3600, // The timeout for the underlying process
    'ffmpeg.threads'   => 12,   // The number of threads that FFMpeg should use
), $logger);

在您的代码中,您似乎需要在此文件中进行更改:

/

home/deveducate/public_html/videoconversion/convert_to_mp4.php

注意:文档中也这样说,因此您可以将它们添加到系统路径中:

此库需要有效的 FFMpeg 安装。您将需要FFMpeg和FFProbe二进制文件才能使用它。请确保可以使用系统 PATH 找到这些二进制文件,以获得二进制检测的好处,否则必须在加载时显式提供二进制文件路径。

我遇到了类似的问题,终于解决了:

  • 确保已安装 ffmpeg ( apt get install ffmpeg
  • 此外,如果您有 PHP openbasedir限制,请确保向其添加 ffmpeg 和 ffprobe : open_basedir="/tmp:/usr/share/php::/usr/bin/ffmpeg:/usr/bin/ffprobe"

我遇到了同样的问题,并通过以下步骤解决了它:

  1. 需要在您的系统上安装 FFMPEG。使用以下命令在 Linux 中安装 ffmpeg:

    sudo apt install ffmpeg

  2. 您需要修改域的 PHP 参数Open_basedir conf

    :{WEBSPACEROOT}{/}{:}{TMP}{/}:/usr/bin/

    ffmpeg:/usr/bin/ffprobe

  3. 最后,你的 php 代码中需要一个超时参数:

    $ffmpeg = FFMpeg

    \FFMpeg::create(数组('超时' => 0,));

相关内容

最新更新