How to speed up saveFrame

Hey guys - I am using saveFrame to create an image sequence to bring into after effects. At each loop, I'm upping the frameRate - which I'm sure is not the best way to go about thing. At the end of each loop, I'm saving the frame, but saveFrame can't keep up with the progressively higher frameRate I'm trying to save at. Anyone have an idea how to achieve the effect I'm going for without upping the frameRate, so that saveFrame can keep up? Here's my code:

``` int w = 640; // canvas size int h = 480; int n = 10; // number of grid cells int d = w/n; // diameter of a grid cell float depth = 0.5; // relative cell depth int fr = 100;

int iterator = 0;

boolean doSaveFrames = false;

void setup() { size(w, h, P3D); rectMode(CENTER); background(0); fill(51, 255, 0); noStroke(); frameRate(fr); }

void draw() {

// get coordinates int xy = frameCount % (n*n);

// shift image in z-direction if (xy == 0) { PImage img = get(); background(0); pushMatrix(); translate(0, 0, -d * depth); tint(255, 127); image(img, 0, 0); popMatrix();

// fr+=iterator*10; // frameRate(fr); //MH - really cool but I can't export fast enough iterator++;

}

// scale and rotate the square scale(d); translate(xy%n + .5, xy/n + .5, -depth * .5 ); rotate(QUARTER_PI - HALF_PI *int(random(2))); rotateX(HALF_PI);

// draw the square rect(0, 0, sqrt(2), depth);

if (doSaveFrames) { saveFrame("frames/line-######.tga"); }

} ```

Comments

  • This forum doesn't support GitHub style Markdown...
    See How to format code and text. Edit your message to make it more readable.

    Classical question about this kind of issue: why do you need to keep a high frame rate when you save a sequence of images for post-processing elsewhere?
    You don't follow real time input here, no?

    Otherwise, to have faster saveFrame, there aren't so many solutions:

    • Use an uncompressed format, but you already do it.
    • Save to a SSD / Flash drive.
    • Save to an in-memory drive.
  • Yes you can let the sketch take 6 minutes to produce and then let the movie be 40 seconds

  • Afaik eg

    Win movie maker can just set the speed

    Or use jpg2avi or ffmpeg

Sign In or Register to comment.