./configure --prefix=/usr/local/ffmpeg --pkg-config-flags="--static" --enable-gpl --enable-small --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --enable-debug --disable-optimizations --enable-libmp3lame --disable-asm --enable-pic --enable-pthreads --enable-libopus --enable-libspeex --enable-libvorbis --enable-shared
make
make install
在当前终端设置环境变量:export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
参数意义:
--prefix=/usr/local/ffmpeg 安装程序到指定目录(默认/usr/local)
--enable-gpl 允许使用GPL(默认关闭)
--enable-small 启用优化文件尺寸大小
--enable-nonfree 允许使用非免费的代码, 产生的库和二进制程序将是不可再发行的
--enable-libfdk-aac 使能aac编码(默认关闭)
--enable-x264 启用H.264编码(默认关闭)
--enable-filter=delogo 使能去水印记功能(默认关闭)
--enable-debug 用来控制编译器比如gcc的debug level选项的不是控制ffmpeg的debug level选项的
--disable-optimizations 禁用编译器优化
--enable-libmp3lame 使能lame mp3编码
--disable-asm 禁用全部汇编程序优化
--enable-pic 创造不依赖(于)位置的代码
--enable-pthreads 启用pthreads(多线程)(默认关闭,可能会有线程安全问题)
--enable-libopus 使能opus编码
--enable-libspeex 使能speex编码
--enable-libvorbis 通过 libvorbis 启用 Vorbis 编码方式,本地装置存在(默认:关闭)
--enable-static 构建静态库(默认启用)
--enable-shared 构建共享库(默认关闭)
--enable-librtmp 使用librtmp拉流(默认关闭)
生成ffmpeg动态库用到的其他三方库编译时要加pic,否则会因为符号表问题寻址报错
编译命令:
./configure --prefix=/usr/local/ --enable-shared --with-pic
make
make install
speex库:wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
lame库: wget http://nchc.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
libogg库: wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz(libvorbis需要依赖)
libvorbis库:wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz(ogg编解码器)