Giter Site home page Giter Site logo

Comments (9)

timscaffidi avatar timscaffidi commented on July 28, 2024

it is hard for me to say exactly without seeing your code, but It looks like you are sending either too much or too little information for each frame. For example you might be sending a 640x480 frame of pixels but the recorder is expecting 1024x768, or vise-versa.

from ofxvideorecorder.

benjgorman avatar benjgorman commented on July 28, 2024

I had this at the end of my setup method.

if(!vidRecorder.isInitialized())
{
vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, ofGetWidth(), ofGetHeight(), 30); // no audio

}

Now I had the window mode set to fullscreen intitially and that gave me scanlines on the output, so I made it not full screen and I got the frames I already mentioned and then I set it to 640, 480 and I got more scanlines.

I was using this code in my update loop

ofImage img;
img.grabScreen(0, 0, ofGetWidth(), ofGetHeight());


vidRecorder.addFrame(img.getPixelsRef());

from ofxvideorecorder.

timscaffidi avatar timscaffidi commented on July 28, 2024

I would advise against using ofGetWidth/Height with the video recorder as these values can change if you resize the window, and also I don't know that they will have the correct values if called within the setup function, as the window may not have been given its final size yet. Try hardcoding the width and height in both the setup method and within your update method, this should solve your problem.

I usually draw my entire scene to a FBO which has a fixed size (1920x1080 for example), then I can easily get the pixels from the FBO and save to the recorder. This has the added benefit of allowing me to draw the FBO to the screen at any size: should I need to support different resolution displays, just draw the FBO to fit within the window.

from ofxvideorecorder.

benjgorman avatar benjgorman commented on July 28, 2024

Aw man that worked perfectly! Great addon.

How would you do the FBO object?

from ofxvideorecorder.

timscaffidi avatar timscaffidi commented on July 28, 2024

OF comes with an FBO example in the examples/gl/fboTrailsExample folder. If you need additional help with FBOs, make a topic in the OF forums and I'll be glad to look at it there.

from ofxvideorecorder.

samelie avatar samelie commented on July 28, 2024

Hi Tim, the addon works great with the videoGrabber, I have been struggling to get it recording from an FBO. This is what I get: gif

I'm modding the example trails you mentioned.
I allocate by ofPixels like so fboPix.allocate(640,480,OF_PIXELS_RGBA)
Then I do:
rgbaFbo.readToPixels(fboPix); vidRecorder.addFrame(fboPix);

I've made sure the videoRecorder.setup width/height matches. Could the pixel data
Would you be so kind as to updating the example with a working FBO version? I'm all out of ideas.

from ofxvideorecorder.

kritzikratzi avatar kritzikratzi commented on July 28, 2024

@samelie you should probably create a new bug. this seems non related.
anyways, try rgb, instead of rgba!

from ofxvideorecorder.

timscaffidi avatar timscaffidi commented on July 28, 2024

@samelie , I believe @kritzikratzi is correct. Using RGBA for the FBO will not work because the video grabber is expecting RGB. The resulting gif you posted looks so strange because because you are sending 4 byte per pixel, and the video grabber is expecting 3.

from ofxvideorecorder.

samelie avatar samelie commented on July 28, 2024

fboPixels.allocate(fboWidth, fboHeight, OF_PIXELS_RGBA);
recorderPixels.allocate(fboWidth, fboHeight, OF_PIXELS_RGB);
fbo.readToPixels(fboPixels);
for (int i = 0; i < fboWidth * fboHeight; i++) {
int pix = i * 4;
int pixRgb = i * 3;
int r = fboPixels[pix];
int g = fboPixels[pix + 1];
int b = fboPixels[pix + 2];
recorderPixels[pixRgb] = r;
recorderPixels[pixRgb + 1] = g;
recorderPixels[pixRgb + 2] = b;
}
bool success = vidRecorder.addFrame(recorderPixels);

Ahha, nice one, my shader outputs RGBA! Thanks guys, works great!

from ofxvideorecorder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.