Agora Java API Reference for Android

Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
io.agora.rtc2.video.VideoEncoderConfiguration Class Reference

Video encoder configurations. More...

## Classes
class | AdvanceOptions
| Advanced options for video encoding. More...
enum | CODEC_CAP_MASK
enum | COMPRESSION_PREFERENCE
| Compression preference for video encoding. More...
enum | DEGRADATION_PREFERENCE
| Video degradation preferences when the bandwidth is a constraint. More...
enum | ENCODING_PREFERENCE
| Video encoder preference. More...
enum | FRAME_RATE
| The video frame rate. More...
enum | MIRROR_MODE_TYPE
enum | ORIENTATION_MODE
| Video output orientation mode. More...
enum | VIDEO_CODEC_TYPE
| Video codec types. More...
class | VideoDimensions
| The video dimension. More...

## Public Member Functions
| VideoEncoderConfiguration (VideoDimensions dimensions, FRAME_RATE frameRate, int bitrate, ORIENTATION_MODE orientationMode)
| VideoEncoderConfiguration (VideoDimensions dimensions, FRAME_RATE frameRate, int bitrate, ORIENTATION_MODE orientationMode, MIRROR_MODE_TYPE mirrorMode)
| VideoEncoderConfiguration (int width, int height, FRAME_RATE frameRate, int bitrate, ORIENTATION_MODE orientationMode)
| VideoEncoderConfiguration (int width, int height, FRAME_RATE frameRate, int bitrate, ORIENTATION_MODE orientationMode, MIRROR_MODE_TYPE mirrorMode)

## Public Attributes
VideoDimensions | dimensions
int | frameRate
int | minFrameRate
int | bitrate
int | minBitrate
ORIENTATION_MODE | orientationMode
DEGRADATION_PREFERENCE | degradationPrefer
MIRROR_MODE_TYPE | mirrorMode
AdvanceOptions | advanceOptions
VIDEO_CODEC_TYPE | codecType

## Static Public Attributes
static final VideoDimensions | VD_120x120 = new VideoDimensions(120, 120)
static final VideoDimensions | VD_160x120 = new VideoDimensions(160, 120)
static final VideoDimensions | VD_180x180 = new VideoDimensions(180, 180)
static final VideoDimensions | VD_240x180 = new VideoDimensions(240, 180)
static final VideoDimensions | VD_320x180 = new VideoDimensions(320, 180)
static final VideoDimensions | VD_240x240 = new VideoDimensions(240, 240)
static final VideoDimensions | VD_320x240 = new VideoDimensions(320, 240)
static final VideoDimensions | VD_424x240 = new VideoDimensions(424, 240)
static final VideoDimensions | VD_360x360 = new VideoDimensions(360, 360)
static final VideoDimensions | VD_480x360 = new VideoDimensions(480, 360)
static final VideoDimensions | VD_640x360 = new VideoDimensions(640, 360)
static final VideoDimensions | VD_480x480 = new VideoDimensions(480, 480)
static final VideoDimensions | VD_640x480 = new VideoDimensions(640, 480)
static final VideoDimensions | VD_840x480 = new VideoDimensions(840, 480)
static final VideoDimensions | VD_960x540 = new VideoDimensions(960, 540)
static final VideoDimensions | VD_960x720 = new VideoDimensions(960, 720)
static final VideoDimensions | VD_1280x720 = new VideoDimensions(1280, 720)
static final VideoDimensions | VD_1920x1080 = new VideoDimensions(1920, 1080)
static final VideoDimensions | VD_2540x1440 = new VideoDimensions(2540, 1440)
static final VideoDimensions | VD_3840x2160 = new VideoDimensions(3840, 2160)
static final int | STANDARD_BITRATE = 0
static final int | COMPATIBLE_BITRATE = -1
static final int | DEFAULT_MIN_BITRATE = -1
static final int | DEFAULT_MIN_FRAMERATE = -1
static final int | DEFAULT_MIN_BITRATE_EQUAL_TO_TARGET_BITRATE = -2

## Detailed Description

Video encoder configurations.

## Member Data Documentation

## ◆ VD_120x120

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_120x120 = new VideoDimensions(120, 120)
| static

VD_120x120: The video resolution is 120 × 120.

## ◆ VD_160x120

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_160x120 = new VideoDimensions(160, 120)
| static

