电子说
cd ~
mkdir ffmpeg_sources ffmpeg_build bin
更新
sudo apt-get update
安装需要的组件
sudo apt-get -y install
autoconf
automake
build-essential
cmake
git-core
libass-dev
libfreetype6-dev
libsdl2-dev
libtool
libva-dev
libvdpau-dev
libvorbis-dev
libxcb1-dev
libxcb-shm0-dev
libxcb-xfixes0-dev
pkg-config
texinfo
wget
zlib1g-dev
cd ~/ffmpeg_sources &&
wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2 &&
tar xjvf nasm-2.14.02.tar.bz2 &&
cd nasm-2.14.02 &&
./autogen.sh &&
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" &&
make &&
make install
cd ~/ffmpeg_sources &&
wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2 &&
tar xjvf nasm-2.14.02.tar.bz2 &&
cd nasm-2.14.02 &&
./autogen.sh &&
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" &&
make &&
make install
cd ~/ffmpeg_sources &&
wget -O yasm-1.3.0.tar.gz https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz &&
tar xzvf yasm-1.3.0.tar.gz &&
cd yasm-1.3.0 &&
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" &&
make &&
make install
cd ~/ffmpeg_sources &&
git -C x264 pull 2> /dev/null || git clone --depth 1 https://gitee.com/mirrors_addons/x264.git &&
cd x264 &&
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --enable-pic &&
PATH="$HOME/bin:$PATH" make &&
make install
sudo apt-get install mercurial libnuma-dev &&
cd ~/ffmpeg_sources &&
if cd x265 2> /dev/null; then git pull && cd ..; else git clone https://gitee.com/mirrors_videolan/x265.git; fi &&
cd x265/build/linux &&
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off ../../source &&
PATH="$HOME/bin:$PATH" make &&
make install
cd ~/ffmpeg_sources &&
git -C libvpx pull 2> /dev/null || git clone --depth 1 https://github.com/webmproject/libvpx.git &&
cd libvpx &&
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic &&
PATH="$HOME/bin:$PATH" make &&
make install
cd ~/ffmpeg_sources &&
git -C fdk-aac pull 2> /dev/null || git clone --depth 1 https://github.com/mstorsjo/fdk-aac &&
cd fdk-aac &&
autoreconf -fiv &&
./configure CFLAGS=-fPIC --prefix="$HOME/ffmpeg_build" &&
make &&
make install
cd ~/ffmpeg_sources &&
git -C opus pull 2> /dev/null || git clone --depth 1 https://github.com/xiph/opus.git &&
cd opus &&
./autogen.sh &&
./configure --prefix="$HOME/ffmpeg_build" -with-pic&&
make &&
make install
cd ~/ffmpeg_sources &&
wget -O ffmpeg-4.2.1.tar.bz2 https://ffmpeg.org/releases/ffmpeg-4.2.1.tar.bz2 &&
tar xjvf ffmpeg-4.2.1.tar.bz2 &&
cd ffmpeg-4.2.1 &&
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" CFLAGS="-O3 -fPIC" ./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 -lm"
--bindir="$HOME/bin"
--enable-gpl
--enable-libass
--enable-libfdk-aac
--enable-libfreetype
--enable-libmp3lame
--enable-libopus
--enable-libvorbis
--enable-libvpx
--enable-libx264
--enable-libx265
--enable-pic
--enable-shared
--enable-nonfree &&
PATH="$HOME/bin:$PATH" make &&
make install &&
hash -r
source ~/.profile
现在已经完成编译和安装ffmpeg (also ffplay, ffprobe, lame, x264, & x265) 。该文档剩余章节主要讲如何更新和删除ffmepg。ffmpeg_sources:
bin:
审核编辑:汤梓红
全部0条评论
快来发表一下你的评论吧 !