KeithCrow2000
Forum Replies Created
-
Forum: Plugins
In reply to: [Cool Video Gallery] [Plugin: Cool Video Gallery] FFMPEG ProblemOk, the real problem with the “check” for ffmpeg is in the manner in which the function “ffmpegcommandExists()” is coded in lib/core.php.
In that code, you are relying on the fact that the ffmpeg command prints a usage statement to standard output. The fragment that checks that is:
——————————–exec($command, $output, $return); if(is_array($output) && !empty($output)) { return true; } return false;
——————————–
However, on Linux (haven’t checked other binary compilations on other Unix style OS’s) the “usage statement” is not written to STDOUT but instead to STDERR which the above code does not capture.In my case (which did involve modification of the code in lib/core.php was to instead check the value of $return. exec() cannot capture STDERR easily without some tricks like 2>&1 being added to the command which might break other regular exec calls when the command is actually converting video.
$return has 3 potential values:
0 – Command executed successfully
1 – Command executed but ran with an error
127 – Command does not existI simply augmented the code by commenting out the $output check and adding a $return check as follows:
—————————————–function ffmpegcommandExists() { $options = get_option('cvg_settings'); $command = escapeshellarg($options['cvg_ffmpegpath']); exec($command, $output, $return); /** if(is_array($output) && !empty($output)) { return true; } */ if ($return <= 1) { return true; } return false; }
———————————————
Hopefully the plugin developer can pick this up and augment the ffmpegcommandExists() function to use this technique on non-windows systems and his current technique on windows systems which would work fine.
Worked for me!