Python Forum
get webcam name from device manger !! - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: get webcam name from device manger !! (/thread-13833.html)



get webcam name from device manger !! - evilcode1 - Nov-02-2018

hello all ...
how i can get my webcam name by python ??

in powershell i can use this command:
Quote: Get-WmiObject Win32_PNPEntity | Select Name | Select-String "Camera"

output :
Quote:@{Name=HP Wide Vision HD Camera}
[Image: Capture.png]

how i can do this in pure python ?


RE: get webcam name from device manger !! - evilcode1 - Nov-03-2018

solved :

import wmi
import re


c = wmi.WMI()
wql = "Select * From Win32_USBControllerDevice"
for item in c.query(wql):
    q = item.Dependent.Caption
    if re.findall("Camera",q):
        print(q)
    
    
Output:
HP Wide Vision HD Camera



RE: get webcam name from device manger !! - j.crater - Nov-03-2018

Glad you got the solution, and thanks for coming back to share it!