[ WARN:0] global C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-wwma2wne\o pencv\modules\videoio\src\cap_msmf.cpp (677) CvCapture_MSMF::initStream Failed t o set mediaType (stream 0, (640×480 @ 30) MFVideoFormat_RGB24(codec not found)

The following code resolved this issue for me:

video = cv2.VideoCapture(0,cv2.CAP_DSHOW)

Here is what the above code is Doing:
1. cv2.VideoCapture(0) – This is the default camera. If you have multiple cameras, you can change the value to 1, 2, 3, etc.
2. cv2.CAP_DSHOW – This is the flag that tells OpenCV to use DirectShow.

Similar Posts