K230 Micropython VENC编码器怎么修改码率的配置?

Viewed 138

如题。K230 Micropython VENC编码器怎么修改码率的配置?

1 Answers

您好,当前版本的码率参数尚未公开,但将在下个版本中公开。
目前,您可以通过以下步骤进行修改:

  1. 打开 src/canmv/port/builtin_py/media/vencoder.py 文件。
  2. 修改以下代码段:
class ChnAttrStr:
    def __init__(self, payloadType, profile, picWidth, picHeight, bit_rate=4000, gopLen=30):
        self.payload_type = payloadType
        self.profile = profile
        self.pic_width = picWidth
        self.pic_height = picHeight
        self.gop_len = gopLen
        self.bit_rate = bit_rate  # 码率参数

    def Create(self, chn, chnAttr):
        ...
        venc_chn_attr.rc_attr.cbr.dst_frame_rate = 30
        venc_chn_attr.rc_attr.cbr.bit_rate = chnAttr.bit_rate  # 码率参数
        ...
  1. 在示例代码中,进行如下修改:
# 修改码率为2000
chnAttr = ChnAttrStr(encoder.PAYLOAD_TYPE_H265, encoder.H265_PROFILE_MAIN, width, height, bit_rate=2000)

多谢