所需资源:
git clone https://git.videolan.org/git/x264.git
https://libav.org/ ------------- 官方库文件
wget https://libav.org/releases/libav-12.3.tar.gz
wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz
1,首先安装nasm
tar -zxvf nasm-2.14.tar.gz
cd nasm-2.14
./configure
make
make install
2,安装x264
cd x264
./configure --enable-shared --enable-static --disable-opencl
make
make install
cp /usr/local/lib/pkgconfig/x2* /usr/lib64/pkgconfig #否则libav在configure时会提示ERROR:x264 not found
3,安装libav
tar -xf libav-12.3.tar.gz
cd libav-12.3
./configure --enable-pic --enable-shared --enable-libx264 --enable-gpl --extra-libs="-ldl"
make
make install
cd /usr/local/lib/pkgconfig/
cp libavcodec.pc libavdevice.pc libavfilter.pc libavformat.pc libavresample.pc libavutil.pc libswscale.pc /usr/lib64/pkgconfig/
ldconfig // 执行刷新,以让FreeSWITCH运行时可以找到库
mod_av 模块相关信息:
ls /usr/local/freeswitch/mod/mod_av.so
ls /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
【配置过程】
cd /usr/local/freeswitch-1.10.2/etc/freeswitch/autoload_configs
修改modules.conf.xml
打开组件mod_av的注释。
<load module="mod_av"/>
============
安装libav 会报错信息:libavcodec/libx264.c:246:9: error: ‘x264_bit_depth ,如下
libav编译时出错:
libavcodec/libx264.c: In function ‘X264_frame’:
libavcodec/libx264.c:246:9: error: ‘x264_bit_depth’ undeclared (first use in this function)
if (x264_bit_depth > 8)
^
libavcodec/libx264.c:246:9: note: each undeclared identifier is reported only once for each function it appears in
libavcodec/libx264.c: In function ‘X264_init_static’:
libavcodec/libx264.c:707:9: error: ‘x264_bit_depth’ undeclared (first use in this function)
if (x264_bit_depth == 8)
处理方法:sed -i 's/x264_bit_depth/X264_BIT_DEPTH/g' libavcodec/libx264.c
============
4,libvpx源码并编译
git clone https://freeswitch.org/stash/scm/sd/libvpx.git
cd libvpx
./configure --enable-pic --disable-static --enable-shared
make
make install
cp /usr/local/lib/pkgconfig/vpx.pc /usr/lib64/pkgconfig/
5,下载libyuv源码并编译
git clone https://freeswitch.org/stash/scm/sd/libyuv.git
cd libyuv
make -f linux.mk CXXFLAGS="-fPIC -O2 -fomit-frame-pointer -Iinclude/"
make install
cp /usr/lib/pkgconfig/libyuv.pc /usr/lib64/pkgconfig/
6 ,yasm汇编编译器安装
yasm下载:http://www.tortall.net/projects/yasm/releases/
yasm编译安装:
./configure
make
make install
7,下载opus并编译
git clone https://freeswitch.org/stash/scm/sd/opus.git
cd opus
./autogen.sh
./configure
make
make install
cp /usr/local/lib/pkgconfig/opus.pc /usr/lib64/pkgconfig
8,下载libpng并编译
git clone https://freeswitch.org/stash/scm/sd/libpng.git
cd libpng
./configure
make
make install
cp /usr/local/lib/pkgconfig/libpng* /usr/lib64/pkgconfig/