Capture high quality footage of a running sketch

Does anyone have a method for creating a video file from the frames of a running oF sketch?

I don’t mind running at less than real-time to capture frames.

ofVideoWriter would be awesome.

Hello,

maybe it is a good idea to use .kkapture? I’ve never tried to do it with oF sketches, but i think it is worth the try.

http://www.farb-rausch.de/~fg/kkapture

Is your sketch interactive? This is an offline tool, so there can be some problems with interactivity.

Greetings,
Resry

what platform are you on? if interactivity is not an issue you can just grab and save the frame as a sequence of images (this will not run in realtime):

  
  
	if(saveFrames) {  
		static char fileNameStr[255];  
		sprintf(fileNameStr, "output/output_%0.4i.png", currentFrame);  
		imgScreen.grabScreen(0, 0, ofGetWidth(), ofGetHeight());  
		printf("Saving file: %s\n", fileNameStr);  
		imgScreen.saveImage(fileNameStr);  
	}  
  

encoding png’s is quite slow, but is lossless and compresses quite well. If it’s too slow you can try saving to bmp, will be much faster.

I also quite often use this threaded image saver

  
  
#include "ofMain.h"  
#include "ofxThread.h"  
  
class ofxThreadedImageSaver : public ofxThread, public ofImage {  
public:  
	string fileName;  
	  
	void threadedFunction() {  
		if(lock()) {  
			saveImage(fileName);  
			unlock();  
		} else {  
			printf("ofxThreadedImageSaver - cannot save %s cos I'm locked", fileName.c_str());  
		}  
		stopThread();  
	}  
	  
	void saveThreaded(string fileName) {  
		this->fileName = fileName;  
		startThread(false, false);   // blocking, verbose  
	}  
};