Web cam capture Win 11 vs Mac OS

Hi

on a Win11 machine, to capture a web cam, it seems I need the following line of code:

  cam = new Capture(this, "pipeline:autovideosrc"); 
  cam.start(); 

as the following one returns an error that there is not a device

 String[] cameras = Capture.list();
 if (cameras.length != 0) { 
 cam = cameras[0]; 
 cam.start(); 
 }

(both codes works fine on a Mac).
Is it a known issue? How do i fix it on the Win machine?

Hello,

Related:

:)

I would just use pipeline:autovideosrc everywhere! Is there a reason you think you need to “fix” it?

Hi,

with the pipeline:autovideosrc code I am not sure how to list several webcam devices (i need at least two). Is there a way?
thanks cheers
mario

Hi

I see the solution by “Could not find any devices” error on Windows · Issue #168 · processing/processing-video · GitHub (lucasfredericks commented on Apr 1). Unfortunately I do not know what pipeline:autovideosrc, pipeline:ksvideosrc and so on, really refer to. How/where do I learn about those options? Thanks
m.

They are direct references to the underlying GStreamer pipeline elements and configuration - eg. ksvideosrc

Unfortunately, autovideosrc does not support device indexes. You need to use device-index=0 and device-index=1 etc. to pick up multiple cameras. And if you want the sketch to work across multiple OS you need to specifiy different pipelines on each. PraxisLIVE actually handles this for you, but if you don’t want to use that, our code for this may at least be useful to look at praxiscore/GStreamerSettings.java at master · praxis-live/praxiscore · GitHub

1 Like