Skip to content

Continuity Camera on macOS Sonoma not working. #916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
peterk268 opened this issue Nov 14, 2023 · 20 comments
Open

Continuity Camera on macOS Sonoma not working. #916

peterk268 opened this issue Nov 14, 2023 · 20 comments
Assignees

Comments

@peterk268
Copy link

WARNING: AVCaptureDeviceTypeExternal is deprecated for Continuity Cameras. Please use AVCaptureDeviceTypeContinuityCamera and add NSCameraUseContinuityCameraDeviceType to your Info.plist.

Once i updated my mac os version, continuty camera stopped working. I have tried looking for an info.plist in my cv2 folder but no luck. If the VideoCapture function is being handed off to another framework for cross platform use, that could be where the info.plist is to change this attribute to what Apple now recommends using as the current one opencv is using is deprecated.

https://developer.apple.com/documentation/avfoundation/avcapturedevice/devicetype

This should be a simple fix depending on if the video capture is not a dependency but hopefully it can be fixed soon as many others have observed this issue as well.

https://www.reddit.com/r/opencv/comments/17glzkc/questionopencvpython_videocapture_seems_not/

@peterk268
Copy link
Author

Doing VideoCapture(1) instead of 0 seemed to fix it

@ChanifRusydi
Copy link

ChanifRusydi commented Nov 21, 2023

Have the same problem here, though in my case,

Doing VideoCapture(1) instead of 0 seemed to fix it

in my m1 macbook the built-in camera to turn on for a second, then my python program (its a simple VideoCapture and imshow) crashed with error message like this

cv2.error: OpenCV(4.8.0) /Users/xperience/GHA-OpenCV-Python/_work/opencv-python/opencv-python/opencv/modules/highgui/src/window.cpp:971: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'

which I assume that the imshow function tries to show 'None existent' image, which means that the input from the VideoCapture have been cut off abruptly

my code is like this

import cv2

camera1 = cv2.VideoCapture(1)
while True:
    ret1, frame1 = camera1.read()
    cv2.imshow('frame1', frame1)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

camera1.release()

cv2.destroyAllWindows()

@vshankar5959
Copy link

Having the same issue on macOS Sonoma 14.1.1.

Neither cv2.VideoCapture(0) nor cv2.VideoCapture(1) work for using Continuity Camera with iPhone in OpenCV.

Getting same error: WARNING: AVCaptureDeviceTypeExternal is deprecated for Continuity Cameras. Please use AVCaptureDeviceTypeContinuityCamera and add NSCameraUseContinuityCameraDeviceType to your Info.plist.

@snailshen2014
Copy link

I have the same problem on macOS 14.1 (23B74)

@sambhavnoobcoder
Copy link

hi @everyone .I am a beginner looking to contribute to this repo . any of you experienced folks pointing me in the right direction to my first issue would indeed be a great help

@FlintYu
Copy link

FlintYu commented Jan 12, 2024

I have the same problem on macOS 14.2.1 (23C71)

@earriagadadiaz
Copy link

I have the same problem on macOS 14.2.1

@lukegriley
Copy link

Same problem on macOS 14.3

@tzlan
Copy link

tzlan commented Feb 14, 2024

Same problem on mac 14.3.1

@JBelmont72
Copy link

I am not able to find the 'Info.plist ' in question. I have gone to Finder on mAC and searched the hard drive for this file. I have about a dozen hits but none of them are the correct one.

@JBelmont72
Copy link

Looks like the answer for me is to not use Sonoma. For now it works in Sonoma, If and when it stops, try going back to Ventura (I'm a noob)

https://support.apple.com/en-us/108387

If you can't use your camera or video output device after updating to macOS Sonoma 14.1

Starting in macOS Sonoma 14.1, cameras and video output devices that don't use modern system extensions won't be available to use unless you restore the legacy settings.

Starting in macOS Sonoma 14.1, only cameras and video output devices that use modern system extensions are supported on macOS. This modern software provides more secure and privacy conscious experience, including support for the camera privacy indicator — a green dot icon that displays in the menu bar while your camera is in use.

If your camera or video output device still uses older software, it won't appear as an option to select and use in apps after you update to macOS Sonoma 14.1.

Apple has been working with video device makers to update their support software to the modern camera extension replacement, which became available in macOS Monterey 12.3. However, some video device makers haven't yet updated — so their cameras or video output devices still rely on software that is no longer supported.

@lorenzo677
Copy link

Same problem with macOS Sonoma 14.4

@srinrealyf
Copy link

Doing VideoCapture(1) instead of 0 seemed to fix it

I currently use MacBook M2 (Sonoma 14.2) and this change fixed my problem.

@zeilmannt
Copy link

I'm using macOS Sonoma 14.4 and I'm also not capable of using OpenCV
Even the solution with VideoCapture(1) doesn't change anything, it only tries to use my iPhone camera instead

@curiosdevcookie
Copy link

I'm using macOS Sonoma 14.4 and I'm also not capable of using OpenCV Even the solution with VideoCapture(1) doesn't change anything, it only tries to use my iPhone camera instead

Same here at first.

Then I used cv2.VideoCapture(1) which resulted in a OpenCV: out device of bound (0-0): 1 OpenCV: camera failed to properly initialize! error.

Switching back to cv2.VideoCapture(0) afterwards and trying it again, did the trick for me.

@hootxdontxboot
Copy link

nothing seemed to work for me until I found this code, but even changing wait key to 0 broke this for me. sucks to be so hard to read input from Mac webcam. everything else I tried on bootcamp worked no problem.

import cv2

cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
out = cv2.VideoWriter('output.mp4', fourcc, 20.0, (w,h))

while(cap.isOpened()):
ret, frame = cap.read()
if ret:
cv2.imshow("Result", frame)
out.write(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()

@athletic-geek
Copy link

Doing VideoCapture(1) instead of 0 seemed to fix it

it looks a magic number ;-)

It's funny that in my macbook, 0 stands for the camera of my connected iphone, 1 the camera of the laptop

@wastu01
Copy link

wastu01 commented Sep 5, 2024

Doing VideoCapture(1) instead of 0 seemed to fix it

I encountered the same problem and error on macOS Sonoma 14.5:

WARNING: AVCaptureDeviceTypeExternal is deprecated for Continuity Cameras.

To resolve this issue, I used ffmpeg to check the index number of my system camera with the following command:

ffmpeg -f avfoundation -list_devices true -i ""

This command lists the available video devices on your system. After identifying the correct index for my camera, I changed the parameter in VideoCapture() to the appropriate number.

In my case, the correct index was 2

cv2.VideoCapture(2)

@jmaxrdgz
Copy link

It didn't work for me until I find this code :

cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
cap.set(cv2.CAP_PROP_FPS, 20)

while True:
ret, frame = cap.read()
if not ret:
break
frame = cv2.flip(frame, 1)

cv2.imshow('Webcam', frame)

if cv2.waitKey(1) & 0xFF == ord('c'):
    break

cap.release()
cv2.destroyAllWindows()

@ddtch
Copy link

ddtch commented Nov 18, 2024

@jmaxrdgz that worked for me. thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests