From 1d54d61b78478762cbbaa7dd039520b9c3955f45 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 8 Mar 2024 11:33:11 +0100 Subject: Reconfigure quality, force refresh nvfbc frame, mention stutter in readme --- README.md | 2 ++ src/capture/nvfbc.c | 2 +- src/main.cpp | 21 +++++++++------------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7ab615b..b921d52 100644 --- a/README.md +++ b/README.md @@ -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. ## 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. +## 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 If you want to donate you can donate via bitcoin or monero. diff --git a/src/capture/nvfbc.c b/src/capture/nvfbc.c index e6ee1a9..5eab5d3 100644 --- a/src/capture/nvfbc.c +++ b/src/capture/nvfbc.c @@ -410,7 +410,7 @@ static int gsr_capture_nvfbc_capture(gsr_capture *cap, AVFrame *frame) { NVFBC_TOCUDA_GRAB_FRAME_PARAMS grab_params; memset(&grab_params, 0, sizeof(grab_params)); 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.pCUDADeviceBuffer = &cu_device_ptr; grab_params.dwTimeoutMs = 0; diff --git a/src/main.cpp b/src/main.cpp index 3b750a7..07275c7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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) { AVDictionary *options = nullptr; if(vendor == GSR_GPU_VENDOR_NVIDIA) { -#if 0 bool supports_p4 = false; bool supports_p5 = false; @@ -633,21 +632,20 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality supports_p5 = true; } } -#endif if(codec_context->codec_id == AV_CODEC_ID_AV1) { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 43, 0); + av_dict_set_int(&options, "qp", 37, 0); break; case VideoQuality::HIGH: - av_dict_set_int(&options, "qp", 39, 0); + av_dict_set_int(&options, "qp", 32, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 34, 0); + av_dict_set_int(&options, "qp", 28, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 28, 0); + av_dict_set_int(&options, "qp", 24, 0); break; } } 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 { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 40, 0); + av_dict_set_int(&options, "qp", 37, 0); break; case VideoQuality::HIGH: - av_dict_set_int(&options, "qp", 35, 0); + av_dict_set_int(&options, "qp", 32, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 30, 0); + av_dict_set_int(&options, "qp", 28, 0); break; case VideoQuality::ULTRA: av_dict_set_int(&options, "qp", 24, 0); break; } } -#if 0 + 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"); @@ -704,7 +702,6 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality av_dict_set(&options, "preset", supports_p4 ? "p4" : "medium", 0); else av_dict_set(&options, "preset", supports_p5 ? "p5" : "slow", 0); -#endif av_dict_set(&options, "tune", "hq", 0); av_dict_set(&options, "rc", "constqp", 0); @@ -752,7 +749,7 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality } else { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 36, 0); + av_dict_set_int(&options, "qp", 37, 0); break; case VideoQuality::HIGH: av_dict_set_int(&options, "qp", 32, 0); -- cgit v1.2.3