diff options
authordec05eba <dec05eba@protonmail.com>2021-07-29 06:45:55 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-29 06:45:55 +0200
commit04d229caf3a8529ad2762791e8443e119dfb58a7 (patch)
parent1f71584a77494a41338a96f2d8e65df9a7a280b0 (diff)
Use direct capture when possible
3 files changed, 8 insertions, 6 deletions
diff --git a/TODO b/TODO
index c2af783..f4dc9bd 100644
--- a/TODO
+++ b/TODO
@@ -4,4 +4,5 @@ Use nvEncoder api directly? maybe with this we could copy the window opengl text
Right now we are required to copy the opengl texture to another opengl texture first.
Load cuda at runtime with dlopen.
Track window damages and only update then. That is better for output file size.
-Remove cuda to cuda copy when using nvFBC if possible. ffmpeg is getting in the way. \ No newline at end of file
+Remove cuda to cuda copy when using nvFBC if possible. ffmpeg is getting in the way.
+Use av_fifo. \ No newline at end of file
diff --git a/include/NvFBCLibrary.hpp b/include/NvFBCLibrary.hpp
index a0bf045..3c5310a 100644
--- a/include/NvFBCLibrary.hpp
+++ b/include/NvFBCLibrary.hpp
@@ -122,7 +122,7 @@ public:
memset(&create_capture_params, 0, sizeof(create_capture_params));
create_capture_params.dwVersion = NVFBC_CREATE_CAPTURE_SESSION_PARAMS_VER;
create_capture_params.eCaptureType = NVFBC_CAPTURE_SHARED_CUDA;
- create_capture_params.bWithCursor = NVFBC_TRUE; // This will need to be disabled when using bAllowDirectCapture
+ create_capture_params.bWithCursor = NVFBC_FALSE;
if(capture_region) {
create_capture_params.captureBox = { x, y, width, height };
*display_width = width;
@@ -130,10 +130,11 @@ public:
create_capture_params.eTrackingType = tracking_type;
//create_capture_params.dwSamplingRateMs = 1000 / fps;
+ create_capture_params.bAllowDirectCapture = NVFBC_TRUE;
+ create_capture_params.bPushModel = NVFBC_TRUE;
if(tracking_type == NVFBC_TRACKING_OUTPUT)
create_capture_params.dwOutputId = output_id;
- // TODO: Use create_capture_params.bAllowDirectCapture and create_capture_params.bPushModel
status = nv_fbc_function_list.nvFBCCreateCaptureSession(nv_fbc_handle, &create_capture_params);
if(status != NVFBC_SUCCESS) {
fprintf(stderr, "Error: %s\n", nv_fbc_function_list.nvFBCGetLastErrorStr(nv_fbc_handle));
diff --git a/src/main.cpp b/src/main.cpp
index 9a5c631..5134f0e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -611,7 +611,7 @@ static void usage() {
fprintf(stderr, " -w Window to record or a display or \"screen\". The display is the display name in xrandr and if \"screen\" is selected then all displays are recorded and they are recorded in h265 (aka hevc). Recording a display requires a gpu with NvFBC support.\n");
//fprintf(stderr, " -s The screen region to capture in format WxH+X+Y. This is only applicable when -w is a display or \"screen\". Optional, the entire window/display/screen is recorded by default.\n");
fprintf(stderr, " -c Container format for output file, for example mp4, or flv.\n");
- fprintf(stderr, " -f Framerate to record at. Clamped to [1,500].\n");
+ fprintf(stderr, " -f Framerate to record at. Clamped to [1,250].\n");
fprintf(stderr, " -a Audio device to record from (pulse audio device). Optional, disabled by default.\n");
fprintf(stderr, " -q Video quality. Should either be 'medium', 'high' or 'ultra'. Optional, set to 'medium' be default.\n");
fprintf(stderr, " -r Replay buffer size in seconds. If this is set, then only the last seconds as set by this option will be stored"
@@ -705,8 +705,8 @@ int main(int argc, char **argv) {
fprintf(stderr, "Invalid fps argument: %s\n", args["-f"].value);
return 1;
- if(fps > 500)
- fps = 500;
+ if(fps > 250)
+ fps = 250;
const char *quality_str = args["-q"].value;