OpenCV can't read VideoCapture

After many days of finding a solution, I have finally found one.

  1. I made a copy of the OpenCV plugin from the Engine and added it to my project’s plugins.
  2. Downloaded the GStreamer Runtime and Devkit for Windows.
  3. Rebuilt OpenCV using CMake (making sure to include the provided Unreal module as an extra module), including most of the modules that Epic left out, namely GStreamer.
  4. Use GStreamer as my video API, by using:
VideoStream.open("autovideosrc ! videoconvert ! appsink", cv::CAP_GSTREAMER);
  1. Video and Camera now works.

Ultimately, I was unable to ever get anything other than GStreamer to work for cameras and I still don’t know why. They were all included in the plugin.
MSMF: :x: (opens camera but doesn’t grab frames)
DirectShow: :x: (infinitely holds up when trying to open camera)
OpenNI2: :x: (crashes when trying to open camera)

I did get FFMPEG to work for videos, but GStreamer ended up performing way better (it seems to take advantage of the GPU way better).
I also managed to get CUDA working perfectly by following normal OpenCV instructions.

The camera does read super slow and is only using the CPU. I will have to build GStreamer from source to install some plugins that can help with this.

1 Like