I am trying to capture 60fps video from a CamLink capture device (connected to a gopro) but processing is maxing out at 20fps capture rate. The sketch will run at whatever speed I want but the cam.available() flag is only being set at about 20fps. The capture device is reporting as 60fps.
[0] "name=Cam Link 4K,size=1920x1080,fps=60"
Here is the code I am testing with. I have tried other versions to make sure it has nothing to do with the while+delay such as using a millis timer with the sketch running at 120fps to count between frames instead of halting the loop. That gets me anywhere between 40-60ms between frames which averages to 20fps. I have tried increasing the available memory to 4096 MB. I also get identical results with an exported app.
I have also tried a logitec webcam and I can get 30fps at resolutions up to 800x600. Any higher and it does that thing where the light on the camera blinks and then it goes off. (This seems to be a common capture/processing issue with webcams)
The goal of this project is to be able to do slow mo replay of video so the 60fps is a must.
Any ideas?
import processing.video.*;
Capture cam;
void setup()
{
fullScreen(1);
frameRate(120);
String[] cameras = Capture.list();
cam = new Capture(this, cameras[0]);
cam.start();
textAlign(LEFT, TOP);
textSize(20);
fill(255);
}
void draw()
{
while (!cam.available())
delay(1);
background(40);
cam.read();
image(cam, 0, 0);
text(int(frameRate), 0, 0);
}