I'm building a PyQt application where one widget is displaying a webcam video feed. For the widget I basically use a lightly altered code from the QCamera example from geeksforgeeks.com.
The (minimal version of the) code I'm using:
class Camera(QCameraViewfinder):
def __init__(self, parent=None):
super(Camera, self).__init__(parent)
self.available_cameras = QCameraInfo.availableCameras()
def select_camera(self, i):
self.camera = QCamera(self.available_cameras[i])
self.camera.setViewfinder(self)
self.camera.start()
This works fine one my machine A (Arch on a notebook) but no available Cameras are detected one my machine B (freshly installed Debian on a Lenovo Thinkcentre). self.available_cameras is empty.
I use the same webcam (and have tried two different ones), they show up in dmesg as a USB HD Camera and I can access the camera feed via VLC, guvcview, etc...
I would appreciate any help and pointers to what the problem is. It would be also insightful where PyQt gets its list of cameras from. thx!
UPDATE: I was able to fix the problem, ekhumoro pointed me in the right direction. There were some qt packages missing, I (re)installed all of them by running:
apt install qtmultimedia5-*
The result was a error of a missing gstreamer library, so I installed gstreamer:
apt install gstreamer1.0-plugins-*
Now the camera is discovered and the feed is displayed, however it lags a lot. But this is now a different problem.