本文共 4101 字,大约阅读时间需要 13 分钟。
sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.rosudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.rosudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
sudo yum install ffmpeg ffmpeg-devel -y# 查看帮助ffmpeg -hffmpeg -i input.mp4 output.avi
# 必须要安装的依赖包yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel cmake hg numactl numactl-devel freetype freetype-devel freetype-demos
# mkdir ~/ffmpeg_sources
yum remove ffmpeg ffmpeg-devel nasm -y
cd ~/ffmpeg_sourcescurl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2tar xjvf nasm-2.13.02.tar.bz2cd nasm-2.13.02./autogen.sh./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"makemake install
cd ~/ffmpeg_sourcescurl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gztar xzvf yasm-1.3.0.tar.gzcd yasm-1.3.0./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"makemake install
cd ~/ffmpeg_sourcesgit clone --depth 1 http://git.videolan.org/git/x264cd x264PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-staticmakemake install
cd ~/ffmpeg_sourceshg clone https://bitbucket.org/multicoreware/x265cd ~/ffmpeg_sources/x265/build/linuxcmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../sourcemakemake install
cd ~/ffmpeg_sourcesgit clone --depth 1 https://github.com/mstorsjo/fdk-aaccd fdk-aacautoreconf -fiv./configure --prefix="$HOME/ffmpeg_build" --disable-sharedmakemake install
cd ~/ffmpeg_sourcescurl -O -L http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gztar xzvf lame-3.100.tar.gzcd lame-3.100./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasmmakemake install
cd ~/ffmpeg_sourcescurl -O -L https://archive.mozilla.org/pub/opus/opus-1.2.1.tar.gztar xzvf opus-1.2.1.tar.gzcd opus-1.2.1./configure --prefix="$HOME/ffmpeg_build" --disable-sharedmakemake install
cd ~/ffmpeg_sourcescurl -O -L http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.gztar xzvf libogg-1.3.3.tar.gzcd libogg-1.3.3./configure --prefix="$HOME/ffmpeg_build" --disable-sharedmakemake install
cd ~/ffmpeg_sourcescurl -O -L http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gztar xzvf libvorbis-1.3.5.tar.gzcd libvorbis-1.3.5./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-sharedmakemake install
# 这里坑了笔者两个多小时,笔者直接克隆的github上源码。configure过不去,一直报错,解决如下:cd ~/ffmpeg_sourceswget https://github.com/webmproject/libvpx/archive/v1.7.0.tar.gztar zxvf v1.7.0.tar.gzmv libvpx-1.7.0 libvpxcd libvpx./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared #终于过去,高兴坏了makemake install
# http://ffmpeg.org/releases/ 笔者这里用的是最新的开发版本,建议使用当前最新版本,比如:ffmpeg-4.0.tar.gz cd ~/ffmpeg_sourcescurl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2tar xjvf ffmpeg-snapshot.tar.bz2cd ffmpegPATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \ --prefix="$HOME/ffmpeg_build" \ --pkg-config-flags="--static" \ --extra-cflags="-I$HOME/ffmpeg_build/include" \ --extra-ldflags="-L$HOME/ffmpeg_build/lib" \ --extra-libs=-lpthread \ --extra-libs=-lm \ --bindir="$HOME/bin" \ --enable-gpl \ --enable-libfdk_aac \ --enable-libfreetype \ --enable-libmp3lame \ --enable-libopus \ --enable-libvorbis \ --enable-libvpx \ --enable-libx264 \ --enable-libx265 \ --enable-nonfreemake # 这一步时间有点长make installhash -r
现在编译完成,ffmpeg(也是ffprobe,ffserver,lame和x264)现在应该可以使用了,笔者下边文章介绍安装过程中遇到错误及解决办法,以后介绍如何更新或删除FFmpeg