← Back

ofxModulePictureExporter

github.com/reddoLabs/ofxModulePictureExporter · @reddoLabs
OF 0.11 Video/Camera Graphics Utilities

Module for ofxModule allows exporting single frames and movies using ofxTextureRecorder.

0 0 Last commit 3y ago Created 6y ago

README

ofxModulePictureExporter



Module for ofxModule allows exporting single frames and movies using ofxTextureRecorder.

Compatible with openFrameworks 0.11.0+

Generate all project files using the openFrameworks Project Generator.

Required Addons



ofxModule ofxTextureRecorder (fork by brinoausrino)

Getting started



Have a look at the sample project to get started directly and have a small explanation here.

Settings



The module can be configured in the settings.json. There you can define export presets. defaultStyle sets the default style that will be used. It needs to be defined in styles. capture defines the default movie capture settings.

 "PictureExporter": {
        "defaultStyle": "image",
        "styles": [
            {
                "id": "image",
                "outputType": "png"
            },
            {
                "height": 1080,
                "id": "movie",
                "nLoops": 5,
                "outputType": "mp4",
                "width": 1920
            },
            {
                "id": "print",
                "width": 1844,
                "height": 1240,
                "outputType": "png",
                "fit":"fill"
            }
        ],
        "capture":{
            "file":"capture.mov",
            "codec":"hap -format hap_alpha",
            "bitrate":"",
            "framerate":30,
            "extraSettings":""
        }
    }


Style properties

propertytypedescription
idstringthe style id
width,heightintimage dimensions
outputTypestringoutput type (png, jpg ..)
fitstringfillmode (fit,fill,stretch)
nLoopsintfor movie only : number of repetitions
loopModestringfor movie only : type of repetition (none,loop,palindrome)
Capture properties

propertytypedescription
filestringthe output file
codecstringthe export codec (see ffmpeg for codec options)
bitratestringcapture bitrate (leave empty for default)
framerateintthe desired capture framerate
extraSettingsstringextra ffmpeg settings


Export messages



Export image in default settings



You can export ofImage, ofTexture or ofFbo. Just put the image in the message.

// export ofFbo

shared_ptr<ofFbo> fbo = shared_ptr<ofFbo>(new ofFbo());
fbo->allocate(camImage->getWidth(), camImage->getHeight());
fbo->begin();
// draw something
fbo->end();

ofJson msg;
msg["filename"] = "export_ofImage.png";
notifyEvent(fbo,"exportImage", msg);


Export image a specific style settings




ofJson msg;
msg["filename"] = "export_ofImage.png";
msg["style"] = "defaultStyle";
notifyEvent(img,"exportImage", msg);


Capture a sequence



Start capture



ModuleEvent e = ModuleEvent("ExportControl", "ExportControl", "capture", ofJson({ {"option","start"} }));
e.texture = camImage;
e.destClass = "PictureExporter";
notifyEvent(e);


Stop capture



ModuleEvent e = ModuleEvent("ExportControl", "ExportControl", "capture", ofJson({ {"option","stop"} }));
e.destClass = "PictureExporter";
notifyEvent(e);


Add a frame



ModuleEvent e = ModuleEvent("ExportControl", "ExportControl", "capture", ofJson({ {"option","frame"} }));
e.destClass = "PictureExporter";
e.texture = camImage;
notifyEvent(e);


Overview of commands



propertytypedescription
filenamestringdesired output name, you can also use variables for date (see timecodes)
stylestringthe desired export style
pathsarray of stringsmultiple output paths if desired
All style and capture properties also work.

Timecodes



codedescription
[y]year, last 2 digits
[yy]year)
[m]month
[mm]month, leading 0
[d]day
[dd]day, leading 0
[h]hour
[hh]hour leading 0
[M]minutes
[MM]minutes, leading 0
[S]seconds
[SS]seconds, leading 0
[i]milliseconds

Get this addon

HTTPS
SSH