VD_160x120: The video resolution is 160 × 120.

## ◆ VD_180x180

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_180x180 = new VideoDimensions(180, 180)
| static

VD_180x180: The video resolution is 180 × 180.

## ◆ VD_240x180

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_240x180 = new VideoDimensions(240, 180)
| static

VD_240x180: The video resolution is 240 × 180.

## ◆ VD_320x180

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_320x180 = new VideoDimensions(320, 180)
| static

VD_320x180: The video resolution is 320 × 180.

## ◆ VD_240x240

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_240x240 = new VideoDimensions(240, 240)
| static

VD_240x240: The video resolution is 240 × 240.

## ◆ VD_320x240

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_320x240 = new VideoDimensions(320, 240)
| static

VD_320x240: The video resolution is 320 × 240.

## ◆ VD_424x240

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_424x240 = new VideoDimensions(424, 240)
| static

VD_424x240: The video resolution is 424 × 240.

## ◆ VD_360x360

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_360x360 = new VideoDimensions(360, 360)
| static

VD_360x360: The video resolution is 360 × 360.

## ◆ VD_480x360

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_480x360 = new VideoDimensions(480, 360)
| static

VD_480x360: The video resolution is 480 × 360.

## ◆ VD_640x360

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_640x360 = new VideoDimensions(640, 360)
| static

VD_640x360: The video resolution is 640 × 360.

## ◆ VD_480x480

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_480x480 = new VideoDimensions(480, 480)
| static

VD_480x480: The video resolution is 480 × 480.

## ◆ VD_640x480

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_640x480 = new VideoDimensions(640, 480)
| static

VD_640x480: The video resolution is 640 × 480.

## ◆ VD_840x480

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_840x480 = new VideoDimensions(840, 480)
| static

VD_840x480: The video resolution is 840 × 480.

## ◆ VD_960x540

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_960x540 = new VideoDimensions(960, 540)
| static

VD_960x540: The video resolution is 960 × 540.

## ◆ VD_960x720

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_960x720 = new VideoDimensions(960, 720)
| static

VD_960x720: The video resolution is 640 × 360.

## ◆ VD_1280x720

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_1280x720 = new VideoDimensions(1280, 720)
| static

VD_1280x720: The video resolution is 640 × 360.

## ◆ VD_1920x1080

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_1920x1080 = new VideoDimensions(1920, 1080)
| static

Not supported.

## ◆ VD_2540x1440

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_2540x1440 = new VideoDimensions(2540, 1440)
| static

Not supported.

## ◆ VD_3840x2160

final VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.VD_3840x2160 = new VideoDimensions(3840, 2160)
| static

Not supported.

## ◆ STANDARD_BITRATE

final int io.agora.rtc2.video.VideoEncoderConfiguration.STANDARD_BITRATE = 0
| static

0: The standard bitrate mode. In this mode, the bitrates under the Live Broadcast and Communication profiles differ:

- In the Communication profile, the video bitrate is the same as the base bitrate.
- In the Live Broadcast profile, the video bitrate is twice the base bitrate.

## ◆ COMPATIBLE_BITRATE

final int io.agora.rtc2.video.VideoEncoderConfiguration.COMPATIBLE_BITRATE = -1
| static

-1: The compatible bitrate mode. In this mode, the bitrate stays the same regardless of the profile. If you choose this mode for the Live Broadcast profile, the video frame rate may be lower than the set value.

## ◆ DEFAULT_MIN_BITRATE

final int io.agora.rtc2.video.VideoEncoderConfiguration.DEFAULT_MIN_BITRATE = -1
| static

(For future use) Use the default minimum bitrate.

## ◆ DEFAULT_MIN_FRAMERATE

final int io.agora.rtc2.video.VideoEncoderConfiguration.DEFAULT_MIN_FRAMERATE = -1
| static

(For future use) The default minimum frame rate.

## ◆ DEFAULT_MIN_BITRATE_EQUAL_TO_TARGET_BITRATE

final int io.agora.rtc2.video.VideoEncoderConfiguration.DEFAULT_MIN_BITRATE_EQUAL_TO_TARGET_BITRATE = -2
| static

-2: (For future use) Set minimum bitrate the same as target bitrate.

## ◆ dimensions

VideoDimensions io.agora.rtc2.video.VideoEncoderConfiguration.dimensions

