mirror of
https://github.com/hacksider/Deep-Live-Cam.git
synced 2026-09-01 21:40:52 +02:00
Merge pull request #1902 from 1ceseismic/fix/linux-camera-device-path-rebase
fix: no cam detected on Arch Linux, use string path for camera capture instead
This commit is contained in:
+1
-1
@@ -417,7 +417,7 @@ def get_available_cameras() -> Tuple[List[int], List[str]]:
|
||||
indices: List[int] = []
|
||||
names: List[str] = []
|
||||
for i in range(10):
|
||||
cap = cv2.VideoCapture(i)
|
||||
cap = cv2.VideoCapture(f"/dev/video{i}")
|
||||
if cap.isOpened():
|
||||
indices.append(i)
|
||||
names.append(f"Camera {i}")
|
||||
|
||||
@@ -71,8 +71,9 @@ class VideoCapturer:
|
||||
self.cap.release()
|
||||
except Exception:
|
||||
continue
|
||||
elif platform.system() == "Linux":
|
||||
self.cap = cv2.VideoCapture(f"/dev/video{self.device_index}")
|
||||
else:
|
||||
# Unix-like systems (Linux/Mac) capture method
|
||||
self.cap = cv2.VideoCapture(self.device_index)
|
||||
|
||||
if not self.cap or not self.cap.isOpened():
|
||||
|
||||
Reference in New Issue
Block a user