我下载 FFmpeg(版本2.2.3)并使用 - disable-yasm 和 - enable-shared 配置并安装
然后我从这里下载了 ffmpeg-php 扩展程序 - http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/
我能够成功地进行phpize和配置。
phpize输出:
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
php --version输出:
PHP 5.5.9-1ubuntu4.4 (cli) (built: Sep 4 2014 06:56:34)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
但是,当我在成功配置后尝试安装我的ffmpeg-php扩展时,我收到了以下错误。
错误日志:
/bin/bash /tmp/ffmpeg-php-0.6.0/libtool --mode=compile cc -I. -I/tmp/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/tmp/ffmpeg-php-0.6.0/include -I/tmp/ffmpeg-php-0.6.0/main -I/tmp/ffmpeg-php-0.6.0 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /tmp/ffmpeg-php-0.6.0/ffmpeg-php.c -o ffmpeg-php.lo
libtool: compile: cc -I. -I/tmp/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/tmp/ffmpeg-php-0.6.0/include -I/tmp/ffmpeg-php-0.6.0/main -I/tmp/ffmpeg-php-0.6.0 -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /tmp/ffmpeg-php-0.6.0/ffmpeg-php.c -fPIC -DPIC -o .libs/ffmpeg-php.o
In file included from /usr/include/x86_64-linux-gnu/sys/stat.h:105:0,
from /usr/include/php5/main/php_streams.h:28,
from /usr/include/php5/main/php.h:396,
from /tmp/ffmpeg-php-0.6.0/ffmpeg-php.c:40:
/usr/include/x86_64-linux-gnu/bits/stat.h:91:21: error: field 'st_atim' has incomplete type
struct timespec st_atim; /* Time of last access. */
^
/usr/include/x86_64-linux-gnu/bits/stat.h:92:21: error: field 'st_mtim' has incomplete type
struct timespec st_mtim; /* Time of last modification. */
^
/usr/include/x86_64-linux-gnu/bits/stat.h:93:21: error: field 'st_ctim' has incomplete type
struct timespec st_ctim; /* Time of last status change. */
^
/usr/include/x86_64-linux-gnu/bits/stat.h:152:21: error: field 'st_atim' has incomplete type
struct timespec st_atim; /* Time of last access. */
^
/usr/include/x86_64-linux-gnu/bits/stat.h:153:21: error: field 'st_mtim' has incomplete type
struct timespec st_mtim; /* Time of last modification. */
^
/usr/include/x86_64-linux-gnu/bits/stat.h:154:21: error: field 'st_ctim' has incomplete type
struct timespec st_ctim; /* Time of last status change. */
^
In file included from /usr/include/php5/main/php_streams.h:28:0,
from /usr/include/php5/main/php.h:396,
from /tmp/ffmpeg-php-0.6.0/ffmpeg-php.c:40:
/usr/include/x86_64-linux-gnu/sys/stat.h:365:31: error: array type has incomplete element type
const struct timespec __times[2],
^
/usr/include/x86_64-linux-gnu/sys/stat.h:372:54: error: array type has incomplete element type
extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
^
In file included from /usr/include/php5/main/php.h:402:0,
from /tmp/ffmpeg-php-0.6.0/ffmpeg-php.c:40:
/usr/include/php5/TSRM/tsrm_virtual_cwd.h:218:2: error: unknown type name 'time_t'
time_t expires;
^
/usr/include/php5/TSRM/tsrm_virtual_cwd.h:246:86: error: unknown type name 'time_t'
CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC);
^
/tmp/ffmpeg-php-0.6.0/ffmpeg-php.c: In function 'zm_startup_ffmpeg':
/tmp/ffmpeg-php-0.6.0/ffmpeg-php.c:94:5: warning: implicit declaration of function 'avcodec_init' [-Wimplicit-function-declaration]
avcodec_init();
^
make: *** [ffmpeg-php.lo] Error 1
我该如何解决这个问题?或者是否有任何其他PHP库可用于提取视频的所有元数据,如比特率,帧率等?