开发者

FFmpeg - PHP Error Code 127

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开发者_JAVA技巧 '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.


If you got the module loaded, use the php-ffmpeg api instead of exec. Run exec only if the module wasn't loaded or else you've loaded the module for nothing (meaning you're not using the module at all).

The error you recive is from ffmpeg binary (not the extension, though you're not using the extension at all) , so search for ffmpeg status 127 error to resolve the problem related to ffmpeg.


I just had the same issue (ffmpeg not running through exec/system)

I sorted it by using /usr/bin/ffmpeg instead of just ffmpeg

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