VideoEncoderConfiguration

Configuration for the video encoder.

class VideoEncoderConfiguration {
  const VideoEncoderConfiguration(
      {this.codecType,
      this.dimensions,
      this.frameRate,
      this.bitrate,
      this.minBitrate,
      this.orientationMode,
      this.degradationPreference,
      this.mirrorMode,
      this.advanceOptions});

  @JsonKey(name: 'codecType')
  final VideoCodecType? codecType;

  @JsonKey(name: 'dimensions')
  final VideoDimensions? dimensions;

  @JsonKey(name: 'frameRate')
  final int? frameRate;

  @JsonKey(name: 'bitrate')
  final int? bitrate;

  @JsonKey(name: 'minBitrate')
  final int? minBitrate;

  @JsonKey(name: 'orientationMode')
  final OrientationMode? orientationMode;

  @JsonKey(name: 'degradationPreference')
  final DegradationPreference? degradationPreference;

  @JsonKey(name: 'mirrorMode')
  final VideoMirrorModeType? mirrorMode;

  @JsonKey(name: 'advanceOptions')
  final AdvanceOptions? advanceOptions;

  factory VideoEncoderConfiguration.fromJson(Map<String, dynamic> json) =>
      _$VideoEncoderConfigurationFromJson(json);

  Map<String, dynamic> toJson() => _$VideoEncoderConfigurationToJson(this);
}

Properties

dimensions
Resolution (px) for video encoding. See VideoDimensions. This parameter is used to evaluate encoding quality and is expressed as width × height. The default value is 960 × 540. You can set the resolution as needed.
codecType
Video codec type. See VideoCodecType.
frameRate
Frame rate (fps) for video encoding. The default value is 15. See FrameRate.
bitrate
Bitrate for video encoding, in Kbps. You do not need to set this parameter. Keep the default value standardBitrate. The SDK automatically selects the optimal bitrate based on the resolution and frame rate you set. For the relationship between resolution and frame rate, see Video Profile.
  • standardBitrate (0): (Default) Standard bitrate mode.
  • compatibleBitrate (-1): Compatible bitrate mode. In general, Agora recommends not using this value.
minBitrate
Minimum encoding bitrate, in Kbps. The SDK automatically adjusts the video encoding bitrate based on network conditions. Setting this parameter higher than the default forces the encoder to output higher-quality images, but may cause packet loss and video stuttering under poor network conditions. Unless you have specific requirements for video quality, Agora recommends not modifying this parameter.
Note: This parameter applies to live streaming only.
orientationMode
Orientation mode for video encoding. See OrientationMode.
degradationPreference
Encoding degradation preference when bandwidth is limited. See DegradationPreference.
Note: If this parameter is set to maintainFramerate (1) or maintainBalanced (2), you must also set orientationMode to orientationModeAdaptive (0), otherwise the setting will not take effect.
mirrorMode
Whether to enable mirror mode when sending encoded video. This only affects the video seen by remote users. See VideoMirrorModeType.
Note: Mirror mode is disabled by default.
advanceOptions
Advanced options for video encoding. See AdvanceOptions.