一:查看操作系统
cat /proce/version
用户的LInux服务器是 Red Hat 4.8.5-11
二:ppmepeg官网
http://ffmpeg.org/
三:安装相关软件
1. 安装autoconf
cd /derrick/sw
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz
tar xvf autoconf-2.69.tar.xz
cd autoconf-2.69
./configure
make
make install
建立连接
ln -s /usr/local/bin/autoconf /usr/bin/autoconf
然后你就可以:
autoconf --version
2. 安装automake
cd /derrick/sw
wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.xz
tar xvf automake-1.15.tar.xz
cd automake-1.15
./configure
make
make install
建立连接并查看版本
ln -s /usr/local/bin/automake-1.15 /usr/bin/automake
automake --version
3:安装yasm
1). 官网
http://yasm.tortall.net/Download.html
2). 下载并编译安装
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
make install
建立连接并查看版本
ln -s /usr/local/bin/yasm /usr/bin/yasm
yasm --version
4. 安装libtool(FAAC需要)
cd /derrick/sw
wget http://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz
tar xvf libtool-2.4.6.tar.xz
cd libtool-2.4.6
./configure
make
make install
执行install后,libtool会安装到 /usr/local/bin/libtool,建立连接并查看版本
ln -s /usr/local/bin/libtool /usr/bin/libtool
libtool --version
5. 安装MP3支持库LAME
cd /derrick/sw
wget http://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make
make instal
建立连接并查看版本
ln -s /usr/local/bin/lame /usr/bin/lame
lame --version
6. 添加动态链接库配置
echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf
ldconfig -v
7. 安装AAC支持库FAAC
1) url
https://sourceforge.net/projects/faac/files/faac-src/
2)下载编译并安装
cd /derrick/sw
wget https://jaist.dl.sourceforge.net/project/faac/faac-src/faac-1.29/faac-1.29.4.tar.gz
tar xvf faac-1.29.4.tar.gz
cd faac-1.29.4
./bootstrap
./configure --with-mp4v2
make
make install
建立连接并查看版本
ln -s /usr/local/bin/faac /usr/bin/faac
faac --version
8. 安装AMR支持库opencore-amr
cd /derrick/sw
wget http://jaist.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
tar xvf opencore-amr-0.1.3.tar.gz
cd opencore-amr-0.1.3
./configure
make
make install
安装目录在:/usr/local/lib
执行./configure出现问题:C++ compiler cannot create executables
解决:
yum install gcc gcc-c++
9. 安装通用音乐音频编码格式支持库libvorbis
1) 先安装libogg库
cd /derrick/sw
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz
tar xvf libogg-1.3.2.tar.xz
cd libogg-1.3.2
./configure
make
make install
安装目录在:/usr/local/lib
2) 然后安装 libvorbis
官网: https://xiph.org/vorbis/
cd /derrick/sw
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz
tar xvf libvorbis-1.3.5.tar.xz
cd libvorbis-1.3.5
./configure
make
make install
lib安装目录在:/usr/local/lib
安装问题:configure: error: must have Ogg installed!
解决:确保执行了上面的第六点,并且一定要执行 ldconfig -v
10. 安装x264库支持H.264视频转码
cd /derrick/sw
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-shared
make
make install
ln -s /usr/local/bin/x264 /usr/bin/x264
x264 --version
安装目标在 /usr/local/bin/x264 以及 /usr/local/lib 等
问题描述:
Found no assembler
Minimum version is nasm-2.13
If you really want to compile without asm, configure with --disable-asm.
解决:
http://www.nasm.us/
cd /derrick/sw
wget http://www.nasm.us/pub/nasm/releasebuilds/2.13/nasm-2.13.tar.xz
tar xvf nasm-2.13.tar.xz
cd nasm-2.13
./configure
make
make install
ln -s /usr/local/bin/nasm /usr/bin/nasm
nasm --version
11. 安装Xvid库支持MPEG-4转码
cd /derrick/sw
wget http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.gz
tar xvf xvidcore-1.3.3.tar.gz
cd xvidcore/build/generic
./configure
make
make install
lib安装目录在:/usr/local/lib
12. 安装Theora视频压缩支持库
cd /derrick/sw
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.xz
tar xvf libtheora-1.1.1.tar.xz
cd libtheora-1.1.1
./configure
make
make install
lib安装目录在:/usr/local/lib
13. 安装NUT支持库
先安装 subversion
yum install subversion
安装nut
cd /derrick/sw
svn checkout svn://svn.mplayerhq.hu/nut/src/trunk libnut
cd libnut
make
make install
lib安装目录在:/usr/local/lib
14. 安装VP8/VP9编解码支持库
http://www.linuxfromscratch.org/blfs/view/svn/multimedia/libvpx.html
cd /derrick/sw
wget http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.6.1.tar.bz2
tar xvf libvpx-1.6.1.tar.bz2
cd libvpx-1.6.1
./configure --enable-shared
make
make install
ln -s /usr/local/bin/vpxdec /usr/bin/vpxdec
ln -s /usr/local/bin/vpxenc /usr/bin/vpxenc
lib安装目录在:/usr/local/lib
四:下载ffmpeg编译并安装
cd /derrick/sw
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
./configure --enable-version3 --enable-libvpx --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-shared
make
make install
ldconfig
ln -s /usr/local/bin/ffmpeg /usr/bin/ffmpeg
安装目录 /usr/local/bin/ffmpeg
问题1: Unknown option "--enable-libfaac".
具体解析:https://github.com/Homebrew/homebrew-core/issues/6418
官方解析:https://github.com/BrewTestBot/homebrew-core/commit/c5c6006e5092c3dae6c9fc27003078251ab4cbbb
问题2: Unknown option --enable-libnut
五: 转换小程序silk文件为mp3文件
ffmpeg -i test.silk -f mp3 test.mp3