← Back

ofxLooper

github.com/kasparsj/ofxLooper · @kasparsj
OF 0.11 Video/Camera Animation

Frame buffer that records and plays video at the same time, swapping recording and play buffers when full.

0 0 Last commit 4y ago Created 4y ago

README

ofxLooper



ofxLooper is a frames buffer that can play and record at the same time. Once the recording buffer is filled, it is swapped with the play buffer.

Usage



See example.

void ofApp::setup(){
    int fps = 60;
    ofSetFrameRate(fps);

    int maxDuration = 2; // seconds
    float speed = 2.0; // 2x play speed
    looper.setup(maxDuration, fps/speed, speed);
}


//--------------------------------------------------------------
void ofApp::update(){
    // will swap every 2 seconds
    looper.swapBuffers();
    ofPixels& pixels = getPixels();
    looper.addFrame(pixels);
    looper.update();
}

//--------------------------------------------------------------
void ofApp::draw() {
    ofBackground(0);
    ofSetColor(255);
    
    looper.draw(0, 0);
}

ofPixels& ofApp::getPixels() {
  // todo: implement get & return your pixels from Webcam or video, or etc. e.g.:
  // vidGrabber.update();
  // vidGrabber.getPixels();
}


FramesBuffer



This addon is based on FramesBuffer from: https://forum.openframeworks.cc/t/live-sampling-video-grabber/35655

Get this addon

HTTPS
SSH