VideoEncoderConfiguration

Video encoder configurations.

struct VideoEncoderConfiguration {
  VIDEO_CODEC_TYPE codecType;
  VideoDimensions dimensions;
  int frameRate;
  int bitrate;
  int minBitrate;
  ORIENTATION_MODE orientationMode;
  DEGRADATION_PREFERENCE degradationPreference;
  VIDEO_MIRROR_MODE_TYPE mirrorMode;
  AdvanceOptions advanceOptions;

  VideoEncoderConfiguration(const VideoDimensions& d, int f, int b, ORIENTATION_MODE m, VIDEO_MIRROR_MODE_TYPE mirror = VIDEO_MIRROR_MODE_DISABLED)
      : codecType(VIDEO_CODEC_H264),
        dimensions(d),
        frameRate(f),
        bitrate(b),
        minBitrate(DEFAULT_MIN_BITRATE),
        orientationMode(m),
        degradationPreference(MAINTAIN_QUALITY),
        mirrorMode(mirror),
        advanceOptions(PREFER_AUTO) {}
  VideoEncoderConfiguration(int width, int height, int f, int b, ORIENTATION_MODE m, VIDEO_MIRROR_MODE_TYPE mirror = VIDEO_MIRROR_MODE_DISABLED)
      : codecType(VIDEO_CODEC_H264),
        dimensions(width, height),
        frameRate(f),
        bitrate(b),
        minBitrate(DEFAULT_MIN_BITRATE),
        orientationMode(m),
        degradationPreference(MAINTAIN_QUALITY),
        mirrorMode(mirror),
        advanceOptions(PREFER_AUTO) {}
  VideoEncoderConfiguration(const VideoEncoderConfiguration& config)
      : codecType(config.codecType),
        dimensions(config.dimensions),
        frameRate(config.frameRate),
        bitrate(config.bitrate),
        minBitrate(config.minBitrate),
        orientationMode(config.orientationMode),
        degradationPreference(config.degradationPreference),
        mirrorMode(config.mirrorMode),
        advanceOptions(config.advanceOptions) {}
  VideoEncoderConfiguration()
      : codecType(VIDEO_CODEC_H264),
        dimensions(FRAME_WIDTH_640, FRAME_HEIGHT_360),
        frameRate(FRAME_RATE_FPS_15),
        bitrate(STANDARD_BITRATE),
        minBitrate(DEFAULT_MIN_BITRATE),
        orientationMode(ORIENTATION_MODE_ADAPTIVE),
        degradationPreference(MAINTAIN_QUALITY),
        mirrorMode(VIDEO_MIRROR_MODE_DISABLED),
        advanceOptions(PREFER_AUTO) {}
};

dimensions

The dimensions of the encoded video (px). See VideoDimensions. This parameter measures the video encoding quality in the format of length × width. The default value is 960 × 540. You can set a custom value.

codecType
The codec type of the local video stream. See VIDEO_CODEC_TYPE.
frameRate
The frame rate (fps) of the encoding video frame. The default value is 15. See FRAME_RATE.
bitrate

The encoding bitrate (Kbps) of the video.

  • STANDARD_BITRATE(0): (Recommended) Standard bitrate mode. In this mode, the bitrates of the live broadcasting profile is higher than that of the communication profile. See Video profile.
  • COMPATIBLE_BITRATE(-1): Adaptive bitrate mode. In this mode, the bitrates of the live broadcasting profile equals that of the communication profile. If this mode is selected, the video frame rate of live broadcasting scenarios may be lower than the set value.
minBitrate

The minimum encoding bitrate (Kbps) of the video.

The SDK automatically adjusts the encoding bitrate to adapt to the network conditions. Using a value greater than the default value forces the video encoder to output high-quality images but may cause more packet loss and sacrifice the smoothness of the video transmission. Unless you have special requirements for image quality, Agora does not recommend changing this value.

Attention: This parameter only applies to the interactive streaming profile.
orientationMode
The orientation mode of the encoded video. See ORIENTATION_MODE.
degradationPreference
Video degradation preference under limited bandwidth. See DEGRADATION_PREFERENCE.
mirrorMode

Sets the mirror mode of the published local video stream. It only affects the video that the remote user sees. See VIDEO_MIRROR_MODE_TYPE.

Attention: By default, the video is not mirrored.
advanceOptions
Advanced options for video encoding. See AdvanceOptions.