Using Capture class for video causes sketch to hang

I notice that when using the Captureclass, my sketch will hang at the point the class was used. With this set of code, for example, the applet window of the sketch will not even be launched because Capture.list() was called in the setup() function:


void setup() { 
  size(200, 200); 

void draw() { 


How do I resolve this problem? I'm running on a Windows 8 laptop. It has a built-in camera on it. Could that be the problem?



  • The println function being called is not the case here. It takes the same amount of time as when you call it in void draw.

    Nor is a built-in camera the case. I have one on my laptop, and it works.

    This means that it's most likely not the code, or the camera, but probably your computer. Please describe the word "hang". Do you mean an error code occurs, or does your computer stall?

  • edited November 2013

    By hang, I mean Processing will stuck at which ever lineCapture.list() is called. In the code above, I had println() on theCapture.list() and so it gets stuck at that line. It's not a problem with println(), but with Capture.list()because if I were to remove println()and leave the line as just Capture.list(), Processing will still stay at the line when I run the sketch.

    So if I have this code:

    println("Line A");
    println("Line B");

    "Line A" will be printed to the console, but "Line B" never will because Capture.list()is called and the sketch will stuck at this line. If this whole code was in the setup(), the applet window wouldn't even open up.

    The annoying thing is it doesn't have any error printed onto the console. My computer isn't stalled. It just appears as if the main thread of the sketch is being held up by something and doesn't continue from the line that uses the Captureclass.

  • Do note that when I say it might be your computer, it doesn't necessarily mean that your computer is bad. I meant to say that you either may have drivers that don't co-operate with the capture class well, or you don't have any at all.

    I'm also assuming that Line B never does get through, no matter how long you wait.

    So the question comes down to this: Does your camera work when you use it?

  • I'm just guessing with the drivers, so don't be surprised if you try any driver-related fixes, and they don't work.

  • Both the webcam attached through a USB cable and the built-in one work fine in other applications. The built-in webcam works fine with Windows 8's camera app. The attached one could work in other applications too.

  • Hi, xEnOn, I had the same problem with 2.0.3 several weeks ago. The same code works well in 2.1. Please upgrade!

  • The same code works well in 2.1

    I dunno, but when i tried using 2.0.3, it still worked, so the version apparently has nothing to do with the problem. :-?

  • I have tried the version 2.1 too, but I'm still having the same problem. It's weird because I could see the LED light on my webcam lighting up. Processing however just gets stuck at the point when the LED lights up.

  • I have the same problem on my Dell Venue Pro 11. The same code works fine on my desktop with web cam.

  • edited June 2014

    Same problem here. Capture.list() works once after a reboot, then not at all after that. The call never returns. I have 2 webcams; one internal to the laptop and one external usb generic.

    I've also noticed that quitting the app leaves the webcam active led lit.

  • I've also noticed that quitting the app leaves the webcam active led lit.

Sign In or Register to comment.