I installed ffmpeg according to the ffmpeg instructions I found on d.o.

When I do which ffmpeg it tells me /usr/local/bin/ffmpeg but when I search in Finder for it (installing with MAMP) it tells me it's at /Applications/MAMP/bin/php/php5.3.6/bin/ffmpeg/ffmpeg .

I've tried pasting both of those paths into the field in Video configuration that says "Absolute path to FFmpeg executable. When you install a new FFmpeg version, please clear the caches to let Drupal detect the updated codec support." but then I get FFmpeg not found at [either of those paths].

I have tried removing the extra copies, to no avail. I've tried setting the document root in settings.php, to no avail. I've tried installing and building it manually as well as with brew. No dice.


That message error is returned also when the FFmpeg executable is found, but its output is not the module is expecting.

TranscoderAbstractionFactoryFfmpeg::adminSettingsValidate() contains the following code.

  if (!$ffmpeg['ffmpeg-found'] || ($version = self::getVersionFromOutput($ffmpeg['raw'])) == NULL) {
    form_set_error('video_ffmpeg_path', t('FFmpeg not found at %path. To convert videos and create thumbnails you have to install FFmpeg on your server. For more information please see the !documentation.', array('%path' => $ffmpeg_path, '!documentation' => l(t('documentation'), 'http://video.heidisoft.com/documentation/ffmpeg-installtion-scripts'))));

PHPVideoToolkit::getFFmpegInfo() contains the following code.

$formats = $this->_captureExecBuffer($this->_ffmpeg_binary . ' -formats');
$codecs = $this->_captureExecBuffer($this->_ffmpeg_binary . ' -codecs');
$filters = $this->_captureExecBuffer($this->_ffmpeg_binary . ' -bsfs');
$protocols = $this->_captureExecBuffer($this->_ffmpeg_binary . ' -protocols');
$pixformats = $this->_captureExecBufferFallback($this->_ffmpeg_binary . ' -pix_fmts', $this->_ffmpeg_binary . ' -pix_fmt list');
$help = $this->_captureExecBuffer($this->_ffmpeg_binary . ' -h');

self::$ffmpeg_found = $data['ffmpeg-found'] = !empty($formats) && strpos($formats[0], 'not found') === FALSE && strpos($formats[0], 'No such file or directory') === FALSE;

The message error could be returned when:

  • The module is not able to detect the FFmpeg version from its output
  • The module finds the string "not found," or "No such file or directory" in output returned from ffmpeg -formats
  • The command line fails for any reason

In the latter case, the first condition of !empty($formats) && strpos($formats[0], 'not found') === FALSE && strpos($formats[0], 'No such file or directory') === FALSE; is FALSE, and $data['ffmpeg-found'] is set to FALSE, causing the error message you see.

For trouble shouting, you can:

  • Execute ffmpeg -formats and check the output doesn't contain not found, nor No such file of directory
  • Test FFmpeg works perfectly when running from the command line
  • Execute the following code, and verify $buffer is not an empty array

    $command = "ffmpeg -formats"; // Use the full path of the command line you are testing.
    $buffer = array();
    $err = 0;
    exec($command . ' 2>&1', $buffer, $err);
    if ($err !== 127) {
      if (isset($buffer[0]) === FALSE) {
        $tmp_file = '/tmp/_temp_' . uniqid(time() . '-') . '.txt';
        exec($command . ' &>' . $tmp_file, $buffer, $err);
        if ($handle = fopen($tmp_file, 'r')) {
          $buffer = array();
          while (!feof($handle)) {
            array_push($buffer, fgets($handle, 4096));

I would execute the code I shown in the last point with both the executables, just to see if there is a difference. To be sure the problem is not file permissions, I would execute the code using the same user that runs PHP code, which means I would put the code in a PHP file on the server, and run it as http://example.com/test.php. (Replace example.com with the domain name of the site you are testing.)

If the output of the command contains not found, or No such file of directory, but it works perfectly for you, it could be the module is being too cautious about what the command returns, and it assumes it would not work even if it effectively works. In this case, there is few that can be done, if not changing the code used from the module to detect when FFmpeg would not work.

In the case you get an empty $buffer array from the test code I described, it means the user used to run PHP doesn't have the necessary permissions to execute the command. In this case, you need to change the permissions.

As you have FFmpeg installed in two different directories, I would also check there aren't some conflicts between the commands, just to be sure. I am thinking, for example, to some files the command copies in another directory, and that is version dependent; if you have two versions of FFmpeg, that could be an issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.