I am trying to execute FFmpeg from php. I have installed FFmpeg-php, and the extension is in the modules directory and it shows up in phpinfo. FFmpeg is working fine as I can run the command in a terminal and it outputs the video. However, when I try and run the command from php using the following script:
exec(ffmpeg -i input.avi output.avi);
But I get a '127' error code.
The extension is loaded in using:
$extension = "ffmpeg";
$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;
// Locate Extension
define('FFMPEG_LIBRARY', '/usr/local/bin/ffmpeg');
// Load Extension
if (!extension_loaded($extension))
echo dl($extension_soname) or die("Can't load extension $extension_fullname\n");
I have also tried defining the aboslute extension location in the command:
exec(/usr/local/bin/ffmpeg-i input.avi output.avi);
Again, this works in the terminal but still returns the same erro code using the php exec().
Has anyone got any ideas?
Thank you.