VIDEO IP (NewTek NDI)

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 !

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?

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 !

Possibly related past discussions:

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.

1 Like

Try this:

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.

1 Like

Thanks for sharing this!

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

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

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 :wink: !
Thank you again !

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.

1 Like

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.

1 Like

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…

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 !

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.

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
I put correctly its Devolay .jar in Processing permanente library and I tried. this code (mixing its java example and an processing example) :

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 :slight_smile:

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

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

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 :

1 Like