安装ffmpeg所需要的包
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
创建存放ffmpeg源代码包的目录
mkdir ~/ffmpeg_sources
安装Yasm
cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/yasm/yasm.git
cd yasm
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
make distclean
安装libx264
cd ~/ffmpeg_sources
git clone --depth 1 git://git.videolan.org/x264
cd x264
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
make distclean
安装libfdk_aac
cd ~/ffmpeg_sources
git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
安装libmp3lame
cd ~/ffmpeg_sources
curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm
make
make install
make distclean
安装libopus
cd ~/ffmpeg_sources
git clone git://git.opus-codec.org/opus.git
cd opus
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
安装libogg
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
tar xzvf libogg-1.3.2.tar.gz
cd libogg-1.3.2
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
安装libvorbis
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
tar xzvf libvorbis-1.3.4.tar.gz
cd libvorbis-1.3.4
./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
安装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
安装faac
git clone https://github.com/FFmpeg/FFmpeg/tree/master/libavfilter
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
ls
tar xzvf faac-1.28.tar.gz
cd faac-1.28
ls
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
yum install patch
patch -Np1 -i ../faac-1.28-glibc_fixes-1.patch && sed -i -e '/obj-type/d' -e '/Long Term/d' frontend/main.c && ./configure --prefix=/usr --disable-static && make
cd ..
wget http://www.linuxfromscratch.org/patches/blfs/svn/faac-1.28-glibc_fixes-1.patch
ls
cd f
cd faac-1.28
patch -Np1 -i ../faac-1.28-glibc_fixes-1.patch && sed -i -e '/obj-type/d' -e '/Long Term/d' frontend/main.c && ./configure --prefix=/usr --disable-static && make
make install
wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz
tar xzvf faad2-2.7.tar.gz
ls
cd faad2-2.7
ls
cd ..
mv faad2-2.7 /home/ffmpeg_sources/
mv faad2-2.7.tar.gz /home/ffmpeg_sources/
cd ..
ls
cd faad2-2.7
ls
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
git clone git://git.libav.org/libav.git
cd libav
ls
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
yum install libX11-devel libXext-devel libXtst-devel
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" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libmp3lame --enable-libx264 --enable-x11grab --enable-avfilter
make
make install
make distclean
hash -r
FFmpeg
cd ~/ffmpeg_sources
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
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" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
make
make install
make distclean
hash -r
libfreetype
Font rendering library. Required for the drawtext video filter.
Requires ffmpeg to be configured with --enable-libfreetype.
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-examples --disable-shared --disable-sdltest --disable-vorbistest
make
make install
make distclean
Updating¶
Development of FFmpeg is active and an occasional update can give you new features and bug fixes. First, remove the old files and then update the dependencies:
rm -rf ~/ffmpeg_build ~/bin/{ffmpeg,ffprobe,ffserver,lame,vsyasm,x264,yasm,ytasm}
# yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel