Better real-time parameters for VP9

Still not practically real-time, but good enough for 720p @ 30fps
This commit is contained in:
mid 2025-10-05 23:27:05 +03:00
parent 0384176de6
commit 1651beddf4

View File

@ -125,24 +125,23 @@ static int encodevpx_start(CHiPubNode *pubn) {
vpx_codec_enc_config_default(node->iface, &node->cfg, 0); vpx_codec_enc_config_default(node->iface, &node->cfg, 0);
node->cfg.g_w = firstFrame->width; node->cfg.g_w = firstFrame->width;
node->cfg.g_h = firstFrame->height; node->cfg.g_h = firstFrame->height;
node->cfg.g_profile = 2; node->cfg.g_profile = 0;
node->cfg.g_timebase.num = 1; node->cfg.g_timebase.num = 1;
node->cfg.g_timebase.den = 30; node->cfg.g_timebase.den = 30;
node->cfg.g_lag_in_frames = 0; node->cfg.g_lag_in_frames = 0;
node->cfg.g_threads = 4; node->cfg.g_threads = 4;
node->cfg.kf_mode = VPX_KF_AUTO; node->cfg.kf_mode = VPX_KF_AUTO;
node->cfg.kf_max_dist = 300; node->cfg.kf_max_dist = 300;
node->cfg.rc_end_usage = VPX_CBR; node->cfg.rc_end_usage = VPX_VBR;
node->cfg.rc_target_bitrate = 3000; node->cfg.rc_target_bitrate = 2000;
node->cfg.rc_min_quantizer = 24; node->cfg.rc_min_quantizer = 0;
node->cfg.rc_max_quantizer = 32; node->cfg.rc_max_quantizer = 32;
node->cfg.rc_undershoot_pct = 95; node->cfg.rc_undershoot_pct = 95;
vpx_codec_enc_init(&node->codec, node->iface, &node->cfg, 0); vpx_codec_enc_init(&node->codec, node->iface, &node->cfg, 0);
vpx_codec_control(&node->codec, VP8E_SET_CPUUSED, 9); vpx_codec_control(&node->codec, VP8E_SET_CPUUSED, 4);
//vpx_codec_control(&node->codec, VP9E_SET_SVC, 1);
vpx_codec_control(&node->codec, VP9E_SET_ROW_MT, 1); vpx_codec_control(&node->codec, VP9E_SET_ROW_MT, 1);
//vpx_codec_control(&node->codec, VP9E_SET_TILE_COLUMNS, 3); vpx_codec_control(&node->codec, VP9E_SET_TILE_COLUMNS, 2);
vpx_codec_control(&node->codec, VP9E_SET_TILE_ROWS, 1); vpx_codec_control(&node->codec, VP9E_SET_TILE_ROWS, 1);
vpx_codec_control(&node->codec, VP9E_SET_NOISE_SENSITIVITY, 0); vpx_codec_control(&node->codec, VP9E_SET_NOISE_SENSITIVITY, 0);
vpx_codec_control(&node->codec, VP9E_SET_TUNE_CONTENT, VP9E_CONTENT_SCREEN); vpx_codec_control(&node->codec, VP9E_SET_TUNE_CONTENT, VP9E_CONTENT_SCREEN);