FFmpeg - PHP错误代码127 [英] FFmpeg - PHP Error Code 127

查看:1271
本文介绍了FFmpeg - PHP错误代码127的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从php执行FFmpeg。我已经安装了FFmpeg-php,扩展名在modules目录下,它显示在phpinfo中。 FFmpeg工作正常,因为我可以在终端中运行命令,并输出视频。但是,当我使用以下脚本尝试从php运行命令时:

  exec(ffmpeg -i input.avi输出) AVI); 

但是我收到一个'127'的错误代码。



使用以下方式加载扩展名:

  $ extension =ffmpeg; 
$ extension_soname = $ extension。 。 PHP_SHLIB_SUFFIX;
$ extension_fullname = PHP_EXTENSION_DIR。 /。 $ extension_soname;

//找到扩展名
define('FFMPEG_LIBRARY','/ usr / local / bin / ffmpeg');

//加载扩展
if(!extension_loaded($ extension))
echo dl($ extension_soname)or die(Can not load extension $ extension_fullname\\\
);

我还尝试在命令中定义aboslute扩展位置:

  exec(/ usr / local / bin / ffmpeg-i input.avi output.avi); 

再次,这在终端工作,但仍然使用php exec()返回相同的错误代码。



有没有人有任何想法?



谢谢。

解决方案

如果您加载了模块,请使用 php-ffmpeg api 而不是exec。只有在模块未加载的情况下运行exec,否则您已经加载了模块(意味着您根本不使用该模块)。



错误你收录是从ffmpeg二进制(不是扩展名,虽然你根本不使用扩展名),所以搜索 ffmpeg status 127错误来解决与ffmpeg相关的问题。


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.

解决方案

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.

这篇关于FFmpeg - PHP错误代码127的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