# Streaming sketch output to different machine?

**URL:** <https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847>\
**Category:** Processing\
**Created:** [January 6, 2021, 10:00pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847 "2021-01-06T22:00:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![baylyd](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@baylyd](https://discourse.processing.org/u/baylyd)\
**Post date:** [January 6, 2021, 10:00pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/1 "2021-01-06T22:00:34Z")

</div>

Hello there,

I have an upcoming project which requires running the code and viewing the outputs on different machines, is there a way to stream the processing sketch over a network? It’d be great to get the data either as complete frames, or if there’s a high performance video streaming method anyone can recommend I’d appreciate that also. Are there any clear tutorials for how I might do this?

Thanks!

---

<div class="post-metadata">

**Author:** ![ErraticGenerator](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/erraticgenerator/32/11304_2.png) [@ErraticGenerator](https://discourse.processing.org/u/ErraticGenerator)\
**Post date:** [January 10, 2021, 7:47pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/2 "2021-01-10T19:47:52Z")

</div>

This may give you some ideas?

> **[processing/p5.js](https://github.com/processing/p5.js/wiki/p5.js,-node.js,-socket.io)**
>
> p5.js,-node.js,-socket.io

---

<div class="post-metadata">

**Author:** ![baylyd](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@baylyd](https://discourse.processing.org/u/baylyd)\
**Post date:** [January 10, 2021, 9:29pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/3 "2021-01-10T21:29:05Z")

</div>

Thanks for the reply! You’re completely correct that this would definitely get me thinking about how to use two different machines related to a processing sketch.

With regards to using a server can you think of any way to do the sketch rendering on the server? I really like to have code executed on one machine and the visual results being sent to another; said differently I want the processing sketch frames created on the server and sent for display to the client.

The reason I’m after all of this is I have access to a server that is quite a bit more powerful than my own machine but it’s headless and I would like to see the results. Thanks again for the info!

---

<div class="post-metadata">

**Author:** ![ErraticGenerator](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/erraticgenerator/32/11304_2.png) [@ErraticGenerator](https://discourse.processing.org/u/ErraticGenerator)\
**Post date:** [January 10, 2021, 11:09pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/4 "2021-01-10T23:09:19Z")

</div>

Here is a node implementation of canvas:

> **[Automattic/node-canvas](https://github.com/Automattic/node-canvas)**
>
> Node canvas is a Cairo backed Canvas implementation for NodeJS.

and node p5js:

> **[andithemudkip/p5-node](https://github.com/andithemudkip/p5-node)**
>
> A Node.js port of the p5.js library. Contribute to andithemudkip/p5-node development by creating an account on GitHub.

I haven’t tried these libraries and perhaps I might now, but if you find this working for your project, I’d love to hear what you think of them.

---

<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:** [January 11, 2021, 12:59am UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/5 "2021-01-11T00:59:25Z")

</div>

Hello,

> **[shiffman/Processing-UDP-Video-Streaming](https://github.com/shiffman/Processing-UDP-Video-Streaming)**
>
> Example code to stream video capture from one Processing sketch to another.

Not tested… topic caught my interest and got me thinking about this.

`:)`

---

<div class="post-metadata">

**Author:** ![baylyd](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@baylyd](https://discourse.processing.org/u/baylyd)\
**Post date:** [January 11, 2021, 4:12pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/6 "2021-01-11T16:12:07Z")

</div>

More excellent leads, thank you @ErraticGenerator ! I’ll peak at those later today.

yes @glv that’s totally in the spirit of what I’m looking for.

---

<div class="post-metadata">

**Author:** ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)\
**Post date:** [July 14, 2025, 2:16pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/7 "2025-07-14T14:16:55Z")

</div>

Bumping this thread to share an updated version of the UDP video streaming example code.

This should now work with Processing 4, and the latest versions of the UDP and video libraries.

> **[GitHub - SableRaf/Processing-UDP-Video-Streaming: Example code to stream video capture from one...](https://github.com/SableRaf/Processing-UDP-Video-Streaming)**
>
> Example code to stream video capture from one Processing sketch to another.

Edit: the changes have been merged into the [original repo](https://github.com/shiffman/Processing-UDP-Video-Streaming) ✨ Thanks Dan!

---

<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 15, 2025, 6:56pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/8 "2025-07-15T18:56:11Z")

</div>

Hello @sableraph,

I took this out for test run and it works!

Thanks for all the work you are doing!

My feedback below…

The reference for` exit()` states:

> Rather than terminating immediately, `exit()` will cause the sketch to exit after `draw()` has completed (or after `setup()` completes if called during the `setup()` function).

I tried the code with _no cameras_ and it failed to `exit()` and generated a _`NullPointerException`_ at `cam.start();` and never _exited_.

Adding a `return()` after the `exit()` corrected this since it went directly to the end of `setup()`(skipping over `cam.start();`) to `exit()`:

```auto
exit();
return;

```

References:

- [exit() / Reference / Processing.org](https://processing.org/reference/exit_.html)
- [return / Reference / Processing.org](https://processing.org/reference/return.html)

I learn something new every day!

`:)`

---

<div class="post-metadata">

**Author:** ![sableraph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sableraph/32/251_2.png) [@sableraph](https://discourse.processing.org/u/sableraph)\
**Post date:** [July 16, 2025, 3:08pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/9 "2025-07-16T15:08:24Z")

</div>

Good catch! Feel free to open a PR on Dan’s repo 😃

---

<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 16, 2025, 3:35pm UTC](https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/10 "2025-07-16T15:35:53Z")

</div>

> [@sableraph](#):
>
> Feel free to open a PR on Dan’s repo

Done!

> <https://github.com/shiffman/Processing-UDP-Video-Streaming/issues/5>
>
> Hello,
> 
> 
> It will not exit if there are no cameras and generate a \_NullPointerExc…eption\_ at \`cam.start().\`
> 
> This will resolve this issue:
> 
> \`\`\`
> exit();
> return; // Add this
> \`\`\`
> 
> References:
> https://processing.org/reference/exit\_.html
> https://processing.org/reference/return.html
> https://discourse.processing.org/t/streaming-sketch-output-to-different-machine/26847/8
> 
> :)

`:)`
