Capture cam fail / Video library issue

live camera capture works maybe 1 out of every 20 times i click to run the sketch (see simple example code below). otherwise, the feed freezes on a gray screen with spinning wheel and the following error message in the console:

Could not find any devices
Processing video library using GStreamer 1.16.2
IllegalStateException: Could not find any devices
IllegalStateException: Could not find any devices
IllegalStateException: Could not find any devices
IllegalStateException: Could not find any devices

processing 3.5.4 x64
windows 10 x64
camera works fine in other apps (e.g. Camera, Zoom), drivers are updated

import processing.video.*;

Capture cam;

void setup() {
  size(640, 480);
  cam = new Capture(this, 640, 480);
  cam.start();
}

void draw() {
  if (cam.available()) {
    cam.read();
  }
  image(cam, 0, 0);
}

The same problem happens to me.

When I try to run some Capture examples these messages appear in the console:
Processing video library using GStreamer 1.16.2
There are no cameras available for capture.
WARNING: no real random source present!

Windows 10
Processing 3.5.4

Try Processing can't find the camera - Video Libraries don't work - #13 by neilcsmith

1 Like

Hi neilcsmith:

That magic works for me!

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

Thanks a lot.

1 Like

@neilcsmith @peripecio

thank you It was helpful.

@neilcsmith @peripecio

  1. It works well through ‘Processing Tool’.

  2. However, ‘application export’ (ex. exe file) / does not work.

Any reason?

surface.setTitle(“3”);
int tries = 0; int limit = 3;
while(tries < limit){
try {
surface.setTitle(“4-1”);
delay(100); cam = new Capture(this, “pipeline:autovideosrc”); delay(100);
delay(100); cam.start();

} catch(Exception e){
  tries++;
  e.printStackTrace();
    continue;
} 
surface.setTitle("4-"+str(tries+1));
break;

}

why
If I export it as an exe, will it not work?

cam = new Capture(this, “pipeline:autovideosrc”);
It freezes when I use the ‘Capture’ function above.

  1. Execute with ‘processing tool’: It works well.
  2. Execute with ‘exe, export’: Does not work.

Do you know why? help.

See this answer - Exporting Sketch With Movie Is Blank - #5 by neilcsmith

You need to move the GStreamer library around in the exported application as the Video library is looking in the wrong location due to a bug in Processing.

1 Like

@neilcsmith

thank you. ~ ^^