0

Context

I've a RabbitMQ's queue that contains AMQPMessage, those messages are referencing a video that needs to be treated (cut essentially and encoded in x264 also)

Here's the code that cause the issue (pretty straightforward)

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

Error Message

TL;DR : 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)"} []

Configuration & tests

On Heroku I've 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 

On this platform, I've also 3 buildpacks, look below, with this specific buildpack :

with a custom buildpack for ffmpeg

To make sure that all is available here's the results of my checks :

 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

All good !

Disclaimer

This code is working well on another platform (handled by kubernetes), so it may need some adjustments with heroku. But can't find it.

Why this error since my configuration is not showing any missconfigurations? What am I missing here?

Greco Jonathan
  • 2,517
  • 2
  • 29
  • 54

1 Answers1

2

Change to:

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

You were using /usr/bin/, but your files were not located there.

  • The script edited your PATH to include $HOME/vendor/ffmpeg_bundle/ffmpeg/bin and --prefix is set to /app/vendor/ffmpeg, so I suspect this is the location of the files.

  • Run whereis ffmpeg. If ffmpeg is in your PATH it will give you the location.

  • Why use ffmpeg from 2014? Development is very active so you're missing out on thousands of updates. Also, I recommend avoiding compiling without --disable-asm if possible (same for x264).

llogan
  • 121,796
  • 28
  • 232
  • 243
  • Hey thank you, are you sure about vendor ? You've right on heroku building logs, I saw that ffmpeg installed on another location, but it's not in vendors I'll test both paths, and come back to you thanks for your help – Greco Jonathan Dec 03 '19 at 19:19
  • @GrecoJonathan Not sure because it is an informed guess, but it should be easy enough to verify. – llogan Dec 03 '19 at 19:20
  • on heroku it show only ffmpeg_module/... on this link https://github.com/foxtrapplimited/heroku-buildpack-ffmpeg/blob/master/bin/compile we have the full path but I'm in doubt of what I should put in the code you pointed – Greco Jonathan Dec 03 '19 at 19:28
  • And you right about the buildpack version I will use another buildpack with the latest build, I just need to fix the path thing first – Greco Jonathan Dec 03 '19 at 19:29
  • @GrecoJonathan I know nothing of heroku or buildpacks. I was simply looking at your ffmpeg configuration. The script is adding `$HOME/vendor/ffmpeg_bundle/ffmpeg/bin:$HOME/vendor/ffmpeg_bundle/libs/bin` to your `PATH` so you can look in those two directories for the executables. Or run `whereis ffmpeg`. You're just going to have to look around. Since it messed with your `PATH` you may just try `'ffmpeg.binaries' => 'ffmpeg',` – llogan Dec 03 '19 at 19:34
  • Really thanks for all of your comments and help indeed whereis showed me that the realpath of my ffmpeg installation was here : /app/vendor/ffmpeg_bundle/ffmpeg/bin/ffmpeg Good guess, thanks – Greco Jonathan Dec 04 '19 at 08:05
  • On your Heroku Dashboard, you can go to More -> Run console and then running `which ffmpeg` and `which ffprobe` you can see the installation path :) – AnonymousAngelo Mar 07 '23 at 20:56