Use direct capture when possible
This commit is contained in:
parent
1f71584a77
commit
04d229caf3
1
TODO
1
TODO
@ -5,3 +5,4 @@ Use nvEncoder api directly? maybe with this we could copy the window opengl text
|
|||||||
Load cuda at runtime with dlopen.
|
Load cuda at runtime with dlopen.
|
||||||
Track window damages and only update then. That is better for output file size.
|
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.
|
Remove cuda to cuda copy when using nvFBC if possible. ffmpeg is getting in the way.
|
||||||
|
Use av_fifo.
|
@ -122,7 +122,7 @@ public:
|
|||||||
memset(&create_capture_params, 0, sizeof(create_capture_params));
|
memset(&create_capture_params, 0, sizeof(create_capture_params));
|
||||||
create_capture_params.dwVersion = NVFBC_CREATE_CAPTURE_SESSION_PARAMS_VER;
|
create_capture_params.dwVersion = NVFBC_CREATE_CAPTURE_SESSION_PARAMS_VER;
|
||||||
create_capture_params.eCaptureType = NVFBC_CAPTURE_SHARED_CUDA;
|
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) {
|
if(capture_region) {
|
||||||
create_capture_params.captureBox = { x, y, width, height };
|
create_capture_params.captureBox = { x, y, width, height };
|
||||||
*display_width = width;
|
*display_width = width;
|
||||||
@ -130,10 +130,11 @@ public:
|
|||||||
}
|
}
|
||||||
create_capture_params.eTrackingType = tracking_type;
|
create_capture_params.eTrackingType = tracking_type;
|
||||||
//create_capture_params.dwSamplingRateMs = 1000 / fps;
|
//create_capture_params.dwSamplingRateMs = 1000 / fps;
|
||||||
|
create_capture_params.bAllowDirectCapture = NVFBC_TRUE;
|
||||||
|
create_capture_params.bPushModel = NVFBC_TRUE;
|
||||||
if(tracking_type == NVFBC_TRACKING_OUTPUT)
|
if(tracking_type == NVFBC_TRACKING_OUTPUT)
|
||||||
create_capture_params.dwOutputId = output_id;
|
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);
|
status = nv_fbc_function_list.nvFBCCreateCaptureSession(nv_fbc_handle, &create_capture_params);
|
||||||
if(status != NVFBC_SUCCESS) {
|
if(status != NVFBC_SUCCESS) {
|
||||||
fprintf(stderr, "Error: %s\n", nv_fbc_function_list.nvFBCGetLastErrorStr(nv_fbc_handle));
|
fprintf(stderr, "Error: %s\n", nv_fbc_function_list.nvFBCGetLastErrorStr(nv_fbc_handle));
|
||||||
|
@ -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, " -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, " -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, " -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, " -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, " -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"
|
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);
|
fprintf(stderr, "Invalid fps argument: %s\n", args["-f"].value);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(fps > 500)
|
if(fps > 250)
|
||||||
fps = 500;
|
fps = 250;
|
||||||
|
|
||||||
const char *quality_str = args["-q"].value;
|
const char *quality_str = args["-q"].value;
|
||||||
if(!quality_str)
|
if(!quality_str)
|
||||||
|
Loading…
Reference in New Issue
Block a user