Video frame buffer question

#1

Hello,

I’m in the process of building a small app but have hit a wall. It involves slowing video down quite a lot which creates jumps between frames. What I’d like to do is blend the frames together somehow to create a smoother transition between two frames. A process similar to frame blending in after effects.

First of all is this possible, Secondly, where do I start?

Many thanks, Chris.

#2

hey Chris,

One way to do this is to use a framebuffer, and every frame paint a percent of the current frame into the buffer, this way the current frame is always in the process of “fading in” and the image is continually changing. Depending on what percent you paint, you can make really nice soft looking images or more salient ones.

This is one of my favorite effects, and always a nice way to deal with low framerate video =)

here’s some example code:

  
  
//in testApp.h  
ofVideoGrabber vid;  
ofFbo vidAccum;  
  
void testApp::setup() {  
	ofSetFrameRate(30);  
	ofSetVerticalSync(true);  
  
        //vid is a low framerate video input, or could be a movie in your case  
	vid.initGrabber(VID_WIDTH, VID_HEIGHT);  
	vidAccum.setup(VID_WIDTH, VID_HEIGHT, GL_RGB);  
}  
  
void testApp::update() {  
	  
	vid.update();  
  
	//every frame draw a portion of the current video frame into the accumulation buffer  
	vidAccum.begin();  
	//ofClear(1.0, 0, 0, 1.0); //normally we would clear, but we want our pixels to accumulate  
	glClear(GL_DEPTH_BUFFER_BIT);  
	  
	ofEnableAlphaBlending();  
	ofSetColor(255, 255, 255, 10); //you can change the alpha value to modulate the effect  
	vid.draw(0,0);  
	vidAccum.end();  
}  
  
void testApp::draw(){  
	ofBackground(0);  
	vidAccum.draw();  
}  
  

Hope this works for you!