linux下编译ffmpeg

    linux 下编译ffmpeg,当然也可以直接安装dev,但是不能自动包含cuda等需要的东西,这些东西还是要自己安装的
下面就详述编译过程中的注意点

1 安装编译工具和开发包

apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev \
libsdl2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev \
libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev

上面的都要安装

2 cuda 和nvcodecheader

1 是要安装cuda,所以先要下载nvcodecheader,安装nvcodecheader

git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git 
$ cd nv-codec-headers 
$ make 
$ sudo make install
安装cuda
sudo apt install nvidia-driver nvidia-cuda-dev nvidia-cuda-toolkit nvidia-nsight nvidia-visual-profiler

3 安装nvidia-video-codec-sdk

安装nvidia-video-codec-sdk,这个是编解码得核心,一般在GPU驱动安装过程中,nvidai-video-codec-sdk的库文件都会安装,linux下安装在/usr/lib/x86_64-linux-gnu/目录下,
如果/usr/lib/x86_64-linux-gnu/目录下存在libnvcuvid.so.xxx.xx.xx、libnvidia-encode.so.xx.xx.xx的库文件。这时候只需要安装头文件即可,如下命令将头文件拷贝至cuda/目录:

cp Video_Codec_SDK_12.0.16/Interface/* /usr/local/cuda/include/

4 ffmpeg configure 参数

根据需求选择以下命令

./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --enable-shared –disable-static --disable-debug
 --extra-cflags=-I/usr/include --extra-cflags=-fPIC –extra-ldflags=-L/usr/lib/

./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --disable-static --disable-debug --enable-shared --extra-cflags=-I/usr/include --extra-ldflags=-L/usr/lib/cuda –extra-cflags=-fPIC


./configure --prefix=./build --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/include --extra-cflags=-fPIC --extra-ldflags=-L/usr/lib/cuda --enable-shared --enable-pic 


./configure --prefix=./build –disable-static --enable-shared --enable-pic --disable-debug --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags=-I/usr/include --extra-cflags=-fPIC –extra-ldflags=-L/usr/lib/cuda

./configure --prefix=./build --disable-static --enable-shared --enable-pic --disable-debug --enable-cuda --enable-cuvid --enable-nvenc --extra-cflags=-I/usr/include --extra-cflags=-fPIC --extra-ldflags=-L/usr/lib/cuda 

./configure --prefix="./build" --pkg-config-flags="--static" --extra-cflags=-I./build/include --extra-ldflags="-L./build/lib" --extra-libs="-lpthread -lm" --enable-gpl --enable-libx264 --enable-nonfree --enable-cuda --enable-cuvid –enable-nvenc

./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree –enable-libnpp

5 make

然后make,make install 就行了

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

qianbo_insist

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

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

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

打赏作者

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

抵扣说明:

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

余额充值