# How do I capture the same webcam source on two machines

**URL:** <https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265>\
**Category:** Project Guidance\
**Created:** [June 1, 2022, 10:27am UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265 "2022-06-01T10:27:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mario60](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mario60](https://discourse.processing.org/u/mario60)\
**Post date:** [June 1, 2022, 10:27am UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265/1 "2022-06-01T10:27:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![The\_Traveler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/the_traveler/32/16252_2.png) [@The\_Traveler](https://discourse.processing.org/u/The_Traveler)\
**Post date:** [June 1, 2022, 1:50pm UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265/2 "2022-06-01T13:50:46Z")

</div>

> [@mario60](#):
>
> how do I connect the same webcam to the two machines at the same time? Do I need some kind of splitter?

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

> [@mario60](#):
>
> 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?

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.

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [June 1, 2022, 2:06pm UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265/3 "2022-06-01T14:06:56Z")

</div>

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

> **[GitHub - torb-xyz/processing-experiments: Just goofing around with Processing](https://github.com/torb-xyz/processing-experiments)**
>
> Just goofing around with Processing. Contribute to torb-xyz/processing-experiments development by creating an account on GitHub.

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/20667/reliably-send-images-over-net.html)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.

> **[Network](https://processing.org/tutorials/network/)**
>
> An introduction to sending and receiving data with clients and servers.

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [June 1, 2022, 2:13pm UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265/4 "2022-06-01T14:13:52Z")

</div>

> **[GitHub - PBernalPolo/sendPImage: Client and server that send PImage to each...](https://github.com/PBernalPolo/sendPImage)**
>
> Client and server that send PImage to each other. Thanks to "https://github.com/torbjornlunde/processing-experiments" - GitHub - PBernalPolo/sendPImage: Client and server that send PImage...

---

<div class="post-metadata">

**Author:** ![The\_Traveler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/the_traveler/32/16252_2.png) [@The\_Traveler](https://discourse.processing.org/u/The_Traveler)\
**Post date:** [June 1, 2022, 2:46pm UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265/5 "2022-06-01T14:46:03Z")

</div>

The client/server link that jafal provided appears to be the most direct way of solving the problem using Processing code. 👍 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.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [June 2, 2022, 9:32pm UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265/6 "2022-06-02T21:32:29Z")

</div>

Hello,

I used [YawCam](https://www.yawcam.com/) and configured it as an HTTP server and was able to view on two PCs with code below:

```auto
// 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);
  }

```

`:)`

---

<div class="post-metadata">

**Author:** ![mario60](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mario60](https://discourse.processing.org/u/mario60)\
**Post date:** [June 3, 2022, 1:04pm UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265/7 "2022-06-03T13:04:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 3, 2022, 8:29pm UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265/8 "2022-07-03T20:29:50Z")

</div>

> [@mario60](#):
>
> I’ll check better next week, and let you know.

Hello @mario60 ,

Any updates?

`:)`

---

<div class="post-metadata">

**Author:** ![mario60](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mario60](https://discourse.processing.org/u/mario60)\
**Post date:** [July 3, 2022, 9:24pm UTC](https://discourse.processing.org/t/how-do-i-capture-the-same-webcam-source-on-two-machines/37265/9 "2022-07-03T21:24:34Z")

</div>

Hi glv

I tried CamNetClient+CamNetServer+JPEGEncode at [https://github.com/torb-xyz/processing-experiments](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.
