opencv-python icon indicating copy to clipboard operation
opencv-python copied to clipboard

Continuity Camera on macOS Sonoma not working.

Open peterk268 opened this issue 1 year ago • 19 comments

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 avatar Nov 14 '23 16:11 peterk268

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

peterk268 avatar Nov 14 '23 18:11 peterk268

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()

ChanifRusydi avatar Nov 21 '23 07:11 ChanifRusydi

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.

vshankar5959 avatar Nov 27 '23 21:11 vshankar5959

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

snailshen2014 avatar Dec 13 '23 10:12 snailshen2014

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

sambhavnoobcoder avatar Dec 25 '23 07:12 sambhavnoobcoder

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

FlintYu avatar Jan 12 '24 09:01 FlintYu

I have the same problem on macOS 14.2.1

earriagadadiaz avatar Jan 31 '24 14:01 earriagadadiaz

Same problem on macOS 14.3

lukegriley avatar Feb 09 '24 07:02 lukegriley

Same problem on mac 14.3.1

tzlan avatar Feb 14 '24 18:02 tzlan

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 avatar Feb 21 '24 01:02 JBelmont72

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.

JBelmont72 avatar Feb 21 '24 01:02 JBelmont72

Same problem with macOS Sonoma 14.4

lorenzo677 avatar Mar 10 '24 11:03 lorenzo677

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

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

srinrealyf avatar Mar 11 '24 03:03 srinrealyf

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

zeilmannt avatar Mar 15 '24 07:03 zeilmannt

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.

curiosdevcookie avatar Mar 20 '24 06:03 curiosdevcookie

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()

hootxdontxboot avatar Apr 15 '24 01:04 hootxdontxboot

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

athletic-geek avatar Aug 15 '24 15:08 athletic-geek