Agora Java API Reference for Android
io.agora.rtc.video.VideoEncoderConfiguration Class Reference

Classes

enum  DEGRADATION_PREFERENCE
 
enum  FRAME_RATE
 
enum  ORIENTATION_MODE
 
class  VideoDimensions
 

Public Member Functions

 VideoEncoderConfiguration (VideoDimensions dimensions, FRAME_RATE frameRate, int bitrate, ORIENTATION_MODE orientationMode)
 
 VideoEncoderConfiguration (int width, int height, FRAME_RATE frameRate, int bitrate, ORIENTATION_MODE orientationMode)
 

Public Attributes

VideoDimensions dimensions
 
int frameRate
 
int minFrameRate
 
int bitrate
 
int minBitrate
 
ORIENTATION_MODE orientationMode
 
DEGRADATION_PREFERENCE degradationPrefer
 
int mirrorMode
 

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_960x720 = new VideoDimensions(960, 720)
 
static final VideoDimensions VD_1280x720 = new VideoDimensions(1280, 720)
 
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
 

Detailed Description

Member Data Documentation

◆ VD_120x120

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

VD_120x120: The video resolution is 120 × 120.

◆ VD_160x120

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

VD_160x120: The video resolution is 160 × 120.

◆ VD_180x180

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

VD_180x180: The video resolution is 180 × 180.

◆ VD_240x180

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

VD_240x180: The video resolution is 240 × 180.

◆ VD_320x180

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

VD_320x180: The video resolution is 320 × 180.

◆ VD_240x240

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

VD_240x240: The video resolution is 240 × 240.

◆ VD_320x240

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

VD_320x240: The video resolution is 320 × 240.

◆ VD_424x240

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

VD_424x240: The video resolution is 424 × 240.

◆ VD_360x360

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

VD_360x360: The video resolution is 360 × 360.

◆ VD_480x360

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

VD_480x360: The video resolution is 480 × 360.

◆ VD_640x360

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

VD_640x360: The video resolution is 640 × 360.

◆ VD_480x480

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

VD_480x480: The video resolution is 480 × 480.

◆ VD_640x480

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

VD_640x480: The video resolution is 640 × 480.

◆ VD_840x480

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

VD_840x480: The video resolution is 840 × 480.

◆ VD_960x720

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

VD_960x720: The video resolution is 640 × 360.

◆ VD_1280x720

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

VD_1280x720: The video resolution is 640 × 360.

◆ STANDARD_BITRATE

final int io.agora.rtc.video.VideoEncoderConfiguration.STANDARD_BITRATE = 0
static

The standard bitrate mode. In this mode, the bitrates under the LIVE_BROADCASTING and COMMUNICATION profiles differ:

  • In the COMMUNICATION profile, the video bitrate is the same as the base bitrate.
  • In the LIVE_BROADCASTING profile, the video bitrate is twice the base bitrate.

◆ COMPATIBLE_BITRATE

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

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

◆ DEFAULT_MIN_BITRATE

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

Use the default minimum bitrate.

◆ DEFAULT_MIN_FRAMERATE

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

The default minimum frame rate.

◆ dimensions

VideoDimensions io.agora.rtc.video.VideoEncoderConfiguration.dimensions

The video frame dimensions (px), which is used to specify the video quality and measured by the total number of pixels along a frame's width and height. The default value is 640 × 360. Users can either set the resolution manually or choose from the following options:

Note
  • The value of the dimension does not indicate the orientation mode of the output ratio. For how to set the video orientation, see ORIENTATION_MODE.
  • Whether 720p+ can be supported depends on the device. If the device cannot support 720p, the frame rate will be lower than the one listed in the table.

◆ frameRate

int io.agora.rtc.video.VideoEncoderConfiguration.frameRate

The video frame rate (fps). The default value is 15. Users can either set the frame rate manually or choose from the following options. We do not recommend setting this to a value greater than 30.

◆ minFrameRate

int io.agora.rtc.video.VideoEncoderConfiguration.minFrameRate

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

Since
v2.4.0.

For information on scenarios and considerations, see Set the Video Profile Under Advanced Guides.

◆ bitrate

int io.agora.rtc.video.VideoEncoderConfiguration.bitrate

Bitrate of the video (Kbps). Refer to the table below and set your bitrate. If you set a bitrate beyond the proper range, the SDK automatically adjusts it to a value within the range. You can also choose from the following options:

  • STANDARD_BITRATE = 0: (Recommended) The standard bitrate mode. In this mode, the bitrates differ between the LIVE_BROADCASTING and COMMUNICATION profiles:
    • In the COMMUNICATION profile, the video bitrate is the same as the base bitrate.
    • In the LIVE_BROADCASTING profile, the video bitrate is twice the base bitrate.
  • COMPATIBLE_BITRATE = -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_BROADCASTING profile, the video frame rate may be lower than the set value.

Agora uses different video codecs for different profiles to optimize the user experience. For example, the Communication profile prioritizes the smoothness while the LIVE_BROADCASTING profile prioritizes the video quality (a higher bitrate). Therefore, We recommend setting this parameter as STANDARD_BITRATE = 0.

Video Bitrate Table

Resolution Frame rate<p>(fps) Base Bitrate<p>(Kbps, for Communication) Live Bitrate<p>(Kbps, for Live Broadcasting)
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
The base bitrate in this table applies to the Communication profile. The LIVE_BROADCASTING profile generally requires a higher bitrate for better video quality. We recommend setting the bitrate mode as STANDARD_BITRATE = 0. You can also set the bitrate as the base bitrate value × 2.

◆ minBitrate

int io.agora.rtc.video.VideoEncoderConfiguration.minBitrate
Since
v2.3.2.

The minimum encoding bitrate (Kbps). The Agora 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 hence sacrifice the smoothness of the video transmission. That said, unless you have special requirements for image quality, Agora does not recommend changing this value.

Note
This parameter applies to the LIVE_BROADCASTING profile only.

◆ orientationMode

ORIENTATION_MODE io.agora.rtc.video.VideoEncoderConfiguration.orientationMode

The orientation mode. See ORIENTATION_MODE.

◆ degradationPrefer

DEGRADATION_PREFERENCE io.agora.rtc.video.VideoEncoderConfiguration.degradationPrefer

The video encoding degradation preference under limited bandwidth:

Since
v2.4.0.

For detailed information on the preference, see DEGRADATION_PREFERENCE.

◆ mirrorMode

int io.agora.rtc.video.VideoEncoderConfiguration.mirrorMode

Sets the mirror mode of the published local video stream.

Since
v3.0.0.

This member only affects the video that the remote user sees.

  • VIDEO_MIRROR_MODE_AUTO(0): (Default) The mirror mode determined by the SDK. By default, the SDK disables the mirror mode for the remote video.
  • VIDEO_MIRROR_MODE_ENABLED(1): Enable the mirror mode.
  • VIDEO_MIRROR_MODE_DISABLED(2): Disable the mirror mode.