# VIDEO IP (NewTek NDI)

**URL:** <https://discourse.processing.org/t/video-ip-newtek-ndi/16037>\
**Category:** Libraries\
**Created:** [December 2, 2019, 10:09am UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037 "2019-12-02T10:09:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/romain/32/8483_2.png) [@Romain](https://discourse.processing.org/u/Romain)\
**Post date:** [December 2, 2019, 10:09am UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/1 "2019-12-02T10:09:41Z")

</div>

Hi ! Is there any new solutions for ip video in Processing 3 ?  
I know the good library “ip capture” but only for receiving video, is there now the possibility to integrate the very good new tech NDI in processing for exemple ?  
A library for that ? If not, how can I make that ? I’m not a professional programmer…  
Thanks !

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [December 19, 2019, 7:15pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/2 "2019-12-19T19:15:18Z")

</div>

> [@Romain](#):
>
> I know the good library “ip capture” but only for receiving video

Are you saying that you want to broadcast IP video from a Processing sketch? From what – like a laptop webcam, or broadcasting your sketch canvas as a video stream? Can you explain more what you are trying to do, specifically?

---

<div class="post-metadata">

**Author:** ![Romain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/romain/32/8483_2.png) [@Romain](https://discourse.processing.org/u/Romain)\
**Post date:** [December 20, 2019, 1:05pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/3 "2019-12-20T13:05:41Z")

</div>

Hi , thank you for replying !  
For example :

1. On stage, I have a computer with connected webcams that use “Resolume” software for the image processing and send in live the video on the network via the very good NDI protocol !

2. In back stage (at 20meters), in an other computer, I would directly take this video on my Processing Sketch to make my effect and sending that on an other “Resolume” via Syphon protocol and launch that on my projector !

I tried to use NDI2Syphon \> Processing \> Syphon \> Resolume … too much syphons… my computer crashed…

I know there is a NDI library on OpenFrameWorks… but in Processing ? My sketch is too long for remaking that on C++…

And if it’s not possible to find this library or to make this (how?), I can replace “Resolume” on the first computer by a Processing sketch but how can I send the video on the network in order to take it on the processing in the second computer on backstage ?

Thx very much !

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [December 20, 2019, 4:41pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/4 "2019-12-20T16:41:30Z")

</div>

> [@Romain](#):
>
> I know there is a NDI library on OpenFrameWorks… but in Processing

Possibly related past discussions:

- [Share Sketch in Local Network - Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/22121/share-sketch-in-local-network)
- [Full screen Syphon / NDI Processing Q's - #2 by mattleaf - VIDVOX](https://discourse.vidvox.net/t/full-screen-syphon-ndi-processing-qs/665/2)

> [@Romain](#):
>
> … too much syphons…

I’m not sure what this means? Do you mean that you are running parallel syphons, or that you are pushing too many pixels and have bandwidth / RAM problems?

If you want Java bindings for the Newtek NDI SDK perhaps check out Devolay. A new release came out just a few days ago.

> **[GitHub - WalkerKnapp/devolay: A Java binding for the Newtek NDI(tm) SDK.](https://github.com/WalkerKnapp/devolay/tree/release)**
>
> release

---

<div class="post-metadata">

**Author:** ![f42ter](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/f42ter/32/16793_2.png) [@f42ter](https://discourse.processing.org/u/f42ter)\
**Post date:** [February 7, 2020, 7:56pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/5 "2020-02-07T19:56:10Z")

</div>

Try this:

> **[f41ardu/imagestreaming](https://github.com/f41ardu/imagestreaming)**
>
> imagestreaming. Contribute to f41ardu/imagestreaming development by creating an account on GitHub.

A sender sketch and a receiver sketch both in Processing.  
Based on Daniel Shiffmans Streaming Video on udp example.  
Works well if the camera can be used in Processing.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [February 8, 2020, 8:11pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/6 "2020-02-08T20:11:25Z")

</div>

> [@f42ter](#):
>
> A sender sketch and a receiver sketch both in Processing.  
> Based on Daniel Shiffmans Streaming Video on udp example.  
> Works well if the camera can be used in Processing.

Thanks for sharing this!

Maybe add this description to the repo description / the README.md?

---

<div class="post-metadata">

**Author:** ![Romain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/romain/32/8483_2.png) [@Romain](https://discourse.processing.org/u/Romain)\
**Post date:** [February 9, 2020, 3:13pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/7 "2020-02-09T15:13:21Z")

</div>

Oh thank you for this ! It seems very good ! I will try this soon !

---

<div class="post-metadata">

**Author:** ![Romain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/romain/32/8483_2.png) [@Romain](https://discourse.processing.org/u/Romain)\
**Post date:** [February 9, 2020, 3:17pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/8 "2020-02-09T15:17:37Z")

</div>

Thank you ! And sorry for my delay !  
I’m very interest by this Java library for NDI ! But how can I use this in Processing ? Sorry, I’m not a developer, just mathematician, using computer for science and now artistic project 😉 !  
Thank you again !

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [February 11, 2020, 2:50pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/9 "2020-02-11T14:50:42Z")

</div>

Drag a library jar or jars onto your sketch to copy it into the /code folder of that sketch.

Import objects from the library according to it’s documentation using the `import` keyword.

---

<div class="post-metadata">

**Author:** ![f42ter](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/f42ter/32/16793_2.png) [@f42ter](https://discourse.processing.org/u/f42ter)\
**Post date:** [February 13, 2020, 6:50pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/10 "2020-02-13T18:50:54Z")

</div>

Add a short readme, but I stopped any further development to encode h264 video stream on my own. In addition Jörg Haider stop development of the video library for Raspberry/Linux. And at least performance on a Raspberry 3+ is not sufficient.

Maybe I will continue later this year.

---

<div class="post-metadata">

**Author:** ![Romain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/romain/32/8483_2.png) [@Romain](https://discourse.processing.org/u/Romain)\
**Post date:** [March 21, 2020, 12:07pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/11 "2020-03-21T12:07:39Z")

</div>

Hi and thanks ! Now with Corona story, I have more time for working on my own artistic project ! I hope you’re ok ! Be careful everybody !

So I try this Devolay library on Processing… but impossible to use it… maybe because I don’t understand something : I just put these “.java” closer my “.pde”… it seem to recognize the java class (but without autocompletion :s) and when I try to make a Processing version of one of his java exemples, nothing is working…  
Processing focus on line 23 of “DevolaySender.java” class:

“No library found for com.walker.devolay  
No library found for com.walker.devolay  
No library found for com.walker.devolay  
No library found for com.walker.devolay  
processing.app.SketchException: ExceptionInInitializerError  
at processing.mode.java.JavaBuild.placeException(JavaBuild.java:634)  
at processing.mode.java.runner.Runner.findException(Runner.java:814)  
at processing.mode.java.runner.Runner.reportException(Runner.java:789)  
at processing.mode.java.runner.Runner.exceptionEvent(Runner.java:709)  
at processing.mode.java.runner.Runner$2.run(Runner.java:599)”

I need help…

---

<div class="post-metadata">

**Author:** ![Romain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/romain/32/8483_2.png) [@Romain](https://discourse.processing.org/u/Romain)\
**Post date:** [March 21, 2020, 12:13pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/12 "2020-03-21T12:13:27Z")

</div>

Why don’t you try to use NDI solution too ? It seem very powerful, no ? And compatible with a lot of softwares…  
I tried your “imagestreaming”, it works very well thanks !  
But if I can use NDI solution, it could be more simple in order to communicate between softwares like Resolume/VDMX and Processing … via the Network !

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 21, 2020, 2:25pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/13 "2020-03-21T14:25:47Z")

</div>

> [@Romain](#):
>
> Processing focus on line 23 of “DevolaySender.java” class:
> 
> “No library found for com.walker.devolay

I haven’t tried this, but are you trying to use Devolay in a Processing PDE project with a a main .PDE sketch, or are you trying to use it in a Java (Eclipse/Intellij/Netbeans) project with a main .java class?

If PDE, you can try adding the Devolay .jar from the GitHub releases into your sketch /code folder.

---

<div class="post-metadata">

**Author:** ![Romain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/romain/32/8483_2.png) [@Romain](https://discourse.processing.org/u/Romain)\
**Post date:** [March 21, 2020, 8:12pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/14 "2020-03-21T20:12:36Z")

</div>

I tried a lot of things with the code of your link, nothing works… And I don’t know enough Eclipse to try directly his examples…  
But I also find this : [GitHub - rfikes4/haxademic-ndi-sender](https://github.com/rfikes4/haxademic-ndi-sender)  
I put correctly its Devolay .jar in Processing permanente library and I tried. this code (mixing its java example and an processing example) :

```auto
import com.walker.devolay.*;

import com.haxademic.core.draw.image.ImageUtil;

import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.nio.ByteBuffer;
import processing.video.*;

PImage pimg;
Movie movie;
DevolaySender sender;
DevolayVideoFrame videoFrame;
BufferedImage tempBuffered;
ByteBuffer byteBuffer;
DataBuffer dataBuffer;

String senderName = "NDI Processing";

void setup() {
  size(640, 360);
  Devolay.loadLibraries();
  sender = new DevolaySender(senderName);
  background(0);
  // Load and play the video in a loop
  movie = new Movie(this, "transit.mov");
  movie.loop();

  videoFrame = new DevolayVideoFrame();
  videoFrame.setResolution(width, height);
  videoFrame.setFourCCType(DevolayFrameFourCCType.NDIlib_FourCC_type_BGRX);
  videoFrame.setFrameRate((int)frameRate, 1);
}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  pimg = movie.get();
  tempBuffered = ImageUtil.pImageToBuffered(pimg);
  byteBuffer = BufferedImageToByteBuffer(tempBuffered);

  videoFrame.setData(byteBuffer);
  sender.sendVideoFrame(videoFrame);

  image(pimg, 0, 0, width, height);
}

public ByteBuffer BufferedImageToByteBuffer(BufferedImage bi) {
  int[] pixels = new int[bi.getWidth() * bi.getHeight()];
  bi.getRGB(0, 0, bi.getWidth(), bi.getHeight(), pixels, 0, bi.getWidth());

  ByteBuffer buffer = ByteBuffer.allocateDirect(bi.getWidth() * bi.getHeight() * 4);

  for (int y = 0; y < bi.getHeight(); y++) {
    for (int x = 0; x < bi.getWidth(); x++) {
      int pixel = pixels[y * bi.getWidth() + x];
      buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red
      buffer.put((byte) ((pixel >> 8) & 0xFF)); // Green
      buffer.put((byte) (pixel & 0xFF)); // Blue
      buffer.put((byte) 0); // Alpha or terminating byte?
    }
  }

  buffer.flip();
  return buffer;
}

```

But at line : “Devolay.loadLibraries();”, there is the error :

> "UnsupportedClassVersionError … "  
> “This version of Processing only supports libraries and JAR files compiled for Java 1.8 or earlier.  
> A library used by this sketch was compiled for Java 1.9 or later,  
> and needs to be recompiled to be compatible with Java 1.8.  
> UnsupportedClassVersionError: com/walker/devolay/Devolay has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0”

… I’m lost 🙂

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 21, 2020, 10:06pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/15 "2020-03-21T22:06:06Z")

</div>

Not sure.

The error message says it needs \<= Java 8.

The releases page mentions Java 8 on release 1.1.0.: [https://github.com/WalkerKnapp/devolay/releases](https://github.com/WalkerKnapp/devolay/releases)

You could also open an issue there and ask what is the last version compatible with Java 8.

---

<div class="post-metadata">

**Author:** ![Romain](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/romain/32/8483_2.png) [@Romain](https://discourse.processing.org/u/Romain)\
**Post date:** [March 24, 2020, 2:27pm UTC](https://discourse.processing.org/t/video-ip-newtek-ndi/16037/16 "2020-03-24T14:27:07Z")

</div>

Ok, thanks for everything ! It seems to work now, but I will test it better in few time !  
So, for someone who want to do the same thing, I’m there :

- Devolay 1.2.0 ([https://github.com/WalkerKnapp/devolay/releases](https://github.com/WalkerKnapp/devolay/releases)): ok with processing (java 8)
- NDI runtime ([https://ndi.tv/sdk/](https://ndi.tv/sdk/)): ok but only for Mac OS X 10.15 (Catalina) … I had to upgrade my OS for that… it’s the first time on my artist life that upgraded OS X is favorable 😉
