VIDEO IP (NewTek NDI)

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: