Best way to record openframeworks to video?

What would be best way to record the openframeworks to a video file? I’m working on OS X.

Thanks!

You can try using this addon: https://github.com/timscaffidi/ofxVideoRecorder

From what I remember it gave me a bit of trouble and I ended up using the built in quicktime application to do a screen recording instead. File > New Screen Recording

I’ve also used an application called screenflow to do screen captures of apps.

i did these steps to make ofxVideoRecorder work for me on OS X

install homebrew via http://brew.sh
then install ffmpeg via terminal command: brew install ffmpeg
then run the addon examples

I am fond of an online recording application named ShowMore (http://showmore.com). Since it is a web-based screen recording tool so I think it can work on both Windows and Mac. I use it to capture videos and edit them in real time. Pretty good one.

For OSX:

I quite like Syphon Recorder, since I often need to be able to send visuals from OF to another application anyway. Syphon can be a bit of a pain to set up in OF, but once you’ve got it its great.

this helped me to set up ofxSyphon smoothly:
http://nickhardeman.com/694/how-to-add-ofxsyphon-to-openframeworks/
(when adding ofxSyphon to a project I needed to select “create groups” in the add files menu)

syphon recorder: http://syphon.v002.info/recorder/

Hi and thanks for your replies!

I installed the ofxVideoRecorder and got it working but apparently it is only for recording from the webcam? Or is there a way to record what is going on on the screen with ofxVideoRecorder? I disabled the vidgrabber.draw() in the code but it didn’t help.

I tried Quicktime screen recording but ended up having a laggy video. Any suggestions on this? I’d need at least 1080p video that would run smoothly. I’ll try the other suggestions in this post.

Thanks! :slightly_smiling:

you should be able to pass any image in to the recorder like so
bool success = vidRecorder.addFrame(img.getPixels());

here some messy code to serve as an example:

My 2 cents. Using GPU capabilities to encode video probably is the best way. Nvidia has NVENC SDK and AMD has the Media SDK. Both of which are capable of H.264 encoding.

From my experience using GPU will offer best performance. It is quite challenging though and very hardware and OS specific. Worth the effort if you need the performance boost.

[…]

The ofxVideoRecorder addon is probably the best all-purpose recorder for oF. FFmpeg (used in ofxVideoRecorder) bundles hardware acceleration and it should be possible to enable it using the addon with a few changes. You would need to build FFmpeg with those filters enabled and change the video codec used in the addon to the one that fits your needs.

I came here to mention ofXSyphon also.

I havent had any issues setting it up using the Project Generator. This includes adding it from beginning, or updating an existing project.

One tip, when using syphon recorder, is to double check your settings each time to launch it because they seem to get reset (especially video dimensions).

mike chambers

I find Screenflick to be a very fast screen recorder (much faster than Quicktime on OSX).

was trying out the ofxVideoRecorder. seems that it does not support HD video recording? my sketch is 1920 by 1080. when I run the sketch, it got warning like

[warning] ofAvFoundationGrabber: requested width and height aren’t supported. Setting capture size to closest match: 1280 by 720

any ideas? Thanks!

ofAvFoundationGrabber??? Are you capturing a webcam or similar?

no just capturing an animation i made.

Ok, I think ofxVideoRecorder is based on ffmpeg so i dont understand why you get an ofAvFoundationGrabber error, thats why im asking

it is weird too. I installed the ffmpeg. Should I specify somewhere that I’m not using the cam as input?

thanks

Where are you using a video grabber? You set pixels as input

in the draw function. I’m trying to insert some black frames in a sequence of images

void ofApp::draw(){
stringstream ss;
ss << “video queue size: " << vidRecorder.getVideoQueueSize() << endl
<< “audio queue size: " << vidRecorder.getAudioQueueSize() << endl
<< “FPS: " << ofGetFrameRate() << endl
<< (bRecording?“pause”:“start”) << " recording: r” << endl
<< (bRecording?“close current video file: c”:””) << endl;

    //get the frame based on the current time and draw it
    sequence.getTextureForTime(ofGetElapsedTimef()).draw(0,0);
    uint64_t curTime = ofGetElapsedTimeMillis();
    if(curTime - preTime >= blackdelay ){
        preTime =curTime;
        ofBackground(0);
    } 

}

void ofApp::keyReleased(int key){

if(key=='r'){
    bRecording = !bRecording;
    if(bRecording && !vidRecorder.isInitialized()) {
        vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, vidGrabber.getWidth(), vidGrabber.getHeight(), 10, sampleRate, channels);
        //          vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, vidGrabber.getWidth(), vidGrabber.getHeight(), 30); // no audio
        //            vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, 0,0,0, sampleRate, channels); // no video
        //          vidRecorder.setupCustomOutput(vidGrabber.getWidth(), vidGrabber.getHeight(), 30, sampleRate, channels, "-vcodec mpeg4 -b 1600k -acodec mp2 -ab 128k -f mpegts udp://localhost:1234"); // for custom ffmpeg output string (streaming, etc)
        
        // Start recording
        vidRecorder.start();
    }
    else if(!bRecording && vidRecorder.isInitialized()) {
        vidRecorder.setPaused(true);
    }
    else if(bRecording && vidRecorder.isInitialized()) {
        vidRecorder.setPaused(false);
    }
}
if(key=='c'){
    bRecording = false;
    vidRecorder.close();
}

}

But you are using a vidGrabber so in any place of your code you are initializing a videoGrabber. The error you posted come from the videoGrabber not from ofxVideoRecorder, if you are not capturing a webcam or similar remove the video grabber lines from your code (all)

Thank you Pandereto. I will give it another try. The code that I have is 99% same from the ofxVideoRecorder Example. I’m wondering why they put the inaccurate one in it.

The code in the example records a videograbber, its not inaccurate. You do not want to do that as you want to record your animation so you have to delete all the lines related to videoGrabber. Probably you have a laptop or a usb webcam connected that does not output 1920x1080 so thats where the error you posted come from.