Heroku:已安装FFMpeg,但php worker无法找到它

时间:2019-12-03 15:31:36

标签: php symfony heroku ffmpeg symfony-messenger

上下文

我有一个包含AMQPMessage的RabbitMQ队列,这些消息引用了需要处理的视频(本质上也进行了剪切并以x264编码)

这是导致问题的代码(非常简单)

        $ffprobe = FFProbe::create([
            'ffmpeg.binaries'  => '/usr/bin/ffmpeg',
            'ffprobe.binaries' => '/usr/bin/ffprobe',
        ]);

错误消息

TL; DR: Error: "Unable to load FFProbe"

  

[2019-12-03 14:55:07] messenger.ERROR:处理消息App \ Api \ Message \ AMQPvideoFFMPEG时引发错误。使用1000毫秒的延迟发送重试#1。错误:“无法加载FFProbe” {“消息”:“ [对象](App \ Api \ Message \ AMQPvideoFFMPEG:{})”,“类”:“ App \ Api \ Message \ AMQPvideoFFMPEG”,“ retryCount”:1 ,“ delay”:1000,“ error”:“无法加载FFProbe”,“ exception”:“ [对象](Symfony \ Component \ Messenger \ Exception \ HandlerFailedException(代码:0):无法在/ app /下加载FFProbe vendor / symfony / messenger / Middleware / HandleMessageMiddleware.php:80,FFMpeg \ Exception \ ExecutableNotFoundException(代码:0):无法在/ app / vendor / php-ffmpeg / php-ffmpeg / src / FFMpeg / Driver / FFProbeDriver加载FFProbe .php:50,Alchemy \ BinaryDriver \ Exception \ ExecutableNotFoundException(代码:0):找不到可执行文件,建议在/ app / vendor / alchemy / binary-driver / src / Alchemy / BinaryDriver / AbstractBinary中找到/ usr / bin / ffprobe。 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,如下所示,带有特定的buildpack

with a custom buildpack for ffmpeg

为确保所有内容均可用,这是我检查的结果:

 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进行一些调整。但是找不到它。

为什么由于我的配置未显示任何配置错误而出现此错误?我在这里想念什么?

1 个答案:

答案 0 :(得分:1)

更改为:

testSystemInfo(org.nd4j.systeminfo.TestSystemInfo)  Time elapsed: 0.034 sec  <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.nd4j.linalg.factory.Nd4j
    at org.nd4j.systeminfo.SystemInfo.getSystemInfo(SystemInfo.java:159)
    at org.nd4j.systeminfo.SystemInfo.printSystemInfo(SystemInfo.java:419)
    at org.nd4j.systeminfo.TestSystemInfo.testSystemInfo(TestSystemInfo.java:25)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

您使用的是 $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中,它将为您提供位置。

  • 为什么要使用2014年以来的ffmpeg?开发非常活跃,因此您错过了数千个更新。另外,我建议尽量避免在没有PATH的情况下进行编译(与x264相同)。