Skip to content

Instantly share code, notes, and snippets.

@arturoc
Created June 8, 2017 13:53
Show Gist options
  • Save arturoc/9fa84d875ad1f52bcb0bea328230cf95 to your computer and use it in GitHub Desktop.
Save arturoc/9fa84d875ad1f52bcb0bea328230cf95 to your computer and use it in GitHub Desktop.
listeners.push_back(m_bExportFrames.newListener([this](bool & record){
if(record){
auto path = ofSystemLoadDialog("Record to images:", true);
if(path.bSuccess){
auto folderPath = path.getPath();
ofxTextureRecorder::Settings settings(fbo.getTexture());
settings.imageFormat = OF_IMAGE_FORMAT_JPEG;
settings.folderPath = folderPath;
recorder.setup(settings);
}else{
m_bExportFrames = false;
}
}else{
recorder.stop();
}
}));
listeners.push_back(m_bRecordVideo.newListener([this](bool & record){
if(record){
auto path = ofSystemSaveDialog("video.mp4", "Record to video:");
if(path.bSuccess){
auto videoRecorderPath = path.getPath();
ofxTextureRecorder::VideoSettings recorderSettings(fbo.getTexture(), appfps);
recorderSettings.videoPath = videoRecorderPath;
auto ext = std::filesystem::path(videoRecorderPath).extension().string();
if(ext==".mov"){
recorderSettings.videoCodec = "prores";
recorderSettings.extrasettings = "-profile:v 0";
}else if(ext == ".hpv"){
recorderSettings.videoCodec = "cocgy";
}else{
recorderSettings.videoCodec = "libx264";
recorderSettings.extrasettings = "-preset ultrafast -crf 0";
}
recorder.setup(recorderSettings);
}else{
m_bRecordVideo = false;
}
}else{
recorder.stop();
}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment