Capture frame rate maxed out at 20fps at 1080

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?

Capture cam;

void setup()
  String[] cameras = Capture.list();
  cam = new Capture(this, cameras[0]);
  textAlign(LEFT, TOP);

void draw()
  while (!cam.available())
  image(cam, 0, 0);

  text(int(frameRate), 0, 0);

Totally stupid oversight on my part but I forgot the existence of P2D. I get 50fps (cam.available) with P2D. It’s not the 60 I was hoping for but should definitely be usable up to 50% slow mo. If anyone knows how to squeeze out the last 10fps I would appreciate it but I assume there is some sort of overhead in there. I turned up the application frame rate to 200 to see if the loop time is a factor and it does not affect that. I also tried captureEvent() with no change either.

1 Like

i play low end hardware,
( here a old laptop with webcam OS: win7 Processing 3.5.3 )

selected a camera 352*288 fps 15
changed your code

  size(500, 500, P2D);

and see on your text FPS info



    //image(cam, 0, 0);
    set(0, 0, cam);

and see on your text FPS info


what for that system is a big step…
hope it helps you also.

1 Like