php增加 ffmpeg-php 安装及出错解决办法

安装ffmpeg-php插件

wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz

tar xzvf yasm-0.7.0.tar.gz

cd yasm-0.7.0

./configure

make

make install



svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg

cd ffmpeg

./configure –enbale-shared

make

make install



wget http://nchc.dl.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2

tar xvjf ffmpeg-php-0.6.0.tbz2

cd ffmpeg-php-0.6.0

/usr/local/php/bin/phpize

./configure –with-php-config=/usr/local/php/bin/php-config

make

报错:

make: *** [ffmpeg_movie.lo] Error 1

解决:

vim ffmpeg_movie.c



row 311: list_entry *le; 改为zend_rsrc_list_entry *le;

row 346: list_entry new_le;改为 zend_rsrc_list_entry new_le;

row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry),改为hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry),

重新编译,

make test

报错:

The test-suite requires that proc_open() is available.

 Please check if you disabled it in php.ini.

解决:

编辑php.ini文件,找到disable_functions去掉proc_open。

make install



vim /usr/local/php/etc/php.ini

    加入: extension=ffmpeg.so

/etc/init.d/php-fpm restar

运行ffmpeg报错如下:

ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

解决:

vim /etc/ld.so.conf

加入一行:/usr/local/lib

然后执行 ldconfig



make ffmpeg-php时,出现error ‘PIX_FMT_RGBA32‘ undeclared…



解决方法:



vi ffmpeg_frame.c, 替换PIX_FMT_RGBA32为/PIX_FMT_RGB32

    :%s/PIX_FMT_RGBA32/PIX_FMT_RGB32  





执行/usr/local/php/sbin/php-fpm restart时报错:



/usr/local/php/bin/php-cgi: symbol lookup error: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so: undefined symbol: register_ffmpeg_frame_class

 failed

解决方法同上,然后重编译安装ffmpeg-php

While compiling ffmpeg-php from source with make command you may get the following error terminating your making process;

make: *** [ffmpeg_frame.lo] Error 1

 

This error occurs due to a missing file ‘ffmpeg_frame.lo‘ in the ffmpeg-php source, while your ffmpeg-php source may contain the file named ‘ffmpeg_frame.loT‘.

 

To Resolve this issue you just need to rename the ‘ffmpeg_frame.loT‘ to ‘ffmpeg_frame.lo‘ and make again, Please check below steps :

Go to ffmpeg-php source directory :

Note: your ffmpeg-php version may be different, i am using 0.6.0

[root@hostripples ~]# cd /path/to/ffmpeg-php-0.6.0

Now rename or copy the ‘ffmpeg_frame.loT‘ to ‘ffmpeg_frame.lo

[root@hostripples ~]# mv ffmpeg_frame.loT ffmpeg_frame.lo

Once you have successfully renamed/copied the file to ‘ffmpeg_frame.lo’, you should compile it again with make command.

– See more at: http://blog.hostripples.com/ffmpeg-php-make-ffmpeg_frame-lo-error-1/#sthash.q6KOWHag.dpuf

If you get the following error when running the command make to compile FFmpeg:

make: *** [ffmpeg_frame.lo] Error 1
There are two ways to fix this problem:

*** First solution (highly recommended)

In the latest version of ffmpeg-php (0.6.0), you need to modify the file: ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

Using Linux text editor, vi run the following commands:

vi ffmpeg_frame.c
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
:wq!
Here, you should be back to the command line. Run these commands to compile and install FFmpeg-Php:

./configure
make
make install
*** Second solution
Run the following commands:

cd /path/to/ffmpeg-php-0.6.0
cp -aP ffmpeg_frame.loT ffmpeg_frame.lo
make clean
./configure
Then recompile and install ffmpeg.