opencv-python
opencv-python copied to clipboard
Continuity Camera on macOS Sonoma not working.
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/
Doing VideoCapture(1) instead of 0 seemed to fix it
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()
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.
I have the same problem on macOS 14.1 (23B74)
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
I have the same problem on macOS 14.2.1 (23C71)
I have the same problem on macOS 14.2.1
Same problem on macOS 14.3
Same problem on mac 14.3.1
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.
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.
Same problem with macOS Sonoma 14.4
Doing VideoCapture(1) instead of 0 seemed to fix it
I currently use MacBook M2 (Sonoma 14.2) and this change fixed my problem.
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
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.
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()
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