编译 ffmpeg4.1.2+fdkaac+opus+mp3lame+x264+x265+libyasm+vpx

7 篇文章 0 订阅
4 篇文章 0 订阅

编译 ffmpeg4.1.2+fdkaac+opus+mp3lame+x264+x265+libyasm+vpx

下面是编译步骤

 


https://ffmpeg.org/releases/
https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
https://trac.ffmpeg.org/wiki/CompilationGuide/macOS


Centos7编译
安装所需工具

yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel


创建存放目录
mkdir ffmpeg_source


Wiki地址
https://trac.ffmpeg.org/wiki/CompilationGuide/Centos


nasm:
cd ~/ffmpeg_sources
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2
tar xjvf nasm-2.14.02.tar.bz2  ||    tar jxvf nasm-2.14.02.tar.bz2
cd nasm-2.14.02
./autogen.sh
./configure --prefix="/root/website/ffmpeg_source/ffmpeg_build" --bindir="/root/website/ffmpeg_source/bin"
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install

最后将bin目录加入path路径中即可.加入方法:打开~/.bashrc,在最后一行编辑:
export PATH=$PATH:/root/website/nasm-2.13/build/bin/


Yams:
cd ~/ffmpeg_sources
curl -O -L http://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="/root/website/ffmpeg_source/ffmpeg_build" --bindir="/root/website/ffmpeg_source/bin"
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install

X264:
cd ~/ffmpeg_sources
git clone --depth 1 http://git.videolan.org/git/x264
cd x264

PKG_CONFIG_PATH="/root/website/ffmpeg_source/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/root/website/ffmpeg_source/ffmpeg_build" --bindir="/root/website/ffmpeg_source/bin" --enable-static 


PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install

X265:
cd ~/ffmpeg_sources
yum install hg
hg clone https://bitbucket.org/multicoreware/x265
cd ~/ffmpeg_sources/x265/build/linux
yum install make
yum install -y gcc
yum install -y gcc-c++

cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/root/website/ffmpeg_source/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source

cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make
make install

libfdk_aac:

yum  -y install install autoconf automake libtool


cd ~/ffmpeg_sources
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -fiv

./configure --prefix="/root/website/ffmpeg_source/ffmpeg_build" --disable-shared

./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install


libmp3lame:


cd ~/ffmpeg_sources
curl -O -L https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
tar xzvf lame-3.100.tar.gz
cd lame-3.100

./configure --prefix="/root/website/ffmpeg_source/ffmpeg_build" --bindir="/root/website/ffmpeg_source/bin" --disable-shared --enable-nasm

./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm
make
make install

libopus:


cd ~/ffmpeg_sources
curl -O -L https://archive.mozilla.org/pub/opus/opus-1.3.tar.gz
tar xzvf opus-1.3.tar.gz
cd opus-1.3

./configure --prefix="/root/website/ffmpeg_source/ffmpeg_build" --disable-shared

./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install

libvpx:

设置代理
git config --global https.proxy https://127.0.0.1:1087
取消代理
git config --global --unset http.proxy        git config --global --unset https.proxy


下载到本地然后导入
https://chromium.googlesource.com/webm/libvpx.git/+archive/master.tar.gz

解压
tar xzvf ../libvpx.gz 

cd ~/ffmpeg_sources
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
cd libvpx

./configure --prefix="/root/website/ffmpeg_source/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm

./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
make
make install

ffmpeg:

cd~ / ffmpeg_sources 
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 
tar xjvf ffmpeg-snapshot.tar.bz2 
cd ffmpeg 


yum install freetype*

//编译脚本start

PATH="/root/website/ffmpeg_source/bin:$PATH" PKG_CONFIG_PATH="/root/website/ffmpeg_source/ffmpeg_build/lib/pkgconfig" ./configure \
  --prefix="/root/website/ffmpeg_source/ffmpeg_build" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I/root/website/ffmpeg_source/ffmpeg_build/include" \
  --extra-ldflags="-L/root/website/ffmpeg_source/ffmpeg_build/lib" \
  --extra-libs=-lpthread \
  --extra-libs=-lm \
  --bindir="/root/website/ffmpeg_source/bin" \
  --enable-gpl \
  --enable-libfdk_aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libvpx \
  --enable-libx264 \
  --enable-libx265 \
  --enable-nonfree
make
make install
hash -d ffmpeg

/end
./configure --prefix="/root/website/ffmpeg_source/android/arm \
--enable-ffmpeg \
--target-os=linux \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \


--disable-everything --disable-muxers --disable-avdevice --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-zlib --disable-bzlib --disable-debug --enable-ffmpeg --disable-ffplay --disable-muxers --disable-filters --disable-devices --disable-encoders --disable-hwaccels --enable-static --enable-small --enable-decoder=h264 --enable-demuxers --enable-parsers --enable-protocols

 

 

也可以到这里下载已经编译包的静态库相应文件、编译脚本

https://download.csdn.net/download/u010945409/11127933

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值