致命错误:建议消息为“未找到可执行文件”的未捕获异常“ Alchemy \ BinaryDriver \ Exception \ ExecutableNotFoundException”

时间:2018-12-29 05:33:20

标签: php ffmpeg video-processing php-ffmpeg

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

托管路径为

/public_html/videoconversion/

我收到此错误。

Fatal error: Uncaught exception 'Alchemy\BinaryDriver\Exception\ExecutableNotFoundException' 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): 
            Alchemy\BinaryDriver\AbstractBinary::load('public_html/vid...', NULL, Object(Alchemy\BinaryDriver\Configuration)) 
        #1 /home/deveducate/public_html/videoconversion/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFProbe.php(226): FFMpeg\Driver\FFProbeDriver::create(Array, NULL) 
        #2 /home/deveducate/public_html/videoconversion/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php(117): FFMpeg\FFProbe::create(Array, NULL, NULL) 
        #3 /home/deveducate/public_html/videoconversion/convert_to_mp4.php(10): FFMpeg\FFMpeg::create(Array, NULL) 
        #4 {main} Next exception 'FFMpeg\Exception\ExecutableNotFoundException' 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 = FFMpeg\FFMpeg::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 FFMpeg\Coordinate\Dimension(320, 240))
->synchronize();
$video
->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
->save('frame.jpg');
$video
->save(new FFMpeg\Format\Video\X264(), 'export-x264.mp4')

可以让我知道在哪里更新路径。

谢谢

1 个答案:

答案 0 :(得分:0)

根据documentation

  

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

示例:

$ffmpeg = FFMpeg\FFMpeg::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找到这些二进制文件,以获取二进制文件检测的好处,否则,您必须在加载时明确给出二进制文件的路径。