# Opencv hardware acceleration not working

**URL:** <https://forum.opencv.org/t/opencv-hardware-acceleration-not-working/8223>\
**Category:** Uncategorized\
**Tags:** ffmpeg, cuda, videoio\
**Created:** [April 1, 2022, 3:31pm UTC](https://forum.opencv.org/t/opencv-hardware-acceleration-not-working/8223 "2022-04-01T15:31:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [April 1, 2022, 3:47pm UTC](https://forum.opencv.org/t/opencv-hardware-acceleration-not-working/8223/2 "2022-04-01T15:47:19Z")

</div>

Hi, I would read the following post to see if it helps

> [@Trouble using NVDIA hardware decoder when streaming from Camera](https://forum.opencv.org/t/trouble-using-nvdia-hardware-decoder-when-streaming-from-camera/7908/13):
>
> I was refering to the source of information, sorry for the confusion. The point is cv::cudacodec::VideoReader() should work on all versions of CUDA any information to the contrary may be for specific circumstances which I would be interested to investigate if you have a link to the information? Anyway this thread is getting confusing, I have just performed some tests on my build of 4.5.5 to confirm everything is working as it should, and it appears to be. I will try to compress the relevent …

If you don’t have time and you are on windows, then opening your stream with

```auto
cap = cv.VideoCapture(SRC_PATH, cv.CAP_FFMPEG, [cv.CAP_PROP_HW_ACCELERATION, cv.VIDEO_ACCELERATION_D3D11]);

```

should enable Nvidia hardware decoding.

The environmental variables you were setting look wrong to me, but I don’t have time to test them to be 100% sure.

> [@Chun\_Leong\_Lee](#):
>
> os.environ[“OPENCV\_FFMPEG\_CAPTURE\_OPTIONS”] = “hwaccel;qsv|vsync;0”

Would enable quicksync if it worked which is not what you want.

> [@Chun\_Leong\_Lee](#):
>
> os.environ[“OPENCV\_FFMPEG\_CAPTURE\_OPTIONS”] = “video\_codec”

This as far as I know wouldn’t do anything as you haven’t specified the video codec.

---

_[View the full topic](https://forum.opencv.org/t/opencv-hardware-acceleration-not-working/8223)._
