在 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 (责任编辑:IT) |