ffmpeg+cuda+opencv

为了让ffmpeg使用gpu进行解码,可以按以下步骤:

1 下载nvidia官网提供的ffmpeg,编译安装

https://developer.nvidia.com/ffmpeg

注意原来的选项上还需要添加上 --enable-shared

如果出现编译错误

ERROR: cuda requested, but not all dependencies are satisfied: ffnvcodec
参考:https://superuser.com/questions/1299064/error-cuvid-requested-but-not-all-dependencies-are-satisfied-cuda-ffnvcodec
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
make
sudo make install
 

2 编译opencv

可以采用2.4.13.6

注意会出现报错

error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope
解决办法参考 https://stackoverflow.com/questions/46884682/error-in-building-opencv-with-ffmpeg
即把以下三行拷贝到 cap_ffmpeg_impl.hpp 开头
#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)
#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
#define AVFMT_RAWPICTURE 0x0020

 

转载于:https://www.cnblogs.com/rabitvision/p/9237855.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值