FFmpeg-手把手编译

一、Linux安装

#centos
yum install -y wget gcc gcc-c++ make automake aom pkg-config -y
#ubuntu
apt install -y libogg-dev automake aom pkg-config zlib1g-dev

1、开发环境

配置PATH环境

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

gdb

cd /usr/local
wget http://ftp.gnu.org/gnu/gdb/gdb-8.3.tar.xz --no-check-certificate
tar -xf gdb-8.3.tar.xz   
cd gdb-8.3/   
./configure
make && make install
sudo cp gdb/gdb /usr/local/bin/gdb

cmake

cd /usr/local
wget https://cmake.org/files/v3.20/cmake-3.20.2-linux-x86_64.tar.gz
no-check-certificate
tar zxvf cmake-3.20.2-linux-x86_64.tar.gz
mv cmake-3.20.2-linux-x86_64 /usr/local/cmake-3.20.2
ln -sf /usr/local/cmake-3.20.2/bin/* /usr/bin/

openssl

cd /usr/local 
wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz --no-check-certificate tar zxvf openssl-1.1.1i.tar.gz 
cd openssl-1.1.1i 
./config shared 
make && make install

curl

cd /usr/local
wget https://curl.haxx.se/download/curl-7.74.0.tar.gz --no-check-certificate
certificate
tar zxvf curl-7.74.0.tar.gz
cd curl-7.74.0
./configure --without-nss --with-ssl
make && make install

2、安装依赖

yasm

cd /usr/local
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz --no-check-certificate
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && make install

fdk-aac

cd /usr/local
wget https://downloads.sourceforge.net/opencore-amr/fdk-aac-2.0.1.tar.gz --no-check-certificate
tar zxvf fdk-aac-2.0.1.tar.gz
cd fdk-aac-2.0.1
./configure --disable-static
make && make install

nasm

cd /usr/local
wget https://www.nasm.us/pub/nasm/releasebuilds/2.15/nasm-2.15.tar.gz --no-check-certificate
tar -vxf nasm-2.15.tar.gz
cd nasm-2.15
./configure
make && make install

vpx

cd /usr/local
wget https://github.com/webmproject/libvpx/archive/v1.10.0/libvpx-1.10.0.tar.gz
unzip libvpx-v1.10.0.zip
cd libvpx-1.10.0
./configure --enable-pic --enable-static --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --enable-shared --as=yasm --target=generic-gnu
make && make install

opus

cd /usr/local
wget https://archive.mozilla.org/pub/opus/opus-1.3.tar.gz
tar xzvf opus-1.3.tar.gz
cd opus-1.3
./configure --enable-static --enable-shared -with-pic
make && make install

x264

cd /usr/local
git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --enable-static --enable-shared --disable-opencl
make && make install

x265

cd /usr/local
wget http://ftp.videolan.org/pub/videolan/x265/x265_3.2.tar.gz --no-check-certificate
tar xzvf x265_3.2.tar.gz
cd x265_3.2/build/linux/
sh make-Makefiles.bash
#按'c'再按'e'再'g'键保存退出
make && make install

mp3lame

cd /usr/local
git clone --depth 1 https://gitee.com/hqiu/lame.git
cd lame
./configure -enable-nasm --with-pic
make && make install

vorbis

cd /usr/local
wget https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.xz --no-check-certificate
tar -xvf libvorbis-1.3.7.tar.xz
cd libvorbis-1.3.7
./configure --enable-shared --enable-static --with-pic
make && make install

3、可选依赖库

SDL2

#centos
yum install -y libX11-devel.i686 libXv-devel.i686
#ubuntu
sudo apt-get install libasound2-dev libpulse-dev -y 

cd /usr/local
wget http://libsdl.org/release/SDL2-2.0.14.tar.gz --no-check-certificate
tar zxvf SDL2-2.0.14.tar.gz
cd SDL2-2.0.14
./configure
make && make install

4、安装核心

#查看链接依赖顺序
/sbin/ldconfig -v
 
cd /usr/local
wget http://ffmpeg.org/releases/ffmpeg-4.3.2.tar.xz --no-check-certificate
tar -xvf ffmpeg-4.3.2.tar.xz
cd ffmpeg-4.3.2

#重要依赖
apt-get install pkg-config libogg-dev

#通用配置
#LinuxUSB采集:
#  apt-get install libv4l-dev
#  --enable-libv4l2
#SDL播放器:
#  apt-get install libsdl2-dev libx11-dev xorg-dev
#  --enable-sdl2

PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" ./configure \
  --prefix="/usr/local" \
  --extra-libs="-lpthread -lm" \
  --enable-static \
  --enable-shared \
  --enable-gpl \
  --enable-pic \
  --enable-libvorbis \
  --enable-libx264 \
  --enable-libx265 \
  --enable-libmp3lame \
  --enable-libvpx \
  --enable-zlib \
  --enable-libopus \
  --enable-libfdk-aac \
  --enable-openssl \
  --enable-postproc \
  --enable-nonfree \
  --extra-cflags=-Wno-implicit-function-declaration

  # --libdir="/usr/local/lib/ffmpeg" \
  # --incdir="/usr/local/include/ffmpeg" \
   
make -j 4 && make install

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

毕加索解锁

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值