Search code examples
c++qtobs

QMediaDevices::videoInputs() does not list OBS virtual camera as avaliable on Windows


I'm writing an application that takes in input from webcams and does some image processing on it. Currently I use Qt for the video capturing and display. I get the list of available cameras using QMediaDevices::videoInputs().

However, this function seems does not support OBS virtual camera. The following code should dump the entire list of cameras on the system. However I can only find my laptop's internal camera can Snap's virtual camera. (I have both OBS and Snap installed)

for (const auto& device : QMediaDevices::videoInputs())
    std::cout << device.description().toStdString() << "\n";

outputs

Integrated Camera
Snap Camera

However, I am sure OBS virtual camera is working as it shows up in software like Zoom. How do I get Qt to use OBS virtual camera?

OS: Windows 10 Qt: 6.2.2 Compiler: Clang-CL 12.0.0


Solution

  • Over the weekends. I read the Qt6 change logs and found that they dropped DirectShow support. While OBS Virtual Camera is DShow only. OBS Virtual Camera can only work in Qt once they support Media foundation.