Ubuntu - Laravel 5.6 - Unable to load ffprobe (usi

2019-06-06 13:26发布

问题:

I have ffmpeg and ffprobe installed on my ubuntu system (can access it via command line)

ffmpeg and ffprobe are located in /usr/bin/

I installed these via composer

"php-ffmpeg/binary-driver": "dev-master",
"php-ffmpeg/php-ffmpeg": "^0.11.1",

I've done: use FFMpeg;

// in index() function//

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

and still get

FFMpeg \ Exception \ ExecutableNotFoundException

Unable to load FFProbe

I have looked at about 30 forums for this and no luck, some direction would be helpful

UPDATE I tried chmod +x /usr/bin/ffprobe

Then restarted, did nothing.

I then tried:

sudo chgrp www-data /usr/bin/ffprobe sudo chmod g+x /usr/bin/ffprobe

Then restarted, did nothing.

UPDATE I forgot to mention that I am running php-fpm + nginx in docker.I added pbmedia wrapper for php-ffmpeg and If I run the laravel project without docker (php artisan serve) it works fine.

The issue now is that I need to reference the /usr/bin/ffprobe directory from within docker

回答1:

You mention

ffmpeg and ffprobe are located in /usr/bin/

but later your code if referring to them in /usr/local/bin/

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

That's one thing to check.

The other is to ensure that the binaries have the executable bit set for the right user that php runs as .. under ubuntu this user may be the www-data (if you're unsure have your php script emit the output of whoami or id -un, etc).

sudo chgrp www-data /usr/bin/ffprobe
sudo chmod g+x      /usr/bin/ffprobe