BitRate enum Null safety

视频编码的码率。单位为 Kbps。你可以根据场景需要,参考下面的视频基准码率参考表,手动设置你想要的码率。若设置的视频码率超出合理范围,SDK 会自动按照合理区间处理码率。

视频码率参考表

分辨率 帧率

(fps)

基准码率

(通信场景,Kbps)

直播码率

(直播场景,Kbps)

160*120 15 65 130
120*120 15 50 100
320*180 15 140 280
180*180 15 100 200
240*180 15 120 240
320*240 15 200 400
240*240 15 140 280
424*240 15 220 440
640*360 15 400 800
360*360 15 260 520
640*360 30 600 1200
360*360 30 400 800
480*360 15 320 640
480*360 30 490 980
640*480 15 500 1000
480*480 15 400 800
640*480 30 750 1500
480*480 30 600 1200
848*480 15 610 1220
848*480 30 930 1860
640*480 10 400 800
1280*720 15 1130 2260
1280*720 30 1710 3420
960*720 15 910 1820
960*720 30 1380 2760

Note

该表中的基准码率适用于通信场景。直播场景下通常需要较大码率来提升视频质量。 Agora 推荐通过设置 Standard 来实现。你也可以直接将码率值设为基准码率值 x 2。

你也可以直接选择如下任意一种模式进行设置:

Constants

Compatible → const BitRate

适配码率模式。该模式下,视频在通信和直播场景下的码率均与基准码率一致。直播下如果选择该模式,视频帧率可能会低于设置的值。

@JsonValue(-1)
const BitRate(1)
Standard → const BitRate

(推荐)标准码率模式。该模式下,视频在通信和直播场景下的码率有所不同:

  • 通信场景下,码率与基准码率一致。
  • 直播场景下,码率对照基准码率翻倍。
@JsonValue(0)
const BitRate(0)
values → const List<BitRate>

A constant List of the values in this enum, in order of their declaration.

const List<BitRate>

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
index int

The integer index of this enum.

final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
override

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited