I am using the following platform for running OpenCV in C++,
GPU: NVIDIA GeForce 1060, Windows 10, Visual Studio 2015, OpenCV 3.4.5, CUDA 9.2
With some significant effort, I was able to successfully build OpenCV from source code with CUDA, FFMPEG and OpenGL. I also have Gstreamer installed, so that got added during Cmake on its own.
I have tested my installations. CUDA runs fine. OpenCV with CUDA runs well (because I tested a simple image processing script which reads an image in a Mat variable and then transfers it as GpuMat for processing and returns the output). OpenCV with FFMPEG also runs perfectly when used on CPU. I tested a program with cv::VideoCapture cap(filename, cv::CAP_FFMPEG) and I was able to read/write a video file without any problems using FFMPEG.
The difficulty starts when I try to run the example opencv/samples/gpu/video_reader.cpp on github. Then I get the following message on the console:
[ INFO:0] VIDEOIO: Enabled backends(5, sorted by priority): FFMPEG(1000); GSTREAMER(990); DSHOW(980); CV_IMAGES(970); CV_MJPEG(960)
OpenCV(3.4.5) Error: Unsupported format or combination of formats (Unsupported video source) in cv::cudacodec::detail::FFmpegVideoSource::FFmpegVideoSource, file F:\GPU-Codes\Third-Party\opencv_345\Primary_Sources\modules\cudacodec\src\ffmpeg_video_source.cpp, line 110
I get the following exception when I debug.
Exception thrown at 0x00007FFBB0D4517B (opencv_cudacodec345d.dll) in Opencv_Cuda_test1.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
If there is a handler for this exception, the program may be safely continued.
I need to be able to read/write video while being in the GPU. Could anyone here please help me in troubleshooting the problem? I am using the same video file as input which I was able to successfully read with cv::VideoCapture().
Thank you very much for your efforts.