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
macOS Catalina Issue #723
Comments
Hi @burniejm |
@sarxos any suggestions for that issue? |
I am actually only using webcam-capture to enumerate cameras and populate a dropdown of cameras. I am then using openCV to grab frames from the selected device index (gathered from webcam-capture). Even hardcoding the device index didn't work until I updated to the newest javaCV (1.5). My project already uses ffmpeg for various video tasks, so I implemented the ffmpeg driver for webcam-capture and used the "list-devices" command to populate my dropdown. Hope this helps. |
hi @burniejm |
Since I don't actually use the webcam library to capture all I really need is the index of the video devices and the name. I do rely on this library to scan for hardware changes (usb camera add/remove) using the WebcamDiscoveryListener functionality. Here is my pared down getUnixDevices method:
I added an FFMpegCliDevice constructor that just takes a name as well. |
Hi @burniejm |
I am trying to run it on macos catalina beta, I have 2 questions: 1-) It cannot find dependency in pom.xml for webcam-capture-driver-ffmpeg-cli
2-) I have tried other drivers listed on the page but, It could not detect any camera with other drivers? How you have resolved it? |
@ademzumbul I just manually added the driver files to my project as I couldn't get it to work using gradle. |
Hello, I am using OpenIMAJGrabber on MAC for handling camera device. Now after update MAC OSX to 10.15, i can't get listed devices (empty). Can anyone share any information about how to work OpenIMAJGrabber on MAC 10.15? Regards, Pai |
Here is the issue for the default driver used by this library. |
I'm having the same issue on Catalina. Looks like work was started on a fix for openimaj/openimaj#170 but no activity since Oct 2019. |
I have PR (#765) that may address this issue. |
Hi @kkieffer Can you please take a look at the comment in your PR? |
I got the following error message on my
Here is the source code which can be used to reproduce the case. import javax.swing.JFrame;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import com.github.sarxos.webcam.WebcamResolution;
import com.github.sarxos.webcam.ds.openimaj.OpenImajDriver;
public class WebcamPanelExample {
static {
Webcam.setDriver(new OpenImajDriver());
}
public static void main(String[] args) throws InterruptedException {
Webcam webcam = Webcam.getDefault();
webcam.setViewSize(WebcamResolution.VGA.getSize());
WebcamPanel panel = new WebcamPanel(webcam);
panel.setFPSDisplayed(true);
panel.setDisplayDebugInfo(true);
panel.setImageSizeDisplayed(true);
panel.setMirrored(true);
JFrame window = new JFrame("Test webcam panel");
window.add(panel);
window.setResizable(true);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.pack();
window.setVisible(true);
}
} Here is the project depenencies in maven approach, and I also tried the
IMO. I think this error is caused by the
when I test the code which only depended on the So, in your opinion, is there any solution to this problem. Or this is caused by the |
@jingmingcn try commenting out this line:
The fix from my PR addressed the built in default driver (which is openImaj) in webcam capture. I neglected to remember that you can also load the external OpenImaj driver (separate source). @sarxos can you also patch the driver-openimaj under webcam-capture-drivers? |
@kkieffer I got the same error message after removing the driver setting command line. An update about this issue is the case works very well on my I hope the information above will help you to figure out the problem and find a solution. Thanks for your great work. |
Can you open your Console.app in /Applications/Utilities and see if anything is logged when you run? Although I can now see which webcam devices are available, there's a problem when trying to open the camera. In console I see this: Prompting policy for hardened runtime; service: kTCCServiceCamera requires entitlement com.apple.security.device.camera but it is missing for REQ:{ID: net.java.openjdk.cmd, PID[1631], auid: 501, euid: 501, binary path: '/Library/Frameworks/Java/jdk-14.jdk/Contents/Home/bin/java'} |
@kkieffer I got the following message bundling to the process
I am not sure whether the updates above would help or not. I am kind of lacking the system driver's developing experience. |
Ok - I have a solution, although it's not going to be pretty. But it does work. First, the process "java" does not have an entitlement to use the camera. The only way around this as far as I can figure is to re-sign the java executable. So for this you're going to need a Apple Developer certificate.
Now, assuming you run your test code with this java binary, it should work. You will get a prompt asking for permission to use the camera. Unfortunately, you're not going to be able to redistribute your jar to anyone with Catalina since they won't have the re-signed java binary. The solution will be to package into a .app with the correct entitlements. However the JDK14 jpackage tool is broken at the moment and I'm waiting on this fix: |
@kkieffer Thanks for your solution which I believe will work. But in my own case, the Thanks for your great idea which really blows my mind. |
@kkieffer Here is the update about the solution you provided in the last thread been applied on the First, I have to correct one mistake in the previous thread I posted, which said about the The conclusion is I have failed to make the solution you have given works on my case. By
Thanks for your help anyway. Maybe the cause of the problem is due to my individual special case on Here are some supplementary notes. When doing the |
@kkieffer Here is the update. I found a solution to solve this issue, which is by explicitly declaring an environment variable name Sorry for wasting your valuable time on a stupid question I have posted. |
Hi @jingmingcn, @kkieffer, I believe this is not a stupid question at all. It's a real issue. Adding I'm not really familiar with the MacOS permissions, especially on the newer systems, and with current COVID-19 situation, have no access to Mac machine where I can test. If you have any ideas on how we can permanently fix this issue I'm willing to work this out somehow. Can building and signing it properly help in this case? |
@jonhare I would also be curious where I could find the sources for the bridj-0.7-20140918-2 build. |
@ekamikke @craigraw sorry - I missed this the first time around. I believe (but I'm not 100% sure) that it is based off https://github.com/jonhare/nativelibs4java (which added armhf and armel support), but with a new dyncall dylib (straight build of the dyncall 1.0 source) just for OSX. As it was a quick fix, I just patched the bridj-0.7-20140918 jar with the updated library. For a quick fix, I could patch the bridj-0.7-20140918-2 jar with the change required for java 9 if someone tells me what needs changing? Going forwards we should perhaps try to work together to sort this mess out... Probably starting with @ochafik's latest sources, merging in the changes from my branch for arm support (which really need testing on a modern arm platform, not one from 2014!) and fixing the Java 9 issue. |
Hi @jonhare - no problems and thanks for the original fix! It's been working well. Would love to have the security of having access to the source though. Re the Java 9 change, as I recall it's just a one line addition in Platform.java - see the last diff at this link: nativelibs4java/BridJ@master...ConsensusJ:consensusj-master It effectively just removes the leading / from the path allowing the classloader to find the resource in Java 9 and up. |
@jonhare I do agree with @craigraw that having the sources for builds would obviously be preferable. However this at least gives all the info on how to rebuild it if needed. Thanks a lot for the quick response! I am using the 0.7-20140918-2 build as such in OpenJdk 11. No issues found when running org.openimaj:core-video-capture:1.3.10 on it on OSX Catalina or Windows 10. |
Totally agreed we need to have actual source. Looking more closely I'm pretty much satisfied that the original 0.7-20140918 version corresponds with the HEAD of the master branch of https://github.com/jonhare/nativelibs4java (not least because the dates tie up exactly!) I'll add the Java 9 fix & back-port the dyncall fix into my fork of the code and then make a new release. We we can think about whether we need any of the other changes that @ochafik made after the 18th Sept 2014... |
@ekamikke @craigraw are you willing to do some testing? http://maven.openimaj.org/com/nativelibs4java/bridj/0.7-20140918-3/ has jars with a fix for java 9 and also the dyncall fix on OSX. My java 9 fix for modules is slightly different to the one-liner because I wasn't convinced that it wouldn't break older Java versions or non-module based projects in Java 9+. Source code for the build is here: https://github.com/jonhare/nativelibs4java/tree/0.7-20140918-3 |
This is awesome @jonhare. Verified it works on OSX Catalina and Windows 10 on Corretto JDK 11. Thanks a whole bunch! I forked your repo because we prefer to not depend on custom builds from unofficial repositories directly. With the changes you made I am able to compile and package the BridJ project, but only if I ignore tests. Did all tests pass for you? |
@ekamikke re tests - yes tests were fine for me (Catalina 10.15.4, JDK 1.8.0_121). I had to update the STLTest and JAWTTest to the versions in the official HEAD version in one of the commits I made though... |
Using webcam-capture 0.3.13-SNAPSHOT with bridj 0.7-20140918-3 (from maven.openimaj.org) makes everything work on Mac again for me. |
I got a JVM crash with webcam-capture 0.3.13-SNAPSHOT and bridj 0.7-20140918-3.
Sometime I got another error:
|
@sarxos Do you have any plans to wrap this into an official release? |
Not sure if I am doing something wrong, but I am not able to list the Webcams on my MacOS Catalina 10.15.7:
Here my gradle configuration: repositories {
mavenCentral()
mavenLocal()
maven { url 'http://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'http://maven.openimaj.org' }
}
dependencies {
compile 'com.nativelibs4java:bridj:0.7-20140918-3'
compile 'com.github.sarxos:webcam-capture:0.3.13-SNAPSHOT'
} What is wrong with my configuration? |
Hi cansik, thanks, |
@cansik @alexmao86 the raw openimaj grabber works fine for me on both 10.15.7 (I've tested both jdk 1.8.0_121 and jdk_1.8.0_281) as well as a clean install of Big Sur (using the latest 1.4-snapshot of the openimaj grabber and bridj:0.7-20140918-3) - note I'm not using webcam-capture, just openimaj directly. The error @cansik reported comes from within webcam-capture and would suggest that perhaps the libOpenIMAJGrabber.dylib either wasn't correctly unpacked into the classpath or that it was perhaps an old version? |
Hi all, What is the status now with getting it to work with Catalina 10.15.7 as off 19th May 2021? I am just running out of the box using the default driver. When I tried:
I got:
When I tried the snapshot version:
I am getting the same error as mentioned above:
I am on Catalina and I do not know if there are even bigger problems with Big Sur? Can any smart person help me out on this one? Does anyone know of a driver that will work on mac Catalina? The software needs to be a bit portable, I cannot expect users to do hacky things. If it is being sorted out, then I am happy to do hacky stuff while I develop the software (knowing that by the time I finish the issue is resolved). Thank you for your time. |
Does anyone know a driver that will work with Mac Catalina? - I have tried all the ones that seem to support Mac and they all have issues - I think due to the permission problem of Catalina. There is a lot of talk and fixes - I have tried everything to no avail - it seems strange to me that it is so hard. Any help would be great. Prior to Catalina I had no issues with Webcam and Java. |
Use the
|
@craigraw thanks for your reply I tried with repositories:
and dependencies:
When I try in STS the jvm crashes When I try on the command line, it does not crash but I get a null Webcam:
I have also tried:
My code included:
I am using:
I was thinking that if this was too work I would get some security warning that I have to accept the webcam. In System Preferences / Security & Privacy / Privacy / Camera, I am not sure If I should be seeing Java there. Anyone know? I am super stuck and wish this would work. Any pointers anyone can give will be super helpful. @sarxos what do you think about all of this ? This webcam thing is super important for me. Thank you all for your time. |
@kkieffer Thank you for your comment. I installed
I printed my webcams and in the code selected my "FaceTime HD Camera (Built-in)" I debugged in the code and was able to call methods like:
However when I call:
it is at that point that the VM crashes. If I look at the log the last log statement it printed was:
i.e. it crashed out likely in WebcamOpenTask Some questions: (i) I have no popups or anything asking me for permission - do you get asked for permission to access the webcam when you run your code? (ii) Do you have this env varable set?
I changed to the exact versions of bridj and webcam-capture as you. So there must be something different you are doing to me. I opened the console of mac and looked for the crash error and found this:
The message to note is:
So this sucks ass - does anyone know how this permission thing is supposed to work - is the code supposed to trigger a popup except with me it is not triggering the popup? Do you have anything that I can run that works for you, that way, I could run to see if it works for me. Ideally that should be a jar that I just run like:
Thank you for your time |
Hi Guys, I am still stuck. If we are trying to get the code working on Mac Catalina, are we supposed to have an automated build that produces a dmg file using something like jpackage that does signing of the native libraries and the whole artefact? If that is true, are we supposed to do that every time we want to test the code - i.e. is there a dev mode for doing this stuff without signing jars etc? Web browsers have a requirement that one uses SSL for the webcam, however if you are using a localhost domain this restriction does not apply. Is there something equivalent with Catalina, Java and webcams? Can anyone advise what to do or let me know if they are working on getting support for Catalina? Else I will have to become a specialist in this field to get over this hurdle. That may involve learning JNI and the security model of the Mac. I was hoping the library could handle some of that complexity. Thank you Regards JD |
I tried to get webcam working with Mac OS Catalina and the vlc driver and when I call:
I get:
My maven dependencies are:
Actually I cannot get MacOS Catalina working with any driver - this is becoming a nightmare. Anyone know about this vlc error? Is something missing from the caprica functionality or is this because something is missing from the sarxos webcam-capture library? I just need a single way to get MacOS Catalina working with the webcam-capture library - it seems none of the options work. Maybe am doing something very stupid or it just does not work. If anyone knows how to get it working on MacOS Catalina please let me know and I will owe you a lorry load of beers - Thank you. |
I tried to get webcam working with Mac OS Catalina and the opencv driver and when I call:
I get:
My pom.xml had:
Maybe the sarxos code needs an older version of opencv? Every driver I try with MacOs Catalina I have issues - I think they are all different issues. |
SUCCESS getting webcam to work with MacOS Catalina - time to party! For details of how I did it and also to download a zip of the pom.xml and my code see this response: |
@burniejm I am using javacv because I wanted to record webcam and mic into a single video file. My problem with javacv is that this code does not work:
I think that is the same code that did not work for you? Since then did you find out whether it is because a jar of native stuff is missing, or is it a dependency problem? I wrote about my error for videoInput.listDevices() at: Thanks for your time |
Hi, please try this driver, it should work with recent MacOS versions https://github.com/eduramiba/webcam-capture-driver-native |
My javaFX app uses this library to capture video from a webcam on windows and mac. It has worked great on both platforms up until now. I am testing on macOS Catalina beta2 and now getWebCams() is returning nothing. My discoveryListener is not firing either. I have enabled debug logging as described in the wiki and I don't see any errors. I am using the default driver. Any idea what could be going on??
The text was updated successfully, but these errors were encountered: