Thursday, May 26, 2022

OpenCV Video Capturing Error : CvCapture_MSMF::initStream Failed to set mediaType

 



------------------------------------------------------------------------

import cv2 as cv


capture = cv.VideoCapture(0, cv.CAP_DSHOW)


while True:

    isTrue,frame = capture.read()

    cv.imshow('Video',frame)

    if cv.waitKey(20) & 0xFF==ord('d'):

        break


capture.release()

cv.destroyAllWindows()


--------------------------------------


OpenCV Video Capturing Error : CvCapture_MSMF::initStream Failed to set mediaType (stream 0, (640x480 @ 30) MFVideoFormat_RGB24(unsupported media type) import cv2 video = cv2.VideoCapture(0) Error : [ WARN:0] global C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-oduouqig\opencv\modules\videoio\src\cap_msmf.cpp (682) CvCapture_MSMF::initStream Failed to set mediaType (stream 0, (640x480 @ 30) MFVideoFormat_RGB24(unsupported media type) Solution : Adding the "CAP_DSHOW " argument after 0 in the video capture import cv2 video = cv2.VideoCapture(0, cv2.CAP_DSHOW)





No comments:

Post a Comment

Python Files and Exceptions: Unit 9

  Table of contents Reading from a File Reading an Entire File File Paths Reading Line by Line Making a List of Lines from a File Working wi...