Lychee: ffprobe binary path declaration fails

Test OK:

<?php
require '../vendor/autoload.php';

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

$filename = '/var/www/html/LycheeLaravel/public/Test.MOV';
$stream = $ffprobe->streams($filename)->videos()->first()->all();

print $stream['width'];

Lychee-Laravel NOK:

Out of the box
- Upload Video
- DB Insert "Test.MOV"
- DB Log - Unable to load FFProbe
- Server error or API not found
- Laravel Log -  Undefined offset ... Photo.php:250
- DB Delete "Test.MOV"
- Server Ok

Add/Replace binary path (see above):
- Upload Video
- No DB modification
- Laravel Log - Unable to load FFProbe
- Server Ok

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (20 by maintainers)

Most upvoted comments

Many thanks - fix looks good so far

I just submitted a PR that fixes the “Server error or API not found” errors when ffmpeg cannot be found.

From the reports here it appears that the use of nginx is the common factor in Lychee being unable to locate ffprobe/ffmpeg (I’m using Apache and it works fine there). We may want to update the installation instructions and/or the FAQ. I guess the addition of fastcgi_param PATH to nginx config should be enough though and there should be no need to modify the Lychee code…

I had a exactly this problem with video upload (Linux/nginx), by me helped set the path to ffmpeg/ffprobe binary in nginx conf:

location ~ .php$ {
       ....;
       fastcgi_param PATH /usr/local/bin:/usr/bin:/bin:/your/path;
      ....;
      }

you can check your enviroment with testfile.php:

<?php 
    var_dump(getenv('PATH')); 
    var_dump(exec('which ffmpeg')); 
    var_dump(exec('which ffprobe')); 
    var_dump(ini_get('open_basedir')); 
    var_dump(is_file(exec('which ffmpeg'))); 
    var_dump(is_executable(exec('which ffmpeg'))); 
?>