Usb webcam " Internal data stream error"

I have trouble trying to get Processing to recognise usb webcams. This camera works in Quicktime and other apps like PureData on the same computer. What am I doing wrong?

Processing console:

Processing video library using bundled GStreamer 1.20.3
Scanning GStreamer plugins... Done.
Available cameras:
[0] "FaceTime HD Camera"
[1] "Microsoft® LifeCam VX-2000"
BaseSrc: [avfvideosrc0] : Internal data stream error.

Code from “Video Library for Processing 4”:

 * Getting Started with Capture.
 * Reading and displaying an image from an attached Capture device. 


Capture cam;

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

  String[] cameras = Capture.list();

  if (cameras == null) {
    println("Failed to retrieve the list of available cameras, will try the default...");
    cam = new Capture(this, 640, 480);
  } else if (cameras.length == 0) {
    println("There are no cameras available for capture.");
  } else {
    println("Available cameras:");

    // The camera can be initialized directly using an element
    // from the array returned by list():
    cam = new Capture(this, cameras[1]);

    // Or, the camera name can be retrieved from the list (you need
    // to enter valid a width, height, and frame rate for the camera).
    //cam = new Capture(this, 640, 480, "FaceTime HD Camera (Built-in)", 30);

  // Start capturing the images from the camera

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

Hi @blippr,

Whenever you have an issue with some library, try to search on the GitHub repository issues:

It seems to be fixed but not released yet.

You can try this fix mentioned in the post:

int FPS = 30; // frames per second
cam = new Capture(this, width, height, cameras[1], FPS);

Thank you, I will try to search there first. In this case it is this specific external webcam that does not work in Processing, the “Microsoft® LifeCam VX-2000”. Another external webcam works (Logitech) in Processing, as do the internal FaceTime HD Camera.

As @josephh explained
You can use the text of these configurations to create a Capture object. On a Mac with a built-in camera,for example, this might look like:

video = new Capture(this, "name=FaceTime HD Camera (Built-in),size=640x480,fps=30");