processing / processing-video

GStreamer-based video library for Processing
276 stars 130 forks source link

OSX 14.4.1 Sonoma upgrade breaks USB webcams - seems to be an issue with Java/Processing video library #226

Open SimonBiggsUK opened 6 months ago

SimonBiggsUK commented 6 months ago

Hi all

Recently upgraded an M3 Macbook Pro from Sonoma 14.4 to 14.4.1. I am also working on projects that employ the Processing video library and external webcams (camera needs to be 10 metres away from computer, thus external). I've been very familiar with the warning message that appears in the Processing Console since Monterey

"java[13308:647912] WARNING: AVCaptureDeviceTypeExternal is deprecated for Continuity Cameras. Please use AVCaptureDeviceTypeContinuityCamera and add NSCameraUseContinuityCameraDeviceType to your Info.plist."

I understand that there is no fix for this at the moment (requires a rewrite of the video library). I also understand this issue affects people using OpenCV in other development environments (eg: Python). However, whilst I've been getting this warning for a couple of years the issue has not been fatal. With the OSX upgrade to 14.4.1 it does appear to be fatal, as Processing will no longer recognise an external webcam (have tested with a couple of different models), and simply displays a black screen and generates the following error:

"BaseSrc: [avfvideosrc0] : Internal data stream error."

Note that Processing is still working with the internal webcam and with Continuity Camera and that the external webcams still work with software such as Zoom, Facetime and Skype. The issue only seems to exist when addressing the cameras with Processing/Java.

I really need to be able to work with a remote video source in Processing and this is very annoying. I can use Continuity Camera and an iPhone for development, but this is not sustainable, especially when exhibiting works. The iPhone is also less controllable than higher end webcams and proves difficult in low-light environments, such as I work in (will not keep manual focus or shutter settings over periods of time).

Is anybody else having these issues? Has anyone found a work around? If not is there any expectation that Processing's video library will be updated for newer Mac's?

FYI, this is the function I use for initialising a video source:

void videoSetup(){ //initialise camera vidX=width; //set camera resolution to monitor resolution (usually HD) vidY=height; FPS=30; String[] cameras=Capture.list(); println(Capture.list()); if(cameras.length==0){ println("No cameras available for capture."); exit(); } else { video=new Capture(this,vidX,vidY,Capture.list()[0],FPS); //using continuity camera (iPhone) video.start(); } }

rodolfoacostacastro commented 4 months ago

I have similar issues with a Macbook M1 chip and Sonoma 14.5 . :/

SimonBiggsUK commented 4 months ago

I have not been able to fix this problem. My solution has been to use Continuity camera with my iPhone as a webcam and/or the Canon EOS webcam Utility with a Canon EOS 6D DSLR camera. Both work. The Canon solution is great as it allows you to use a professional level camera with a serious lens of your own choice, and to have everything set to manual (very good if you require a stable image for image processing, such as background removal). A webcam is much easier to use, and small, but it doesn't allow for this level of control. So, it's a trade-off. The iPhone gives good image quality and is really easy to use (wireless and everything) but like a webcam it doesn't offer as much control as a professional DSLR - so if you require that control I'd recommend using the Canon solution. Of course that requires you have a compatible Canon DSLR lying around.

I'd hoped that OS14.5 might fix the issue - but sounds like that was too much to wish for...

rodolfoacostacastro commented 4 months ago

Ey thanks for the alternative. I will try also the Continuity Camera. This was my workaround: I used OBS to start a virtual camera and then I changed the code to initiate the camera in processing to:

cam = new Capture(this, "pipeline:autovideosrc" );

This change also work if you are using Windows 11 and you are having the same issue, only difference is that in windows you don’t need the virtual camera. In OS14.5 I had problems with 3 different external webcams. It took a while to figure it out and yeah, it’s an ugly solution. I hope this gets fixed soon.

SimonBiggsUK commented 4 months ago

You are right - this worked for me too - but it was very slow. Too slow to be useful for my purposes.

best wishes

Simon Biggs http://www.littlepig.org.uk @.*** http://amazon.com/author/simonbiggs https://people.unisa.edu.au/Simon.Biggs

On 17 May 2024, at 16:46, rodolfoacostacastro @.***> wrote:

Ey thanks for the alternative. I will try also the Continuity Camera. This was my workaround: I used OBS to start a virtual camera and then I changed the code to initiate the camera in processing to:

cam = new Capture(this, "pipeline:autovideosrc" ); This change also work if you are using Windows 11 and you are having the same issue, only difference is that in windows you don’t need the virtual camera. In OS14.5 I had problems with 3 different external webcams. It took a while to figure it out and yeah, it’s an ugly solution. I hope this gets fixed soon.

— Reply to this email directly, view it on GitHub https://github.com/processing/processing-video/issues/226#issuecomment-2116906929, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARAAVVKFWB77WI5QYWAVK3ZCWVFHAVCNFSM6AAAAABFPAWWCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJWHEYDMOJSHE. You are receiving this because you authored the thread.