Processing with pi4

I am trying to use raspberrypi 4 model with processing
I am using the GLvideo library to capture live footage using a v2 camera module of raspberry pi.
While trying to run the sample code I am not being able to get the video I am always getting a black blank window
please help
my code is:

import gohai.glvideo.*;
GLCapture video;

void setup() {
  size(320, 240, P2D);

  String[] devices = GLCapture.list();
  println("Devices:");
  printArray(devices);
  if (0 < devices.length) {
    String[] configs = GLCapture.configs(devices[0]);
    println("Configs:");
    printArray(configs);
  }

  // this will use the first recognized camera by default
  video = new GLCapture(this);

  // you could be more specific also, e.g.
  //video = new GLCapture(this, devices[0]);
  //video = new GLCapture(this, devices[0], 640, 480, 25);
  //video = new GLCapture(this, devices[0], configs[0]);

  video.start();
}

void draw() {
  background(0);
  if (video.available()) {
    video.read();
  }
  image(video, 0, 0, width, height);
}

please format your code with pasting into
</> Preformatted text button from editor menu

problems with aspberry pi 4 and camera v2 model

import gohai.glvideo.*;
GLCapture video;

void setup() {
size(320, 240, P2D);

String[] devices = GLCapture.list();
println(“Devices:”);
printArray(devices);
if (0 < devices.length) {
String[] configs = GLCapture.configs(devices[0]);
println(“Configs:”);
printArray(configs);
}

// this will use the first recognized camera by default
video = new GLCapture(this);

// you could be more specific also, e.g.
//video = new GLCapture(this, devices[0]);
//video = new GLCapture(this, devices[0], 640, 480, 25);
//video = new GLCapture(this, devices[0], configs[0]);

video.start();
}

void draw() {
background(0);
if (video.available()) {
video.read();
}
image(video, 0, 0, width, height);
}

-a- you should have repaired your top post
-b- and you should have pasted good formated code into the
</>
NOT
"
button

so try again edit the first one and delete the last one


i try here the
SimpleCapture example from the library and it works.

BUT
-a- i use
Raspbian GNU/Linux 10
DEBIAN buster
Linux version 4.19.75-v7+
Raspberry Pi 3 Model B Plus Rev 1.3

-b- Processing 3.5.3

-c- raspberry pi camera rev 1.3 only
and enabled the camera in sudo raspi-config

?when you start the sketch, you get a device list?

-d- GL Video 1.3 Gottfried Haider Hardware accelerated video on the Raspberry Pi & Linux
but with a own compiled add on so not only camera
now also video works.

1 Like