语境
我有一个包含 AMQPMessage 的 RabbitMQ 队列,这些消息引用需要处理的视频(本质上是剪切并在 x264 中编码)
这是导致问题的代码(非常简单)
$ffprobe = FFProbe::create([
'ffmpeg.binaries' => '/usr/bin/ffmpeg',
'ffprobe.binaries' => '/usr/bin/ffprobe',
]);
错误信息
TL;博士:
Error: "Unable to load FFProbe"
[2019-12-03 14:55:07] messenger.ERROR: Error thrown while handling message App\Api\Message\AMQPvideoFFMPEG. Sending for retry #1 using 1000 ms delay. Error: "Unable to load FFProbe" {"message":"[object] (App\Api\Message\AMQPvideoFFMPEG: {})","class":"App\Api\Message\AMQPvideoFFMPEG","retryCount":1,"delay":1000,"error":"Unable to load FFProbe","exception":"[object] (Symfony\Component\Messenger\Exception\HandlerFailedException(code: 0): Unable to load FFProbe at /app/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php:80, FFMpeg\Exception\ExecutableNotFoundException(code: 0): Unable to load FFProbe at /app/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php:50, Alchemy\BinaryDriver\Exception\ExecutableNotFoundException(code: 0): Executable not found, proposed : /usr/bin/ffprobe at /app/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:160)"} []
配置和测试
在 Heroku 我有 2 dynos :
- web $(composer config bin-dir)/heroku-php-nginx -C config/packages/dev/heroku_nginx.conf public/
- worker php bin/console messenger:consume ffmpeg
在这个平台上,我还有 3 个构建包,请看下面,带有这个特定的 buildpack :
为确保一切可用,这是我的检查结果:
heroku run "ffmpeg -version" -a project-dev
Running ffmpeg -version on ⬢ project-dev... up, run.6134 (Hobby)
ffmpeg version N-67574-g9d6ad68 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 12 2014 11:35:09 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
configuration: --enable-static --disable-shared --disable-asm --extra-libs=-L/app/vendor/libs/lib --extra-cflags=-I/app/vendor/libs/include --prefix=/app/vendor/ffmpeg --enable-libfdk-aac --enable-nonfree --enable-libx264 --enable-gpl
libavutil 54. 11.100 / 54. 11.100
libavcodec 56. 12.100 / 56. 12.100
libavformat 56. 12.103 / 56. 12.103
libavdevice 56. 2.100 / 56. 2.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
heroku run "ffprobe -version" -a projet-dev
Running ffprobe -version on ⬢ projet-dev... up, run.2357 (Hobby)
ffprobe version N-67574-g9d6ad68 Copyright (c) 2007-2014 the FFmpeg developers
built on Nov 12 2014 11:35:09 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
configuration: --enable-static --disable-shared --disable-asm --extra-libs=-L/app/vendor/libs/lib --extra-cflags=-I/app/vendor/libs/include --prefix=/app/vendor/ffmpeg --enable-libfdk-aac --enable-nonfree --enable-libx264 --enable-gpl
libavutil 54. 11.100 / 54. 11.100
libavcodec 56. 12.100 / 56. 12.100
libavformat 56. 12.103 / 56. 12.103
libavdevice 56. 2.100 / 56. 2.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
都好 !
免责声明
此代码在另一个平台(由 kubernetes 处理)上运行良好,因此可能需要对 heroku 进行一些调整。但是找不到。
为什么这个错误,因为我的配置没有显示任何错误配置?我在这里想念什么?
最佳答案
改成:
$ffprobe = FFProbe::create([
'ffmpeg.binaries' => '/app/vendor/ffmpeg_bundle/ffmpeg/bin/ffmpeg',
'ffprobe.binaries' => '/app/vendor/ffmpeg_bundle/ffmpeg/bin/ffprobe',
]);
您使用的是
/usr/bin/
,但您的文件不在那里。PATH
包括$HOME/vendor/ffmpeg_bundle/ffmpeg/bin
和 --prefix
设置为 /app/vendor/ffmpeg
,所以我怀疑这是文件的位置。 whereis ffmpeg
.如果 ffmpeg
在您的 PATH
中它会给你位置。 --disable-asm
的情况下进行编译。如果可能(x264 相同)。 关于php - Heroku : FFMpeg installed but php worker can't find it,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59160451/