下载源码
https://ffmpeg.org/
csdn下载源码包
不想编译可以直接下载使用静态版本
https://ffmpeg.org/download.html
https://johnvansickle.com/ffmpeg/
根据cpu类型,下载解压后就可以直接使用了。
linux编译
安装底层依赖
yum install gcc
yum isntall nasm
安装cmake
yum install gcc-c++
yum install openssl-devel
./bootstrap
make
sudo make install
安装nasm
tar -xvf nasm-2.15.05.tar.gz
cd nasm-2.15.05
./configure
make
make install
编译fdk-aac 音频转码相关
https://sourceforge.net/projects/opencore-amr/
cd fdk-aac-2.0.2
cmake .
make
make install
设置环境变量
vim /etc/profile
export PATH=$PATH:/usr/local/bin/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig/
编译ffmpeg
cd ffmpeg-5.0
./configure --enable-libfdk-aac
make
make install
这样说明ffmpeg的第三方库编译成功,导入成功
编译aom ->avi格式
https://aomedia.googlesource.com/aom/
tar -zxvf aom_v3.3.0-87460cef80fb03def7d97df1b47bad5432e5e2e4.tar.gz -C ./aom-3.3.0/aom-3.3.0/
cd aom-3.3.0/
mkdir aom_build
cd aom_build/
cmake ../aom-3.3.0/ -DBUILD_SHARED_LIBS=1
make
make install
ffmpeg
./configure --enable-libaom --enable-libfdk-aac
编译libx264
https://www.videolan.org/developers/x264.html
mkdir x264-stable
tar -zxvf x264-stable.tar.gz -C x264-stable
cd x264-stable
cd x264-stable
./configure --enable-shared
make
make install
cp x264.pc /usr/local/lib64/pkgconfig/
编译libx265
https://www.x265.org/developers.html
https://www.x265.org/developers/
https://bitbucket.org/multicoreware/x265_git/wiki/Home
mkdir x265_v3_3
tar -xvf x265_v3_3.tar.gz -C x265_v3_3
cd x265_v3_3
cd x265_3.3/
cd build/
cd linux/
./make-Makefiles.bash
如果报找不到ccmake就直接执行下面的cmake即可
cmake ../../source
make
make install
cp x265.pc /usr/local/lib64/pkgconfig/
编译lame mp3
https://lame.sourceforge.io/
mkdir lame-3.100
tar -xvf lame-3.100.tar.gz -C lame-3.100
cd lame-3.100
cd lame-3.100
./configure
make
make install
ffmpeg 编译
./configure --enable-libmp3lame --enable-libaom --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-gpl --enable-nonfree --enable-pthreads --enable-pic --enable-version3