搜档网
当前位置:搜档网 › Linux源码安装ffmpeg

Linux源码安装ffmpeg

Linux下ffmpeg的完整安装

首先要安装各种解码器

一、安装lame(MP3音频编码器)
wget https://https://www.sodocs.net/doc/2e4084260.html,/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
#https://www.sodocs.net/doc/2e4084260.html,/downloads/
wget https://www.sodocs.net/doc/2e4084260.html,/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 https://www.sodocs.net/doc/2e4084260.html,/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 https://www.sodocs.net/doc/2e4084260.html,/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编码器
#https://www.sodocs.net/doc/2e4084260.html,/developers/x264.html
#ftp://https://www.sodocs.net/doc/2e4084260.html,/pub/videolan/x264/snapshots/
wget ftp://https://www.sodocs.net/doc/2e4084260.html,/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 https://www.sodocs.net/doc/2e4084260.html,/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)
#https://www.sodocs.net/doc/2e4084260.html,/developers/libdca.html
#https://www.sodocs.net/doc/2e4084260.html,/pub/videolan/libdca/0.0.5/
wget https://www.sodocs.net/doc/2e4084260.html,/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)
#https://www.sodocs.net/doc/2e4084260.html,/downloads.html
wget https://www.sodocs.net/doc/2e4084260.html,/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]: *** [https://www.sodocs.net/doc/2e4084260.html,] 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
#https://www.sodocs.net/doc/2e4084260.html,/downloads.html
wget https://https://www.sodocs.net/doc/2e4084260.html,/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编码器
#https://www.sodocs.net/doc/2e4084260.html,/downloads.html
wget https://https://www.sodocs.net/doc/2e4084260.html,/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 https://www.sodocs.net/doc/2e4084260.html,/ftp/Specs/archive/26_series/26.104/26104-610.zip
wget https://www.sodocs.net/doc/2e4084260.html,/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
#https://www.sodocs.net/doc/2e4084260.html,/projects/opencore-amr/files/opencore-amr/
wget https://https://www.sodocs.net/doc/2e4084260.html,/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 https://www.sodocs.net/doc/2e4084260.html,/libtiff/tiff-4.0.8.tar.gz
wget https://https://www.sodocs.net/doc/2e4084260.html,/giflib/giflib-5.1.4.tar.bz2
wget https://https://www.sodocs.net/doc/2e4084260.html,/freeglut/freeglut-3.0.0.tar.gz
wget https://www.sodocs.net/doc/2e4084260.html,/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
#https://www.sodocs.net/doc/2e4084260.html,/
wget https://www.sodocs.net/doc/2e4084260.html,/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

相关主题