# Running on Windows 10, 'can't open camera by index' on Windows 11

**URL:** <https://forum.opencv.org/t/running-on-windows-10-cant-open-camera-by-index-on-windows-11/14432>\
**Category:** Uncategorized\
**Tags:** windows, videoio\
**Created:** [September 3, 2023, 9:33pm UTC](https://forum.opencv.org/t/running-on-windows-10-cant-open-camera-by-index-on-windows-11/14432 "2023-09-03T21:33:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andylucny](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@andylucny](https://forum.opencv.org/u/andylucny)\
**Post date:** [September 3, 2023, 9:33pm UTC](https://forum.opencv.org/t/running-on-windows-10-cant-open-camera-by-index-on-windows-11/14432/1 "2023-09-03T21:33:20Z")

</div>

I am using See3CAM\_CU135. On Windows 10, the following program works:

camera = cv2.VideoCapture(0,cv2.CAP\_DSHOW)  
fps = 30  
camera.set(cv2.CAP\_PROP\_FPS,fps)  
while True:  
hasFrame, frame = camera.read()  
cv2.imshow(‘camera’,frame)  
cv2.waitKey(10)

But on Windows 11, I get the error: “can’t open camera by index”

Any advice?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [September 4, 2023, 6:46am UTC](https://forum.opencv.org/t/running-on-windows-10-cant-open-camera-by-index-on-windows-11/14432/2 "2023-09-04T06:46:40Z")

</div>

> camera = cv2.VideoCapture(0,cv2.CAP\_DSHOW)

please try, if the MSMF backend works better for you:

```
camera = cv2.VideoCapture(0,cv2.CAP_MSMF)

```

please also enable debug logging  
(on the console. before starting your script):

```
SET OPENCV_LOG_LEVEL=debug
SET OPENCV_VIDEOIO_DEBUG=1

```

---

<div class="post-metadata">

**Author:** ![andylucny](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@andylucny](https://forum.opencv.org/u/andylucny)\
**Post date:** [September 7, 2023, 12:51pm UTC](https://forum.opencv.org/t/running-on-windows-10-cant-open-camera-by-index-on-windows-11/14432/3 "2023-09-07T12:51:58Z")

</div>

Thank you for your response.  
CAP\_MSMF is working fine on Windows10, but on windows 11 we have got:

[DEBUG:0@1.322] global videoio\_registry.cpp:218 cv::`anonymous-namespace'::VideoBackendRegistry::VideoBackendRegistry VIDEOIO: Builtin backends(9): FFMPEG(1000); GSTREAMER(990); INTEL_MFX(980); MSMF(970); DSHOW(960); CV_IMAGES(950); CV_MJPEG(940); UEYE(930); OBSENSOR(920) [DEBUG:0@1.327] global videoio_registry.cpp:242 cv::`anonymous-namespace’::VideoBackendRegistry::VideoBackendRegistry VIDEOIO: Available backends(9): FFMPEG(1000); GSTREAMER(990); INTEL\_MFX(980); MSMF(970); DSHOW(960); CV\_IMAGES(950); CV\_MJPEG(940); UEYE(930); OBSENSOR(920)  
[INFO:0@1.332] global videoio\_registry.cpp:244 cv::`anonymous-namespace’::VideoBackendRegistry::VideoBackendRegistry VIDEOIO: Enabled backends(9, sorted by priority): FFMPEG(1000); GSTREAMER(990); INTEL\_MFX(980); MSMF(970); DSHOW(960); CV\_IMAGES(950); CV\_MJPEG(940); UEYE(930); OBSENSOR(920)  
[DEBUG:0@1.340] global cap.cpp:363 cv::VideoCapture::open VIDEOIO: choosen backend does not work or wrong.Please make sure that your computer support chosen backend and OpenCV built with right flags.

cv config:  
Video I/O:  
DC1394: NO  
FFMPEG: YES (prebuilt binaries)  
avcodec: YES (58.134.100)  
avformat: YES (58.76.100)  
avutil: YES (56.70.100)  
swscale: YES (5.9.100)  
avresample: YES (4.0.0)  
GStreamer: NO  
DirectShow: YES  
Media Foundation: YES  
DXVA: YES
