看了老师的 编译参数。我在centos7上尝试编译,以缺少各种库失败而告终。最后通过不断的百度。。整理出来了 如何编出一个可以支持nvenc的ffmpeg 我把过程分享出来 避免重复踩坑,如果不想编译nvenc 或者你的显卡不是英伟达 可以 不卸载驱动 编译的时候 把nvenc这个参数给去掉
# 下载英伟达驱动
https://www.geforce.cn/drivers
yum remove glx-utils
vim /etc/modprobe.d/blacklist.conf
加入 blacklist nouveau
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
dracut -v /boot/initramfs-$(uname -r).img $(uname -r)
yum -y upgrade
yum -y update
yum -y install gcc kernel-devel kernel-headers
yum install --enablerepo=epel dkms
sh NvidiaXXXXX.run
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && make install
wget https://jaist.dl.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.6.tar.gzhttps://jaist.dl.sourceforge.net/project/opencore-amr/fdk-aac/fdk-aac-0.1.6.tar.gz
tar xvf fdk-aac-0.1.6.tar.gz
cd fdk-aac-0.1.6
./configure
make && make install
yum install -y libmfx-devel
安装lame
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar -xzf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --enable-static --enable-shared
make && make install
安装nasm
wget https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.gz
tar xvf nasm-2.13.03.tar.gz
cd nasm-2.13.03
./configure
make && make install
安装x264
wget http://mirror.yandex.ru/mirrors/ftp.videolan.org/x264/snapshots/last_x264.tar.bz2
./configure --enable-static --enable-shared
make && make install
安装x265
yum install hg cmake -y
hg clone https://bitbucket.org/multicoreware/x265
cd x265/build/linux
./make-Makefiles.bash
make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
安装xvid
wget http://downloads.xvid.org/downloads/xvidcore-1.3.4.tar.gz
tar zvxf xvidcore-1.3.4.tar.gz
cd xvidcore/build/generic
./configure
make
make install
#下载ffmpeg
tar xvf ffmpeg-3.3.7.tar.gz
./configure --disable-static --enable-shared --enable-small --arch=x86_64 --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libspeex --enable-libx264 --enable-libx265 --enable-nvenc --enable-gpl --enable-nonfree --enable-avresample --enable-filter=delogo --enable-debug --disable-optimizations
make && make install
添加环境变量
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib