aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-04-27 01:25:38 +0200
committerdec05eba <dec05eba@protonmail.com>2024-04-27 01:25:38 +0200
commit3143358c3bfc882fb94c1ea906630fc0aa7fd061 (patch)
tree1cfa5297aafa9ef72389de2026246aabbb0e310f /src/main.cpp
parentbb6c38f5070297595d15c98b1ed72a06280cea63 (diff)
Change nvidia preset to default (p4), which improves encoding performance a lot on certain gpus (and fixes 4k60fps encoding on those cards)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 50b5a07..d00a9be 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -626,6 +626,8 @@ 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) {
+ // Disable setting preset since some nvidia gpus cant handle it nicely and greatly reduce encoding performance (from more than 60 fps to less than 45 fps) (such as Nvidia RTX A2000)
+ #if 0
bool supports_p4 = false;
bool supports_p5 = false;
@@ -638,6 +640,7 @@ 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) {
@@ -686,6 +689,7 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality
}
}
+ #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");
@@ -708,6 +712,7 @@ 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);