fix(video): 修正默认码率配置并优化软件编码器

- 将默认码率从 8 Mbps 降至 1 Mbps,更适合嵌入式设备
- 修复 WebRtcConfig 中 max_bitrate < target_bitrate 的逻辑错误
- 优化 libx264/libx265 软件编码器的低延迟配置
- 优化 libvpx (VP8/VP9) 的实时编码参数
This commit is contained in:
mofeng-git
2025-12-31 22:04:58 +08:00
parent 8be45155ac
commit bc85810849
11 changed files with 148 additions and 19 deletions

View File

@@ -235,12 +235,15 @@ public:
c_->pix_fmt =
hw_pixfmt_ != AV_PIX_FMT_NONE ? hw_pixfmt_ : (AVPixelFormat)pixfmt_;
c_->sw_pix_fmt = (AVPixelFormat)pixfmt_;
util_encode::set_av_codec_ctx(c_, name_, kbs_, gop_, fps_);
util_encode::set_av_codec_ctx(c_, name_, kbs_, gop_, fps_, thread_count_);
if (!util_encode::set_lantency_free(c_->priv_data, name_)) {
LOG_ERROR(std::string("set_lantency_free failed, name: ") + name_);
return false;
}
// util_encode::set_quality(c_->priv_data, name_, quality_);
if (!util_encode::set_quality(c_->priv_data, name_, quality_)) {
LOG_ERROR(std::string("set_quality failed, name: ") + name_);
return false;
}
util_encode::set_rate_control(c_, name_, rc_, q_);
util_encode::set_gpu(c_->priv_data, name_, gpu_);
util_encode::force_hw(c_->priv_data, name_);