Reconfigure quality, force refresh nvfbc frame, mention stutter in readme

This commit is contained in:
dec05eba
2024-03-08 11:33:11 +01:00
parent 3553cd14f1
commit 1d54d61b78
3 changed files with 12 additions and 13 deletions

View File

@@ -153,6 +153,8 @@ If you get black bars then the workaround is to record with h264 video codec ins
This is an issue on some intel integrated gpus on wayland caused by power saving option. Right now the only way to fix this is to record on X11 instead. This is an issue on some intel integrated gpus on wayland caused by power saving option. Right now the only way to fix this is to record on X11 instead.
## The video doesn't display or has a green/yellow overlay ## The video doesn't display or has a green/yellow overlay
This can happen if your video player is missing the H264/HEVC video codecs. Either install the codecs or use mpv. This can happen if your video player is missing the H264/HEVC video codecs. Either install the codecs or use mpv.
## I get stutter in the video
Try recording to an SSD and make sure it's not using NTFS file system. Also record in variable framerate format.
# Donations # Donations
If you want to donate you can donate via bitcoin or monero. If you want to donate you can donate via bitcoin or monero.

View File

@@ -410,7 +410,7 @@ static int gsr_capture_nvfbc_capture(gsr_capture *cap, AVFrame *frame) {
NVFBC_TOCUDA_GRAB_FRAME_PARAMS grab_params; NVFBC_TOCUDA_GRAB_FRAME_PARAMS grab_params;
memset(&grab_params, 0, sizeof(grab_params)); memset(&grab_params, 0, sizeof(grab_params));
grab_params.dwVersion = NVFBC_TOCUDA_GRAB_FRAME_PARAMS_VER; grab_params.dwVersion = NVFBC_TOCUDA_GRAB_FRAME_PARAMS_VER;
grab_params.dwFlags = NVFBC_TOCUDA_GRAB_FLAGS_NOWAIT;/* | NVFBC_TOCUDA_GRAB_FLAGS_FORCE_REFRESH;*/ grab_params.dwFlags = NVFBC_TOCUDA_GRAB_FLAGS_NOWAIT | NVFBC_TOCUDA_GRAB_FLAGS_FORCE_REFRESH;/* | NVFBC_TOCUDA_GRAB_FLAGS_FORCE_REFRESH;*/
grab_params.pFrameGrabInfo = &frame_info; grab_params.pFrameGrabInfo = &frame_info;
grab_params.pCUDADeviceBuffer = &cu_device_ptr; grab_params.pCUDADeviceBuffer = &cu_device_ptr;
grab_params.dwTimeoutMs = 0; grab_params.dwTimeoutMs = 0;

View File

@@ -620,7 +620,6 @@ static AVFrame* create_audio_frame(AVCodecContext *audio_codec_context) {
static void open_video(AVCodecContext *codec_context, VideoQuality video_quality, bool very_old_gpu, gsr_gpu_vendor vendor, PixelFormat pixel_format, bool hdr) { static void open_video(AVCodecContext *codec_context, VideoQuality video_quality, bool very_old_gpu, gsr_gpu_vendor vendor, PixelFormat pixel_format, bool hdr) {
AVDictionary *options = nullptr; AVDictionary *options = nullptr;
if(vendor == GSR_GPU_VENDOR_NVIDIA) { if(vendor == GSR_GPU_VENDOR_NVIDIA) {
#if 0
bool supports_p4 = false; bool supports_p4 = false;
bool supports_p5 = false; bool supports_p5 = false;
@@ -633,21 +632,20 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality
supports_p5 = true; supports_p5 = true;
} }
} }
#endif
if(codec_context->codec_id == AV_CODEC_ID_AV1) { if(codec_context->codec_id == AV_CODEC_ID_AV1) {
switch(video_quality) { switch(video_quality) {
case VideoQuality::MEDIUM: case VideoQuality::MEDIUM:
av_dict_set_int(&options, "qp", 43, 0); av_dict_set_int(&options, "qp", 37, 0);
break; break;
case VideoQuality::HIGH: case VideoQuality::HIGH:
av_dict_set_int(&options, "qp", 39, 0); av_dict_set_int(&options, "qp", 32, 0);
break; break;
case VideoQuality::VERY_HIGH: case VideoQuality::VERY_HIGH:
av_dict_set_int(&options, "qp", 34, 0); av_dict_set_int(&options, "qp", 28, 0);
break; break;
case VideoQuality::ULTRA: case VideoQuality::ULTRA:
av_dict_set_int(&options, "qp", 28, 0); av_dict_set_int(&options, "qp", 24, 0);
break; break;
} }
} else if(very_old_gpu || codec_context->codec_id == AV_CODEC_ID_H264) { } else if(very_old_gpu || codec_context->codec_id == AV_CODEC_ID_H264) {
@@ -668,20 +666,20 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality
} else { } else {
switch(video_quality) { switch(video_quality) {
case VideoQuality::MEDIUM: case VideoQuality::MEDIUM:
av_dict_set_int(&options, "qp", 40, 0); av_dict_set_int(&options, "qp", 37, 0);
break; break;
case VideoQuality::HIGH: case VideoQuality::HIGH:
av_dict_set_int(&options, "qp", 35, 0); av_dict_set_int(&options, "qp", 32, 0);
break; break;
case VideoQuality::VERY_HIGH: case VideoQuality::VERY_HIGH:
av_dict_set_int(&options, "qp", 30, 0); av_dict_set_int(&options, "qp", 28, 0);
break; break;
case VideoQuality::ULTRA: case VideoQuality::ULTRA:
av_dict_set_int(&options, "qp", 24, 0); av_dict_set_int(&options, "qp", 24, 0);
break; break;
} }
} }
#if 0
if(!supports_p4 && !supports_p5) if(!supports_p4 && !supports_p5)
fprintf(stderr, "Info: your ffmpeg version is outdated. It's recommended that you use the flatpak version of gpu-screen-recorder version instead, which you can find at https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder\n"); fprintf(stderr, "Info: your ffmpeg version is outdated. It's recommended that you use the flatpak version of gpu-screen-recorder version instead, which you can find at https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder\n");
@@ -704,7 +702,6 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality
av_dict_set(&options, "preset", supports_p4 ? "p4" : "medium", 0); av_dict_set(&options, "preset", supports_p4 ? "p4" : "medium", 0);
else else
av_dict_set(&options, "preset", supports_p5 ? "p5" : "slow", 0); av_dict_set(&options, "preset", supports_p5 ? "p5" : "slow", 0);
#endif
av_dict_set(&options, "tune", "hq", 0); av_dict_set(&options, "tune", "hq", 0);
av_dict_set(&options, "rc", "constqp", 0); av_dict_set(&options, "rc", "constqp", 0);
@@ -752,7 +749,7 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality
} else { } else {
switch(video_quality) { switch(video_quality) {
case VideoQuality::MEDIUM: case VideoQuality::MEDIUM:
av_dict_set_int(&options, "qp", 36, 0); av_dict_set_int(&options, "qp", 37, 0);
break; break;
case VideoQuality::HIGH: case VideoQuality::HIGH:
av_dict_set_int(&options, "qp", 32, 0); av_dict_set_int(&options, "qp", 32, 0);