Getting webcam to turn on with video library


I’m still very new to processing, I haven’t used it in a while and I’ve changed computer since the last time I was experimenting with it.

I’m trying to get the built in webcam on my 2013 Macbook Pro Retina to show but it seems like I’m missing something.

I have used this code (and installed the video library properly):


Capture video;

void setup() {
  video = new Capture(this, 320, 240);

void captureEvent(Capture video) {;

void draw() {
  image(video, 0, 0);

The sketch runs and there are no errors but all I see is the canvas I set up at the right size but it stays grey. The light from my laptop’s camera doesn’t turn on so the camera is not being activated. I tested the camera and it works fine with Photobooth.

I have ran this code from the processing website as well:


Capture cam;

void setup() {
  size(640, 480);

  String[] cameras = Capture.list();
  if (cameras.length == 0) {
    println("There are no cameras available for capture.");
  } else {
    println("Available cameras:");
    for (int i = 0; i < cameras.length; i++) {
    // The camera can be initialized directly using an 
    // element from the array returned by list():
    cam = new Capture(this, cameras[0]);

void draw() {
  if (cam.available() == true) {;
  image(cam, 0, 0);
  // The following does the same, and is faster when just drawing the image
  // without any additional resizing, transformations, or tint.
  //set(0, 0, cam);

And the same thing happens, no errors in the console but just a blank canvas. The print function that is supposed to display the available cameras on the machine is apparently not doing anything (nothing show up in the console).

Is this a known error? Everything I can find online about problems with Macbooks mentions at least seeing the camera’s light turning on.

Thank you!

1 Like

Were you able to resolve this issue?

What version of MacOS is your laptop running?

Yes I was able to finally get the camera working thanks to contribution in this this other forum I posted to.
Everything is explained there but to summarize I updated my Macbook to Catalina (was on Mojave before that) just to see if it would change anything and after that I was getting errors in the console. I think I would have gotten the same errors under Mojave if I had waited long enough but I would kill the sketch after a few seconds of the cam not displaying.
So after that I replaced the video library with the beta one (that works under Catalina) and after that the issue was that my OS wouldn’t allow Processing to access the webcam but wouldn’t show the pop up that usually prompts users to accept when an app requests access to the camera.
I had to manually add Processing to the list of allowed apps by booting in recovery mode and disabling System Integrity Protection (SIP) as is detailed on that page.
Hope that can help others facing the same issue.