Laravel FFMpeg – Unable to load FFMpeg in file error

Issue

I’m trying to integrate FFMpeg into a Laravel project but am getting the error when I call the end point:

FFMpeg\Exception\ExecutableNotFoundException: Unable to load FFMpeg in file /Users/me/Desktop/video/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFMpegDriver.php on line 55

What I’ve done:

brew install ffmpeg – installed FFMEG locally, can confirm that this works when using terminal

Fresh Laravel install composer create-project laravel/laravel example-app

Install php ffmpeg composer require php-ffmpeg/php-ffmpeg

install Laravel ffmpeg composer require pbmedia/laravel-ffmpeg

added FFMPEG to providers and aliases in app.php:

'providers' => [
    ...
    ProtoneMedia\LaravelFFMpeg\Support\ServiceProvider::class,
    ...
];

'aliases' => [
    ...
    'FFMpeg' => ProtoneMedia\LaravelFFMpeg\Support\FFMpeg::class
    ...
];

and then my controller is

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use FFMpeg;

class VideoController extends Controller
{
    public function makeVideo()
    {

        FFMpeg::fromDisk('songs')
    ->open('yesterday.mp3')
    ->export()
    ->toDisk('converted_songs')
    ->inFormat(new \FFMpeg\Format\Audio\Aac)
    ->save('yesterday.aac');
        return "hello";
    }
}

which is the example they give on git. if I call the end point I get the above error. Has anyone got any ideas what’s wrong or how to debug? The logs don’t give me any more information!

Solution

It’s not able to find your FFMpeg executable. Try adding the path to FFMPEG_BINARIES and FFPROBE_BINARIES in your .env file.

Edit 2022-06-13
Most times, just adding this two lines in your .env file will do.

FFMPEG_BINARIES=/usr/bin/ffmpeg
FFPROBE_BINARIES=/usr/bin/ffprobe

Answered By – sykez

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published