P5JS: saveFrames, callback?

I have a sketch that I'd like to capture to video. I'm using linux and have tried a couple of screencapture programs to record my sketch in action, but the quality is quite poor. I see in the p5js reference there's a function call [saveFrames()](http://p5js.org/reference/#/p5/saveFrames).

I need to record at high resolution and high frame rate. I'll be saving thousands of frames. It's clear the dumping them to the browser one at a time and downloading them is not an option. The reference page for saveFrames() mentions an optional "callback" argument that seems to suggest a way to transmit the saved frames to a server in bulk. However, there is no further explanation of how to do that, nor am I able to find an example out in the wild. I'm a relatively sophistocated user with control over a number of linux servers. If someone could point me in the right direction, I'm sure I could figure out the rest. Thanks,

Albert

Answers

  • edited January 2016

    ... mentions an optional "callback" argument that seems to suggest a way to transmit the saved frames to a server in bulk.

    Callback is just a nick for a function which is called back when the task is finally completed.
    That completed "task" object is passed on as callback's parameter too.

    However, there is no further explanation of how to do that, ...

    Dealing w/ back-end server communication is advanced topic and beyond p5.js target audience. :o3

  • Any suggestions for doing a high quality capture of a p5js sketch in action?

  • Sorry got none. My JS skills, especially related to servers, are still very poor. X_X

  • See my post here...

    No idea how well p5js will handle doing this with thousands of frames however: your best bet is probably to be running everything on a local server so network bottlenecks are kept to a minimum. You'll also have to batch the frames passed to the callback to avoid hitting memory limits - no idea if that might also require explicitly pausing you sketch whilst the callback completes; or whether it will block anyway: as you have discovered, documentation of this feature is somewhat limited :/

Sign In or Register to comment.