Search code examples
phpffmpegffmpeg-php

php-ffmpeg installation on apache2


Trying to run PHP-FFMPEG and after install via composer I'm currently getting this.

PHP Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutableNotFoundException: Executable not found, proposed : avprobe, ffprobe in /var/www/html/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:159\nStack trace:\n#0 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php(48): Alchemy\BinaryDriver\AbstractBinary::load(Array, NULL, Object(Alchemy\BinaryDriver\Configuration))\n#1 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFProbe.php(226): FFMpeg\Driver\FFProbeDriver::create(Object(Alchemy\BinaryDriver\Configuration), NULL)\n#2 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php(117): FFMpeg\FFProbe::create(Array, NULL, Object(Doctrine\Common\Cache\ArrayCache))\n#3 /var/www/html/starapp/test.php(4): FFMpeg\FFMpeg::create()\n#4 {main}\n\nNext FFMpeg\Exception\ExecutableNotFoundException: Unable to load FFProbe in /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php:50\nStack trace:\n#0 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMp in /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php on line 50

Some people have suggested running the following:

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

However I have no ffmpeg/ffprobe files in usr/bin and can't seem to find them anywhere.

EDIT:

FFMpeg is installed. I rebooted the server and restarted apache2 and now the files are visible. Getting this now:

PHP Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutableNotFoundException: Executable not found, proposed : usr/bin/ffprobe in /var/www/html/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:159\nStack trace:\n#0 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php(48): Alchemy\BinaryDriver\AbstractBinary::load(Array, NULL, Object(Alchemy\BinaryDriver\Configuration))\n#1 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFProbe.php(226): FFMpeg\Driver\FFProbeDriver::create(Object(Alchemy\BinaryDriver\Configuration), NULL)\n#2 /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php(117): FFMpeg\FFProbe::create(Array, NULL, Object(Doctrine\Common\Cache\ArrayCache))\n#3 /var/www/html/starapp/test.php(11): FFMpeg\FFMpeg::create(Array, NULL)\n#4 {main}\n\nNext FFMpeg\Exception\ExecutableNotFoundException: Unable to load FFProbe in /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php:50\nStack trace:\n#0 /var/www/html/vendor/php-ffmpeg/php-ffmp in /var/www/html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php on line 50


Solution

  • Issue was the paths

    'ffmpeg.binaries' => 'usr/bin/ffmpeg',
    'ffprobe.binaries' => 'usr/bin/ffprobe'
    

    Whereas:

    'ffmpeg.binaries' => '/usr/bin/ffmpeg',
    'ffprobe.binaries' => '/usr/bin/ffprobe'
    

    Is working.