[python-win32] Using DirectShow API to access webcam

Joe solarjoe at posteo.org
Thu Aug 16 03:02:19 EDT 2018


Hello,

I have a question an hope you can help me. I am trying to control a UVC 
webcam
using the DirectShow API, but could not get anything to work.

The question is already posted on StackOverflow:

https://stackoverflow.com/questions/51843523/accessing-webcam-via-directshow-using-com-with-python

I am not familiar with using CLSID, IID so playing with the few examples 
I found
got my nowhere:

# IID_IAMVideoProcAmp is C6E13360-30AC-11d0-A18C-00A0C9118956
from win32com.client import Dispatch
from win32com.client.gencache import EnsureDispatch,GetClassForProgID, 
GetClassForCLSID, GetModuleForProgID, GetModuleForCLSID

iid = '{c6e13360-30ac-11d0-a18c-00a0c9118956}'

print(GetClassForCLSID(iid))
print(GetModuleForProgID(iid))
print(GetModuleForCLSID(iid))

CLSID = IID('{c6e13360-30ac-11d0-a18c-00a0c9118956}')
print(CLSID)

print(Dispatch(CLSID))

>>> pywintypes.com_error: (-2147220990, 'CONNECT_E_CANNOTCONNECT', None, 
>>> None)

Could someone of you point me in the right direction and maybe put
together a few lines to get me started?

Kind regards,
Joe




More information about the python-win32 mailing list