Skip to content

Commit a4ce8ee

Browse files
committed
tweak x265 encoder settings
1 parent a98b6d8 commit a4ce8ee

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

amalgamation/toxcore_amalgamation.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82707,7 +82707,7 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
8270782707
// LOGGER_API_WARNING(vc->av->tox, "H265 encoder init");
8270882708

8270982709
x265_param *param = x265_param_alloc();
82710-
if (x265_param_default_preset(param, "ultrafast", "zerolatency") != 0) {
82710+
if (x265_param_default_preset(param, "superfast", "zerolatency") != 0) {
8271182711
// LOGGER_API_WARNING(vc->av->tox, "H265 encoder:x265_param_default_preset error");
8271282712
printf("vc_init_encoder_h265: H265 encoder:x265_param_default_preset error\n");
8271382713
// goto fail;
@@ -82735,7 +82735,7 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
8273582735
x265_param_parse(param, "input-csp", "i420");
8273682736

8273782737
// x265_param_parse(param, "rd", "1");
82738-
x265_param_parse(param, "intra-refresh", "1");
82738+
//**//x265_param_parse(param, "intra-refresh", "1");
8273982739
// x265_param_parse(param, "pools", "3");
8274082740

8274182741
// logLevelNames = "none", "error", "warning", "info", "debug", "full"
@@ -82751,9 +82751,9 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
8275182751

8275282752
param->rc.bitrate = (int)(bit_rate / 1000);
8275382753
// printf("vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
82754-
param->rc.vbvBufferSize = ((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264;
82755-
param->rc.vbvMaxBitrate = (int)(bit_rate / 1000) * 1;
82756-
x265_param_parse(param, "strict-cbr", "1");
82754+
//**// param->rc.vbvBufferSize = ((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264;
82755+
//**// param->rc.vbvMaxBitrate = (int)(bit_rate / 1000) * 1;
82756+
//**// x265_param_parse(param, "strict-cbr", "1");
8275782757

8275882758
// Range of values: an integer from 0 to 51
8275982759
// x265_param_parse(param, "qp", "50");
@@ -82905,9 +82905,8 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
8290582905

8290682906
param->rc.bitrate = (int)(bit_rate / 1000);
8290782907
// printf("vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
82908-
param->rc.vbvBufferSize = ((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264;
82909-
param->rc.vbvMaxBitrate = (int)(bit_rate / 1000) * 1;
82910-
// x265_param_parse(param, "strict-cbr", "1");
82908+
//**// param->rc.vbvBufferSize = ((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264;
82909+
//**// param->rc.vbvMaxBitrate = (int)(bit_rate / 1000) * 1;
8291182910

8291282911
int res = x265_encoder_reconfig(vc->h265_encoder, param);
8291382912
// printf("x265_encoder_reconfig:res=%d bitrate=%d\n", (int)res, (int)(bit_rate / 1000));

toxav/codecs/h264/codec.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
19421942
// LOGGER_API_WARNING(vc->av->tox, "H265 encoder init");
19431943

19441944
x265_param *param = x265_param_alloc();
1945-
if (x265_param_default_preset(param, "ultrafast", "zerolatency") != 0) {
1945+
if (x265_param_default_preset(param, "superfast", "zerolatency") != 0) {
19461946
// LOGGER_API_WARNING(vc->av->tox, "H265 encoder:x265_param_default_preset error");
19471947
printf("vc_init_encoder_h265: H265 encoder:x265_param_default_preset error\n");
19481948
// goto fail;
@@ -1970,7 +1970,7 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
19701970
x265_param_parse(param, "input-csp", "i420");
19711971

19721972
// x265_param_parse(param, "rd", "1");
1973-
x265_param_parse(param, "intra-refresh", "1");
1973+
//**//x265_param_parse(param, "intra-refresh", "1");
19741974
// x265_param_parse(param, "pools", "3");
19751975

19761976
// logLevelNames = "none", "error", "warning", "info", "debug", "full"
@@ -1986,9 +1986,9 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
19861986

19871987
param->rc.bitrate = (int)(bit_rate / 1000);
19881988
// printf("vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
1989-
param->rc.vbvBufferSize = ((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264;
1990-
param->rc.vbvMaxBitrate = (int)(bit_rate / 1000) * 1;
1991-
x265_param_parse(param, "strict-cbr", "1");
1989+
//**// param->rc.vbvBufferSize = ((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264;
1990+
//**// param->rc.vbvMaxBitrate = (int)(bit_rate / 1000) * 1;
1991+
//**// x265_param_parse(param, "strict-cbr", "1");
19921992

19931993
// Range of values: an integer from 0 to 51
19941994
// x265_param_parse(param, "qp", "50");
@@ -2140,9 +2140,8 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
21402140

21412141
param->rc.bitrate = (int)(bit_rate / 1000);
21422142
// printf("vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
2143-
param->rc.vbvBufferSize = ((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264;
2144-
param->rc.vbvMaxBitrate = (int)(bit_rate / 1000) * 1;
2145-
// x265_param_parse(param, "strict-cbr", "1");
2143+
//**// param->rc.vbvBufferSize = ((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264;
2144+
//**// param->rc.vbvMaxBitrate = (int)(bit_rate / 1000) * 1;
21462145

21472146
int res = x265_encoder_reconfig(vc->h265_encoder, param);
21482147
// printf("x265_encoder_reconfig:res=%d bitrate=%d\n", (int)res, (int)(bit_rate / 1000));

0 commit comments

Comments
 (0)