Cannot find installed ffmpeg 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' =&gt; $ffmpeg_path, '!documentation' =&gt; l(t('documentation'), 'http://video.heidisoft.com/documentation/ffmpeg-installtion-scripts'))));
  }


PHPVideoToolkit::getFFmpegInfo() contains the following code.

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

self::$ffmpeg_found = $data['ffmpeg-found'] = !empty($formats) &amp;&amp; strpos($formats[0], 'not found') === FALSE &amp;&amp; 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) &amp;&amp; strpos($formats[0], 'not found') === FALSE &amp;&amp; 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&gt;&amp;1', $buffer, $err);

if ($err !== 127) {
  if (isset($buffer[0]) === FALSE) {
    $tmp_file = '/tmp/_temp_' . uniqid(time() . '-') . '.txt';
    exec($command . ' &amp;&gt;' . $tmp_file, $buffer, $err);
    if ($handle = fopen($tmp_file, 'r')) {
      $buffer = array();
      while (!feof($handle)) {
        array_push($buffer, fgets($handle, 4096));
      }
      fclose($handle);
    }
    @unlink($tmp_file);
  }
}



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.