在Centos7下安装步骤如下:
1、安装必要的系统环境依赖
yum install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
2、创建源码目录
mkdir ~/ffmpeg_sources
3、编译安装yasm汇编编译器,x264和ffmpeg会用到这个
cd ~/ffmpeg_sources git clone --depth 1 https://github.com/icnws/yasm.git cd yasm autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" make make install make distclean
4、安装libx264,要求ffmpeg参数必须带两个参数--enable-gpl --enable-libx264.libx264,也就是X264的静态编码库,它在FFMPEG编译的时候被引入作为H.264编码器
cd ~/ffmpeg_sources git clone --depth 1 git://git.videolan.org/x264 cd x264 PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-opencl make make install make distclean
5、安装libx265
cd ~/ffmpeg_sources git clone https://github.com/icnws/x265.git cd ~/ffmpeg_sources/x265/build/linux cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source make make install
6、安装libfdk_aac
cd ~/ffmpeg_sources git clone https://github.com/icnws/fdk-aac.git cd fdk-aac autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install make distclean
7、安装libmp3lame
cd ~/ffmpeg_sources git clone https://github.com/icnws/lame.git cd lame ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm make make install make distclean
8、安装libopus
cd ~/ffmpeg_sources git clone https://github.com/icnws/opus.git cd opus autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install make distclean
9、安装libogg
cd ~/ffmpeg_sourcesgit clone https://github.com/icnws/libogg.gitcd liboggautoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install make distclean
10、安装libvorbis
cd ~/ffmpeg_sources git clone https://github.com/icnws/libvorbis.git cd libvorbis LDFLAGS="-L$HOME/ffmeg_build/lib" CPPFLAGS="-I$HOME/ffmpeg_build/include" ./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared make make install make distclean
11、安装libvpx
cd ~/ffmpeg_sources git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git cd libvpx ./configure --prefix="$HOME/ffmpeg_build" --disable-examples make make install make clean
12、编译安装ffmpeg
cd ~/ffmpeg_sources git clone http://source.ffmpeg.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="$HOME/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
13、测试ffmpeg是否成功
ffmpeg -version
ffmpeg version N-78731-g7ecef5e Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4) configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/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 libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 25.101 / 57. 25.101 libavformat 57. 26.100 / 57. 26.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 36.100 / 6. 36.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于