Loading...
Logo
Processing Forum
Hello,

I'd like to render frames of video at a fairly high resolution, regardless of how long they take to render, and without skipping any frames.

I can't figure out from reading the docs whether save-frame does this. I.e, does it 1) save "all" frames, regardless of how long they take to compute, or 2) saves frames on the fly as it is able (therefore resulting in smoother sketch performance, but some dropped frames)? It is seeming like the answer is the latter, but because I don't know, I can't tell exactly where my problems are.

If someone could let me know whether save-frame can work in non-real-time, and if not, if there is some way to do what I describe above, that would be greatly appreciated! (Googling high-definition rendering and non-realtime-rendering +processing.org didn't answer this question.)

Many thanks, Michael


Replies(6)

No, if a frame takes longer to render (even without saveFrame), the frame rate drops, ie. Processing won't skip frames to respect a given frame rate.
Very useful to know--thanks very much for the reply!
some reasons why you may be losing frames could be:
  • your sketch (or library being used) is dependent on time to clock the animation
    • examples include: animation tweening, timers, millis(), seconds()
  • your sketch or library is using threads.
This is difficult to troubleshoot without seeing code. I use "movie maker" instead of save frame to save processing sketches into a move file.  

This is what I use to render video from a processing sketch: 
Copy code
  1. /*
  2. render processing to video
  3. */
  4. import processing.video.*;
  5. MovieMaker mm;  // Declare MovieMaker object

  6. void setup(){
  7.   // set canvas size
  8.   size(1280,720);

  9.   // 720p resolution 
  10.   mm = new MovieMaker(this, 1280, 720, "deformation.mov",25, MovieMaker.MOTION_JPEG_B, MovieMaker.BEST);
  11. }

  12. void draw() {
  13.   // put your visuals here

  14.   // 25fps * seconds wanted = frames you have to render
  15.    mm.addFrame();  // Add window's pixels to movie

  16.    if (frameCount >= 250) // 250 is 5 seconds at 25fps
  17.    {
  18.    mm.finish();  // close the movie file 
  19.    exit();       // exit processing app
  20.    }
  21. }

The real-time version took several seconds to render each frame. Movement at 60FPS was really slow when moving 1pixel at a time.  You may want too increase or decrease any movement variables to take the target FPS into consideration.

My guess is that you are using time or a 3rd party library which uses time or threads.

thanks, man--I really appreciate your response, and the code is super useful. Also, amazing meta-ball tunnel!!!
You have made my day. It comes out very high quality. Thanks.
This Is Very Useful, I wonder if its possible to render it out non realtime with a Transparent Background?
So that It can be used in compositing in a post production software.