From faf6ba69a0f3eeafb54ca761298c602649bf4b62 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 20 Aug 2024 15:23:49 +0200 Subject: Improve quality again --- src/main.cpp | 76 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index af1c966..9ac958a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -467,16 +467,16 @@ static AVCodecContext *create_video_codec_context(AVPixelFormat pix_fmt, if(codec_context->codec_id == AV_CODEC_ID_AV1 || codec_context->codec_id == AV_CODEC_ID_H264 || codec_context->codec_id == AV_CODEC_ID_HEVC) { switch(video_quality) { case VideoQuality::MEDIUM: - codec_context->global_quality = 180 * quality_multiply; + codec_context->global_quality = 160 * quality_multiply; break; case VideoQuality::HIGH: - codec_context->global_quality = 140 * quality_multiply; + codec_context->global_quality = 130 * quality_multiply; break; case VideoQuality::VERY_HIGH: - codec_context->global_quality = 120 * quality_multiply; + codec_context->global_quality = 110 * quality_multiply; break; case VideoQuality::ULTRA: - codec_context->global_quality = 100 * quality_multiply; + codec_context->global_quality = 90 * quality_multiply; break; } } else if(codec_context->codec_id == AV_CODEC_ID_VP8) { @@ -746,16 +746,16 @@ static void open_video_software(AVCodecContext *codec_context, VideoQuality vide if(codec_context->codec_id == AV_CODEC_ID_AV1) { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 37 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 35 * qp_multiply, 0); break; case VideoQuality::HIGH: - av_dict_set_int(&options, "qp", 32 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 28 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 25 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 24 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); break; } } else if(codec_context->codec_id == AV_CODEC_ID_H264) { @@ -767,25 +767,25 @@ static void open_video_software(AVCodecContext *codec_context, VideoQuality vide av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 26 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 23 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 20 * qp_multiply, 0); break; } } else { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 37 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 35 * qp_multiply, 0); break; case VideoQuality::HIGH: - av_dict_set_int(&options, "qp", 32 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 28 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 25 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 24 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); break; } } @@ -837,16 +837,16 @@ static void open_video_hardware(AVCodecContext *codec_context, VideoQuality vide if(codec_context->codec_id == AV_CODEC_ID_AV1) { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 37 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 35 * qp_multiply, 0); break; case VideoQuality::HIGH: - av_dict_set_int(&options, "qp", 32 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 28 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 25 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 24 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); break; } } else if(codec_context->codec_id == AV_CODEC_ID_H264) { @@ -858,40 +858,40 @@ static void open_video_hardware(AVCodecContext *codec_context, VideoQuality vide av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 26 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 23 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 20 * qp_multiply, 0); break; } } else if(codec_context->codec_id == AV_CODEC_ID_HEVC) { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 37 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 35 * qp_multiply, 0); break; case VideoQuality::HIGH: - av_dict_set_int(&options, "qp", 32 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 28 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 25 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 24 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); break; } } else if(codec_context->codec_id == AV_CODEC_ID_VP8 || codec_context->codec_id == AV_CODEC_ID_VP9) { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 37 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 35 * qp_multiply, 0); break; case VideoQuality::HIGH: - av_dict_set_int(&options, "qp", 32 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 28 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 25 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 24 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); break; } } @@ -968,40 +968,40 @@ static void open_video_hardware(AVCodecContext *codec_context, VideoQuality vide av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 26 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 23 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 20 * qp_multiply, 0); break; } } else if(codec_context->codec_id == AV_CODEC_ID_HEVC) { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 37 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 35 * qp_multiply, 0); break; case VideoQuality::HIGH: - av_dict_set_int(&options, "qp", 32 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 28 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 25 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 24 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); break; } } else if(codec_context->codec_id == AV_CODEC_ID_VP8 || codec_context->codec_id == AV_CODEC_ID_VP9) { switch(video_quality) { case VideoQuality::MEDIUM: - av_dict_set_int(&options, "qp", 37 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 35 * qp_multiply, 0); break; case VideoQuality::HIGH: - av_dict_set_int(&options, "qp", 32 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 30 * qp_multiply, 0); break; case VideoQuality::VERY_HIGH: - av_dict_set_int(&options, "qp", 28 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 25 * qp_multiply, 0); break; case VideoQuality::ULTRA: - av_dict_set_int(&options, "qp", 24 * qp_multiply, 0); + av_dict_set_int(&options, "qp", 22 * qp_multiply, 0); break; } } -- cgit v1.2.3