How to record each frame of an OfApp as a video

I’m looking to have my openframeworks app play and on exit record every frame as a video. But I’m having some issues.

I was using this:

img.grabScreen(0, 0, ofGetWidth(), ofGetHeight());

vidRecorder.addFrame(img.getPixelsRef());

I have it producing a video file, but it looks like one of those scrolling sidewalk adverts, the frames scroll upwards instead of proceeding like a normal video. Any idea why? Or is there a better approach?

If you don’t wan’t to the this live, the simplest way is to save each frame with ofSaveFrame() and then assemble everything together in another software (final cut pro, QuickTime Pro, or kdenlive [opensource alternative] for example).
This will save you some headache and allow for more flexibility in the video format.

This addon (ofxQTVideoSaver) worked for me some time ago. Might be worth a shot, saving every frame to disk might be too slow.

cabral1349, that works well but it lowers my framerate dramatically. So it’s not a good fit.

chuckleplant that would be ideal but it only works if you link it to the 10.6 SDK aparrently and only on OF 0.6 I think. So not a good fit either.

yeah, mine is only a solution if you can let the app on all night and don’t use live inputs

So I have fixed it, the above add on is perfect for the job.

You just need to make sure to set the video width to the window size after setup, and make sure the image you are saving as a frame is the same shape as your window!

1 Like