Skip to content

Commit 6009003

Browse files
committed
tweak x265 encoder settings
1 parent 0dce90d commit 6009003

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

amalgamation/toxcore_amalgamation.c

Lines changed: 7 additions & 3 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, "superfast", "fastdecode") != 0) {
82710+
if (x265_param_default_preset(param, "ultrafast", "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;
@@ -82737,8 +82737,8 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
8273782737
// x265_param_parse(param, "rd", "1");
8273882738
x265_param_parse(param, "intra-refresh", "1");
8273982739

82740-
x265_param_parse(param, "frame-threads", "2");
82741-
x265_param_parse(param, "pools", "2");
82740+
// x265_param_parse(param, "frame-threads", "2");
82741+
// x265_param_parse(param, "pools", "2");
8274282742

8274382743

8274482744
x265_param_parse(param, "log-level", "debug");
@@ -82916,6 +82916,10 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
8291682916
// x265_param_parse(param, "bitrate", bitrate_str);
8291782917
x265_param_parse(param, "bitrate", "800");
8291882918
param->rc.bitrate = 800;
82919+
printf("vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
82920+
82921+
param->rc.vbvBufferSize = 800 * VIDEO_BUF_FACTOR_H264;
82922+
param->rc.vbvMaxBitrate = 800 * 1;
8291982923

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

toxav/codecs/h264/codec.c

Lines changed: 7 additions & 3 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, "superfast", "fastdecode") != 0) {
1945+
if (x265_param_default_preset(param, "ultrafast", "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;
@@ -1972,8 +1972,8 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
19721972
// x265_param_parse(param, "rd", "1");
19731973
x265_param_parse(param, "intra-refresh", "1");
19741974

1975-
x265_param_parse(param, "frame-threads", "2");
1976-
x265_param_parse(param, "pools", "2");
1975+
// x265_param_parse(param, "frame-threads", "2");
1976+
// x265_param_parse(param, "pools", "2");
19771977

19781978

19791979
x265_param_parse(param, "log-level", "debug");
@@ -2151,6 +2151,10 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
21512151
// x265_param_parse(param, "bitrate", bitrate_str);
21522152
x265_param_parse(param, "bitrate", "800");
21532153
param->rc.bitrate = 800;
2154+
printf("vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
2155+
2156+
param->rc.vbvBufferSize = 800 * VIDEO_BUF_FACTOR_H264;
2157+
param->rc.vbvMaxBitrate = 800 * 1;
21542158

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

0 commit comments

Comments
 (0)