Recording video from ofImage/ ofFbo/ ofPixels in OF 008


I’d like to generate a Quicktime movie by setting the pixels from an image or fbo. I’ve looked at the video recorder example included with OF - it appears limited to getting video directly from a camera. Instead, I’d like the ability to set each frames pixels directly (without using a camera at all). Note that searching the forums uncovers many great discussions with outdated examples and libraries (see below) that no longer work in OF008

Use Cases

  • App that generates 3d graphics, having the ability to record the graphics to a movie file.
  • Using the Kinect to record users moving around a table, having the ability to record the color image feed to a movie file.
  • any app where you want to make a movie from pixel data instead of camera video.

Possible Approaches

  1. When user starts recording, begin saving images to folder with incrementing filename. Then, when user stops recording, collect the images, generate a movie file, and delete the images.
  2. Similar approach as above, but save the “images” into memory buffer.
  3. Write directly to ofQTKitGrabber from pixels? Not sure this is even possible :smile:

Similar topics / libraries

Goto post for movie recording has become long thread and may examples are outdated and broken in OF008.

Talks about a similar challenge but is from 2007.

Well documented library, but only works with image sequences- If using image sequences I’d like to ultimately generate a movie and then discard the images.

So I just found an addon that looks promising:

It works well with OF008. It can be configured to record your entire app window (default behavior), a rectangular section of the window using setRecordingArea(int x, int y, int w, int h), or directly from pixels using setPixelSource(unsigned char* pixels, int w, int h). It records to a .mp4 which is fine.

While this will work for my project, it’s missing some key features to make it useful in other applications - specifically audio. See the TODO for more.

Can anyone suggest alternate addons with more developed functionality?

Check out my addon ofxVideoRecorder. It can record audio and video, and uses ffmpeg as the encoder so you can do pretty much anything that ffmpeg can do, including streaming of the output to a network location. I recently tested it with 0.8.0

1 Like

Thanks @TimS for sharing! I’m trying to run this on a mac and when I press “c” the example app freezes - I need to force quit the app and xcode. Any thoughts? Also doesn’t create any file in this instance using the example app provided.

you’ll need to make sure that you have an ffmpeg binary installed, and also that you are using av codecs that your version of ffmpeg supports for encoding. this can vary from build to build so you may need to change from what the example is using.