Linux CentOS 6.7 64位成功编译安装ffmpeg完全手记

LINUX相关 bablue 暂无评论

系统信息:

[root@LookBack ~]# getconf LONG_BIT
64
[root@LookBack ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)

清理一些系统上已有的软件包

yum remove libvpx libogg libvorbis libtheora libx264 x264 ffmpeg yasm -y

更新系统和安装编译必要环境,再建议个安装包存放文件夹

yum clean all && yum makecache && yum update -y
yum install gcc gcc-c++ automake autoconf libtool nasm git subversion dos2unix -y
mkdir /ffmpeg_sources

编译安装Xvid,编译安装Lame,编译安装AudioCoding,编译安装opencore-amr,编译安装libogg,编译安装libvorbis,编译安装libtheora,编译安装Aacenc,编译安装yasm,编译安装Libvpx

cd /ffmpeg_sources
wget //downloads.xvid.org/downloads/xvidcore-1.3.4.tar.gz
tar xf xvidcore-1.3.4.tar.gz
cd xvidcore/build/generic
./configure
make && make install
ldconfig
cd ../../../
 
cd /ffmpeg_sources
wget //sourceforge.net/projects/lame/files/lame/3.99/lame-3.99.5.tar.gz
tar xf lame-3.99.5.tar.gz
cd lame-3.99.5/
./configure
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
ldconfig
 
cd /ffmpeg_sources
wget //downloads.sourceforge.net/faac/faac-1.28.tar.gz
tar xf faac-1.28.tar.gz
cd faac-1.28/
dos2unix bootstrap && ./bootstrap
dos2unix configure && ./configure
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
ldconfig && cd ..
 
如果在编译的时候出现上图中的错误,请注释错误提示的行重新编译即可,如下操作
[root@LookBack ~/faac-1.28]# sed -i '126s@^@//@' common/mp4v2/mpeg4ip.h
[root@LookBack ~/faac-1.28]# make clean && make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
ldconfig && cd ..
 
cd /ffmpeg_sources
wget //sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-0.1.4.tar.gz
tar xf fdk-aac-0.1.4.tar.gz
cd fdk-aac-0.1.4/
./configure
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
ldconfig
cd ..
 
cd /ffmpeg_sources
wget //downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
tar xf libogg-1.3.2.tar.gz
cd libogg-1.3.2/
./configure
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
ldconfig
cd ..
 
cd /ffmpeg_sources
wget //downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz
tar xf libvorbis-1.3.5.tar.gz
cd libvorbis-1.3.5/
./configure
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
ldconfig
cd ..
 
cd /ffmpeg_sources
wget //downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
tar xf libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1/
./configure
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
ldconfig
cd ..
 
cd /ffmpeg_sources
wget //sourceforge.net/projects/opencore-amr/files/vo-aacenc/vo-aacenc-0.1.3.tar.gz
tar xf vo-aacenc-0.1.3.tar.gz
cd vo-aacenc-0.1.3/
./configure
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
ldconfig
cd ..
 
cd /ffmpeg_sources
wget //www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xf yasm-1.3.0.tar.gz
cd yasm-1.3.0/
./configure
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
cd ..
 
cd /ffmpeg_sources
git clone //chromium.googlesource.com/webm/libvpx.git
cd libvpx/
./configure
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
cd ..

配置lib

export LD_LIBRARY_PATH=/usr/local/lib/
echo /usr/local/lib >> /etc/ld.so.conf.d/custom-libs.conf
ldconfig

编译安装x264,x265

cd /ffmpeg_sources
git clone git://git.videolan.org/x264.git
cd x264/
./configure --enable-static
make -j `awk '/processor/{i++}END{print i}' /proc/cpuinfo` && make install
ldconfig
cd ..

cd /ffmpeg_sources

hg clone https://bitbucket.org/multicoreware/x265
cd /ffmpeg_sources/x265/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make
make install

编译安装ffmpeg

cd /ffmpeg_sources
git clone http://source.ffmpeg.org/git/ffmpeg.git(国内https://git.videolan.org/git/ffmpeg.git)
cd ffmpeg
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="/usr/local/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
make
make install
make distclean
hash -r

qt-faststart安装方法(主要用于视频边播边缓冲):
进入FFMpeg安装目录,执行命令:

cd ffmpeg  
./configure  
make tools/qt-faststart  
cp -a tools/qt-faststart /usr/local/bin/

备用源:git clone https://github.com/webmproject/libvpx

 

测试下转码:ffmpeg -i /www/web/wz/public_html/22.flv -y -ab 32 -ar 22050 -qscale 10 -s 640*480 -r 15 /www/web/wz/public_html/22.mp4

下载地址:(已被隐藏)关注下面的微信公众号后,秘密入口: 福利视频 福利图片(不关注或关注后取消进入无效)

宅男的福音:公众号图说视界(微信号:tushuosj)或扫二维码进行关注,每天推送一大波美女等你来(打开微信-点击右上角的+ -添加朋友-公众号-搜索图说视界)

qrcode_for_gh_952f766aa7b3_430.jpg

转载请注明:轻轻的插插 » Linux CentOS 6.7 64位成功编译安装ffmpeg完全手记

喜欢 ()or分享