Unable to open a video with CAP_DSHOW

Hello everyone,

I’m trying to open a video using this line
cap.open(filename, cv::CAP_DSHOW)
like shown in the overview.
I tried with several video-container and codecs (I rendered several 1 sec videos to test them). Everytime open() returned false. With further investigation into the cap.cpp I found, CAP_DSHOW only has the mode MODE_CAPTURE_BY_INDEX. When opening a video file the function getAvailableBackends_CaptureByFilename() is called and as expected does not return CAP_DSHOW.
My question would be: Is DSHOW no longer supported for opening video files or did I miss any build options which would set the mode to MODE_CAPTURE_ALL?
In my opinion, if it is not supported, the overview as well as the documentation should reflect that.

Further information:
The software I’m building has to run on a fresh Windows 10 N. Therefore MSMF and ffmpeg are not a viable option for me.

CAP_DSHOW is only used for (usb)webcams

since you appear to be on windows, you can use CAP_FFMPEG (used by default for files or ip-streams) or (if you have built that from src) CAP_GSTREAMER.

in other words:

it never was that way

can’t you use the opencv_videoio_ffmpeg.dll, that comes with opencv ?

Thank you berak for the information about CAP_DSHOW.

I should clarify, I’m working on a commercial product and I’m unsure about the licensing of ffmpeg. I know x264 requires a commercial license, but (as far as I understand) this license is only needed for the encoder not the decoder. I will take a look at GSTREAMER, since I never work with that. If you have any advice, please tell me.


Is there a documentation that shows, which backends are used for cameras and/or files?

that depends:

I don’t see you mentioning what codecs you’ll use…