Users can set the resolution by themselves, or directly select the desired resolution from the following list:

- VD_120x120: The video resolution is 120 × 120.
- VD_160x120: The video resolution is 160 × 120.
- VD_180x180: The video resolution is 180 × 180.
- VD_240x180: The video resolution is 240 × 180.
- VD_320x180: The video resolution is 320 × 180.
- VD_240x240: The video resolution is 240 × 240.
- VD_320x240: The video resolution is 320 × 240.
- VD_424x240: The video resolution is 424 × 240.
- VD_360x360: The video resolution is 360 × 360.
- VD_480x360: The video resolution is 480 × 360.
- VD_640x360: The video resolution is 640 × 360.
- VD_480x480: The video resolution is 480 × 480.
- VD_640x480: The video resolution is 640 × 480.
- VD_840x480: The video resolution is 840 × 480.
- VD_960x540: The video resolution is 960 × 540.
- VD_960x720: The video resolution is 960 × 720.
- VD_1280x720: The video resolution is 1280 × 720.
- VD_1920x1080: The video resolution is 1920 × 1080.
- VD_2540x1440: The video resolution is 2540 × 1440.
- VD_3840x2160: The video resolution is 3840 × 2160.
  Note
- Whether the 720p resolution or above can be supported depends on the device. If the device cannot support 720p, the frame rate will be lower than the set value.
- The default value is 960 × 540.

## ◆ frameRate

int io.agora.rtc2.video.VideoEncoderConfiguration.frameRate

The frame rate (fps) of the encoding video frame. The default value is 15. See `FRAME_RATE`.

## ◆ minFrameRate

int io.agora.rtc2.video.VideoEncoderConfiguration.minFrameRate

(For future use) The minimum video encoder frame rate (fps). The default value is {DEFAULT_MIN_FRAMERATE(-1)} (the SDK uses the lowest encoder frame rate).

## ◆ bitrate

int io.agora.rtc2.video.VideoEncoderConfiguration.bitrate

The encoding bitrate (Kbps) of the video. This parameter does not need to be set; keeping the default value `STANDARD_BITRATE` is sufficient. The SDK automatically matches the most suitable bitrate based on the video resolution and frame rate you have set. For the correspondence between video resolution and frame rate, see `Video profile`.

- STANDARD_BITRATE (0): (Recommended) Standard bitrate mode.
- COMPATIBLE_BITRATE (-1): Adaptive bitrate mode. In general, Agora suggests that you do not use this value.

## ◆ minBitrate

int io.agora.rtc2.video.VideoEncoderConfiguration.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.

Note
  This parameter only applies to the interactive streaming profile.

## ◆ orientationMode

ORIENTATION_MODE io.agora.rtc2.video.VideoEncoderConfiguration.orientationMode

The orientation mode of the encoded video. See `ORIENTATION_MODE`.

## ◆ degradationPrefer

DEGRADATION_PREFERENCE io.agora.rtc2.video.VideoEncoderConfiguration.degradationPrefer

Video degradation preference under limited bandwidth. See `DEGRADATION_PREFERENCE`.

Note
  When this parameter is set to MAINTAIN_FRAMERATE (1) or MAINTAIN_BALANCED (2), `orientationMode` needs to be set to ORIENTATION_MODE_ADAPTIVE (0) at the same time, otherwise the setting will not take effect.

## ◆ mirrorMode

MIRROR_MODE_TYPE io.agora.rtc2.video.VideoEncoderConfiguration.mirrorMode

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

- VIDEO_MIRROR_MODE_AUTO (0): The SDK determines whether to enable the mirror mode. The SDK disables mirror mode by default.
- VIDEO_MIRROR_MODE_ENABLED (1): Enables the mirror mode for remote users.
- VIDEO_MIRROR_MODE_DISABLED (2): Disables the mirror mode for remote users.
  Note
    By default, the video is not mirrored.

## ◆ advanceOptions

AdvanceOptions io.agora.rtc2.video.VideoEncoderConfiguration.advanceOptions

Advanced options for video encoding. See `AdvanceOptions`.

## ◆ codecType

VIDEO_CODEC_TYPE io.agora.rtc2.video.VideoEncoderConfiguration.codecType

The codec type of the local video stream. See `VIDEO_CODEC_TYPE`.