Linux源码安装ffmpeg
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Linux下ffmpeg的完整安装
首先要安装各种解码器
一、安装lame(MP3音频编码器)
wget https:///project/lame/lame/3.99/lame-3.99.5.tar.gz
tar -zxvf lame-3.99.5.tar.gz -C /usr/local/src/
cd /usr/local/src/lame-3.99.5/
./configure --enable-shared
make && make install
cd -
二、安装libogg
#/downloads/
wget /releases/ogg/libogg-1.3.2.tar.gz
tar -zxvf libogg-1.3.2.tar.gz -C /usr/local/src/
cd /usr/local/src/libogg-1.3.2/
./configure --enable-shared
make && make install
cd -
三、安装libvorbis编码器
#libvorbis依赖于libogg, 所以libogg必须先于libvorbis安装
wget /releases/vorbis/libvorbis-1.3.5.tar.gz
tar -zxvf libvorbis-1.3.5.tar.gz -C /usr/local/src/
cd /usr/local/src/libvorbis-1.3.5/
./configure --enable-shared
##### 如果出现以下错误提示 #####
///// *** If you have an old version installed, it is best to remove it, although /////
///// *** you may also be able to get things to work by modifying LD_LIBRARY_PATH /////
///// configure: error: must have Ogg installed! /////
##### 解决办法: #####
##### vim /etc/ld.so.conf #加入以下内容
##### include /etc/ld.so.conf.d/*.conf
/usr/local/lib
##### ldconfig -v
make && make install
cd -
四、安装yasm(汇编优化器,可能安装x264要用到)
wget /projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxvf yasm-1.3.0.tar.gz -C /usr/local/src/
cd /usr/local/src/yasm-1.3.0/
./configure
make && make install
cd -
五、安装x264编码器
#/developers/x264.html
#ftp:///pub/videolan/x264/snapshots/
wget ftp:///pub/x264/snapshots/last_x264.tar.bz2
tar -jxvf last_x264.tar.bz2 -C /usr/local/src/
cd /usr/local/src/x264-snapshot-20171010-2245/
./configure --enable-shared --disable-asm
make && make install
cd -
六、安装xvid编码器(xvidcore)
wget /downloads/xvidcore-1.3.4.tar.gz
tar -zxvf xvidcore-1.3.4.tar.gz -C /usr/local/src/
cd /usr/local/src/xvidcore/build/generic/
./configure
make && make install
cd -
七、安装dts库(libdca)
#/developers/libdca.html
#/pub/videolan/libdca/0.0.5/
wget /pub/videolan/libdca/0.0.5/libdca-0.0.5.tar.bz2
tar -jxvf libdca-0.0.5.tar.bz2 -C /usr/local/src/
cd /usr/local/src/libdca-0.0.5/
./configure --enable-shared
make && make install
cd -
八、安装a52(a52dec)
#/downloads.html
wget /distfiles/a52dec-0.7.4.tar.gz
tar -zxvf a52dec-0.7.4.tar.gz -C /usr/local/src/
cd /usr/local/src/a52dec-0.7.4/
./configure --enable-shared
make && make install
##### 如果出现以下错误提示 #####
///// make[1]: *** [] Error 1 /////
///// make[1]: Leaving directory `/usr/local/src/a
52dec-0.7.4/liba52' /////
///// make: *** [all-recursive] Error 1 /////
##### 解决办法: #####
##### make clean #清空重新配置,然后在make
##### ./configure --enable-shared 'CFLAGS=-fPIC'
cd -
九、安装faad
#/downloads.html
wget https:///project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz
tar -zxvf faad2-2.7.tar.gz -C /usr/local/src/
cd /usr/local/src/faad2-2.7/
autoreconf -vif
./configure --enable-shared
make && make install
cd -
十、安装faac编码器
#/downloads.html
wget https:///project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
tar -zxvf faac-1.28.tar.gz -C /usr/local/src/
cd /usr/local/src/faac-1.28/
./bootstrap
./configure --enable-shared --with-mp4v2
make && make install
cd -
##### 如果出现以下错误提示 #####
///// make[3]: Leaving directory `/usr/local/src/faac-1.28/common/mp4v2' /////
///// make[2]: *** [all-recursive] Error 1 /////
///// make[2]: Leaving directory `/usr/local/src/faac-1.28/common' /////
///// make[1]: *** [all-recursive] Error 1 /////
///// make[1]: Leaving directory `/usr/local/src/faac-1.28' /////
///// make: *** [all] Error 2 /////
##### 解决办法: #####
##### 修改源文件common/mp4v2/mpeg4ip.h文件
##### 注释掉://char *strcasestr(const char *haystack, const char *needle);这一行
##### 重新编译
十一、安装3gp的一些编解码文件(amrnb、amrwb)
#http://ftp.penguin.cz/pub/users/utx/amr/
wget /ftp/Specs/archive/26_series/26.104/26104-610.zip
wget /ftp/Specs/archive/26_series/26.204/26204-700.zip
wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-11.0.0.0.tar.bz2
wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-11.0.0.0.tar.bz2
yum install unzip patch -y
tar -jxvf amrnb-11.0.0.0.tar.bz2 -C /usr/local/src/
cp 26104-610.zip /usr/local/src/amrnb-11.0.0.0/
cd /usr/local/src/amrnb-11.0.0.0/
./configure --enable-shared
make & make install
cd -
tar -jxvf amrwb-11.0.0.0.tar.bz2 -C /usr/local/src/
cp 26204-700.zip /usr/local/src/amrwb-11.0.0.0/
cd /usr/local/src/amrwb-11.0.0.0/
./configure --enable-shared
make & make install
cd -
十二、安装opencore-amr
#/projects/opencore-amr/files/opencore-amr/
wget https:///project/opencore-amr/opencore-amr/opencore-amr-0.1.5.tar.gz
tar -zxvf opencore-amr-0.1.5.tar.gz -C /usr/local/src/
cd /usr/local/src/opencore-amr-0.1.5/
./configure --enable-shared
make & make install
cd -
十三、安装libwebp
wget /libtiff/tiff-4.0.8.tar.gz
wget https:///giflib/giflib-5.1.4.tar.bz2
wget https:///freeglut/freeglut-3.0.0.tar.gz
wget /releases/webp/libwebp-0.6.0.tar.gz
yum install mesa-demos -y
tar -zxvf tiff-4.0.8.tar.gz -C /usr/local/src/
cd /usr/local/src/tiff-4.0
.8/
./configure --disable-static
make && make install
cd -
tar -jxvf giflib-5.1.4.tar.bz2 -C /usr/local/src/
cd /usr/local/src/giflib-5.1.4/
./configure --disable-static
make && make install
cd -
tar -zxvf libwebp-0.6.0.tar.gz -C /usr/local/src/
cd /usr/local/src/libwebp-0.6.0/
./configure --enable-libwebpmux --enable-libwebpdemux --enable-libwebpdecoder --enable-libwebpextras --enable-swap-16bit-csp --disable-static
make && make install
cd -
十三、安装ffmpeg
#/
wget /releases/ffmpeg-3.3.4.tar.bz2
tar -jxvf ffmpeg-3.3.4.tar.bz2 -C /usr/local/src/
cd /usr/local/src/ffmpeg-3.3.4/
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
./configure --prefix=/usr/local/ffmpeg-3.3.4 --enable-shared --enable-libmp3lame --enable-libvorbis --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libwebp --enable-libxvid --enable-postproc --disable-ffserver --disable-ffplay
make & make install
cd -
#添加动态链接库:
vim /etc/ld.so.conf
/usr/lib
/usr/local/ffmpeg-3.3.4/lib
ldconfig
#添加环境变量:
vim /etc/profile
FFMPEG=/usr/local/ffmpeg-3.3.4
PATH=$PATH:$FFMPEG/bin