> ## Content Index
> Fetch the complete content index at: https://yinguobing.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# 启用CUDA加速的FFMPEG与OpenCV Docker镜像
- URL: https://yinguobing.com/blog/docker-image-for-nvidia-gpu-accelerated-ffmpeg-opencv/
- Published: 2022-06-03T08:05:49.000Z
- Updated: 2022-06-03T08:05:49.000Z
- Description: 充分利用容器技术减轻重复的工作量。
- Author: 尹国冰
- Tags: 新手入门

如果你开发的应用涉及到了GPU参与的异构计算，那么Nvidia的CUDA有很大概率成为技术方案的一个底层支撑库。CUDA不仅仅应用于加速神经网络的模型推演，还可以加速OpenCV中的一些图像处理算法。部分GPU提供的专用计算单元还可以提供H264/265视频解码加速。要想充分利用这些运算资源需要两个条件：第一、在编译时开启相关选项；第二、在代码中调用对应的接口。

如何编译启用CUDA支持的FFMPEG以及OpenCV，我之前专门写过一篇教程：

[为OpenCV启用NVIDIA GPU加速视频解码将CPU从高负载中解放出来![](https://yinguobing.com/blog/content/images/size/w256h256/2019/12/Color-1.png)尹国冰的博客尹国冰![](https://yinguobing.com/blog/content/images/2021/11/opencv-plus-cuda.jpg)](https://yinguobing.com/blog/nvidia-gpu-acclerated-ffmpeg-opencv/)

为了方便重复使用，我制作了编译好的Docker镜像放在Docker Hub上，可以直接使用。这些镜像包括：

### CUDA加速的OpenCV 4.5.4

基于Ubuntu 20.04，CUDA 11.3.1。

拉取镜像命令：

```bash
docker pull yinguobing/opencv:4.5.4-cuda_11.3.1-runtime-ubuntu20.04
```

如果需要开发版本：

```bash
docker pull yinguobing/opencv:4.5.4-cuda_11.3.1-devel-ubuntu20.04
```

### CUDA加速的FFMPEG 4.3.4

基于Ubuntu 20.04，CUDA 11.3.1。

拉取镜像命令：

```bash
docker pull yinguobing/ffmpeg:4.3.3-cuda_11.3.1-runtime-ubuntu20.04
```

如果需要开发版本：

```bash
docker pull yinguobing/ffmpeg:4.3.3-cuda_11.3.1-devel-ubuntu20.04
```

---

希望这些镜像能帮你节省一部分开发时间。祝开发顺利！