I am learning to use the “processing.video” library. At first I managed to communicate with Webcam and export the application. In addition I had to create a “Windows64” folder inside the “LIB” folder and put the GStreamer files inside. The application code working is below:
import processing.video.*;
Capture cam;
void setup() {
size(640, 480);
String[] cameras = Capture.list();
if (cameras.length == 0) {
println("Não há câmeras disponíveis para captura.");
exit();
}
else {
println("Câmeras disponíveis:");
for (int i = 0; i < cameras.length; i++) {
println(cameras[i]);
}
cam = new Capture(this, 600, 400);
cam.start();
}
}
void draw() {
if (cam.available() == true) {
cam.read();
}
image(cam, 0, 0);
}
In a second moment I am learning to use the “com.hamoid” library. In Sketch my code guide perfectly, I can watch the webcam and record videos with FFMPEG. But when exporting the application and creating the “Windows64” folder, I’m unable to view the webcam. It is just a gray screen. I am using Windows 10 and Processing 4.3. The code is below:
import processing.video.*;
import com.hamoid.*;
VideoExport videoExport;
Capture cam;
boolean gravando = false;
void setup() {
size(640, 480);
frameRate(30);
String[] cameras = Capture.list();
cam = new Capture(this, cameras[0]);
videoExport = new VideoExport(this, "Interativo.mp4");
cam.start();
videoExport.startMovie();
println("Pressione r para alternar a gravação");
}
void draw() {
if (cam.available() == true) {
cam.read();
}
image(cam, 0, 0);
if(gravando) {
videoExport.saveFrame();
}
}
void keyPressed() {
if(key == 'r' || key == 'R') {
gravando =! gravando;
println("Gravação está: " + (gravando ? "LIGADA" : "DESLIGADA"));
}
if (key == 'q') {
videoExport.endMovie();
exit();
}
}
Any suggestions where the problem may be?