Hey I am trying to use ofxFastFboReader and with ofxFFmpegRecorder OF/0.11 under Windows10.
It works, but the recorded video file goes to full-screen-grey if I enabled antialias on the FBO settings…
If I do not enables the antialias samples the lines don’t look fine. I tried to use GL_RGB32F but is not working either.
(I would like to use an OF internal method bc I tried some external apps like OBS and Bandicam and it’s losing some frames and does not go fluently…)
Any idea?
This is the code I am using:
ofApp.h
#include "ofxFFmpegRecorder.h"
#include "ofxFastFboReader.h"
ofxFFmpegRecorder cap_Recorder;
ofFbo cap_Fbo;
ofPixels cap_Pix;
ofxFastFboReader cap_Reader;
ofFbo::Settings cap_Fbo_Settings;
ofApp::setup()
//ofFbo settings
float w, h;
w = ofGetWidth();
h = ofGetHeight();
cap_Fbo_Settings.width = w;
cap_Fbo_Settings.height = h;
cap_Fbo_Settings.internalformat = GL_RGB;
//cap_Fbo_Settings.internalformat = GL_RGBA;
//cap_Fbo_Settings.internalformat = GL_RGB32F;
cap_Fbo_Settings.useDepth = true;//3d depth
cap_Fbo_Settings.useStencil = true;//?
//cap_Fbo_Settings.depthStencilAsTexture = true;//?
//The problem: Can't antialias -->
//->this breakes the recording...grey screen
//cap_Fbo_Settings.numSamples = 16;// !
cap_Fbo.allocate(cap_Fbo_Settings);
//--
//hq
cap_Recorder.setBitRate(80000);
cap_Recorder.setup(true, false, glm::vec2(w, h), 60);
//options
cap_Recorder.setOverWrite(true);
cap_Recorder.setFFmpegPathToAddonsPath();
//cap_Recorder.addAdditionalOutputArgument("-f rawvideo");
//cap_Recorder.setVideoCodec("libx264");
//cap_Reader.setAsync(true);
ofApp::draw()
cap_Fbo.begin();
{
//ofSetColor(255);
//ofEnableDepthTest();
drawMyScene();
}
cap_Fbo.end();
//-
if (cap_Recorder.isRecording())
{
//A. faster
//ofxFastFboReader can be used to speed this up:
cap_Reader.readToPixels(cap_Fbo, cap_Pix, OF_IMAGE_COLOR);
if (cap_Pix.getWidth() > 0 && cap_Pix.getHeight() > 0) {
cap_Recorder.addFrame(cap_Pix);
}
////B. standard
//cap_Fbo.readToPixels(cap_Pix);
//if (cap_Pix.getWidth() > 0 && cap_Pix.getHeight() > 0) {
// cap_Recorder.addFrame(cap_Pix);
//}
}
//-
cap_Fbo.draw(0, 0);//drawing is required outside fbo
}
This is the log with samples enabled after recording a grey video:
ffmpeg version N-84679-gd65b595 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 51.100 / 55. 51.100
libavcodec 57. 86.103 / 57. 86.103
libavformat 57. 67.100 / 57. 67.100
libavdevice 57. 3.101 / 57. 3.101
libavfilter 6. 78.100 / 6. 78.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, rawvideo, from 'pipe:':
Duration: N/A, start: 0.000000, bitrate: 2922393 kb/s
Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1057, 2922393 kb/s, 60 tbr, 60 tbn, 60 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Output #0, avi, to 'F:\openFrameworks\addons\ofxSphereCam2\ofxSphereCam2-example\bin\data\captures/2020-08-12-15-38-45-781.avi':
Metadata:
ISFT : Lavf57.67.100
Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1057, q=2-31, 2000 kb/s, 60 fps, 60 tbn, 60 tbc
Metadata:
encoder : Lavc57.86.103 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 0 vbv_delay: -1
frame= 491 fps= 60 q=2.0 Lsize= 1360kB time=00:00:08.18 bitrate=1361.6kbits/s speed= 1x
video:1343kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.303381%