How do I capture the same webcam source on two machines

Hi

I need some good hint on the following. It is not really a Processing question, but I need it for a Processing project.

Say I have installed a Processing executable on two machines (say same OS). The script is such that a webcam source is captured and somehow shown modified.

Question is (first version): how do I connect the same webcam to the two machines at the same time? Do I need some kind of splitter?

Also (second version): what if the webcam is the webcam of one of the two machines? How do I pass the webcam source to the other machine too?

Thanks, Cheers
mario

There is no way I know of to do this. Webcams, being USB, are controlled by one computer only.

The only way I know of is to write the image data from one webcam to a shared directory and let the 2nd machine access it. It works fine for still images but if you doing video, you have to complete the video stream first. The still images are close to “real time” access if the second machine reads the directory frequently.

I use webcams for astrophotography projects and this is what I’ve learned from experience. Cheers.

1 Like

Hi
I think over network it could be here is some hints

1 Like

The client/server link that jafal provided appears to be the most direct way of solving the problem using Processing code. :+1: The code is 4 years old so would most likely be fine with 3.5.4 and need testing on 4.0b8 if your using it.

Hello,

I used YawCam and configured it as an HTTP server and was able to view on two PCs with code below:

// YawCam HTTP Stream Viewer
// v1.0.0
// GLV 2022-06-02

PImage img;

void settings()
  {  
  img = loadImage("http://192.168.1.100:8888/out.jpg"); // Modify URL for you PC
  println (img.width, img.height);
  size(img.width, img.height);
  }

void setup() 
  {
  frameRate(60);
  }

void draw() 
  {
  background(0);
  img = loadImage("http://192.168.1.100:8888/out.jpg");
  image(img, 0, 0);
  println(frameRate);
  }

:)

Thanks for your help. I’ll check better next week, and let you know.
cheers
mario

1 Like

Hello @mario60 ,

Any updates?

:)

Hi glv

I tried CamNetClient+CamNetServer+JPEGEncode at https://github.com/torb-xyz/processing-experiments, and they work. I tried to join the two scripts into a single one, as to have both client and server on both machines I used to test, and it works too.

I need to play a little around, and to check how to use them to get a couple of effects I am thinking about. Anyway, so far so good.

I will update the board.
thanks to ask
cheers
mario

ps. I could test with several machines in a lab, within a LAN. In a single case, the client side on a Win10 could not write into the server side on a Win11 machine, I am not sure why.