VideoCapture not working with DSHOW backend

asked 2017-06-12 05:26:23 -0500

nji gravatar image

updated 2017-06-12 10:55:09 -0500

(This is a duplicate of SO)

I built OpenCV (with mingw 4.9.2 @ Win7Prof64) with CMake switches for WITH_FFMPEG and WITH_DSHOW turned on. When I access a movie file with

VideoCapture (fileName)

works fine (it uses ffmpeg backend then).

But

VideoCapture (fileName, cv::CAP_DSHOW)

doesn't work (isOpened() returns false).

What is missing/ what do I do wrong? Are there any kind of dshow stubs/ libs/ dlls needed?

edit retag flag offensive close merge delete

Comments

VideoCapture (fileName);

will use opencv_ffmpeg.dll to decode the video (which covers almost any container/codec on earth), while

VideoCapture (fileName, cv::CAP_DSHOW);

will try to use your locally (os-)installed directshow codecs. you probably do not have one for the file you want to open.

berak gravatar imageberak ( 2017-06-12 05:41:30 -0500 )edit

Thank you for your answer. But missing directshow codecs (I use the K-Lite distr. since years) is not the reason for sure. To me it seems like a missing connection (stub etc.) between opencv and the local directshow interface. Configuration issues in the directshow system didn't help.

nji gravatar imagenji ( 2017-06-12 09:36:11 -0500 )edit

please ignore the prev. post, i was entirely wrong, sorry.

it seems, you're right, there is simply no dshow branch here , also no code for opening videos in cap_dshow.cpp

berak gravatar imageberak ( 2017-06-12 09:58:48 -0500 )edit

Thank you for digging in the source! ;-) But then the opencv documentation and the whole make flag WITH_DSHOW is entirely wrong? But it was written at a time when there WAS a dshow branch?? (I'm fighting my way from M$-VS in the last weeks ... and it's quite detering ...)

nji gravatar imagenji ( 2017-06-12 10:08:40 -0500 )edit

WITH_DSHOW is still used for the camera capture (webcam)

unfortunately i do not recall the whole history of it, but it's unlikely, that code was removed from cap_dshow.

care to make an issue here , so someone might go and fix the docs (maybe even you, hehe?)

berak gravatar imageberak ( 2017-06-12 10:47:51 -0500 )edit