mirror of
https://github.com/hacksider/Deep-Live-Cam.git
synced 2025-03-28 18:51:57 +01:00
FaceTime Camera Index to 0
This commit is contained in:
parent
5ce991651d
commit
77c19d1073
@ -812,13 +812,29 @@ def get_available_cameras():
|
|||||||
camera_indices = []
|
camera_indices = []
|
||||||
camera_names = []
|
camera_names = []
|
||||||
|
|
||||||
# Test the first 10 indices
|
if platform.system() == "Darwin": # macOS specific handling
|
||||||
for i in range(10):
|
# Try to open the default FaceTime camera first
|
||||||
cap = cv2.VideoCapture(i)
|
cap = cv2.VideoCapture(0)
|
||||||
if cap.isOpened():
|
if cap.isOpened():
|
||||||
camera_indices.append(i)
|
camera_indices.append(0)
|
||||||
camera_names.append(f"Camera {i}")
|
camera_names.append("FaceTime Camera")
|
||||||
cap.release()
|
cap.release()
|
||||||
|
|
||||||
|
# On macOS, additional cameras typically use indices 1 and 2
|
||||||
|
for i in [1, 2]:
|
||||||
|
cap = cv2.VideoCapture(i)
|
||||||
|
if cap.isOpened():
|
||||||
|
camera_indices.append(i)
|
||||||
|
camera_names.append(f"Camera {i}")
|
||||||
|
cap.release()
|
||||||
|
else:
|
||||||
|
# Linux camera detection - test first 10 indices
|
||||||
|
for i in range(10):
|
||||||
|
cap = cv2.VideoCapture(i)
|
||||||
|
if cap.isOpened():
|
||||||
|
camera_indices.append(i)
|
||||||
|
camera_names.append(f"Camera {i}")
|
||||||
|
cap.release()
|
||||||
|
|
||||||
if not camera_names:
|
if not camera_names:
|
||||||
return [], ["No cameras found"]
|
return [], ["No cameras found"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user