VideoEncoderConfiguration
Video encoder configurations.
public class VideoEncoderConfiguration { public VIDEO_CODEC_TYPE codecType; public VideoDimensions dimensions; public int frameRate; public int bitrate; public int minBitrate; public ORIENTATION_MODE orientationMode; public DEGRADATION_PREFERENCE degradationPreference; public VIDEO_MIRROR_MODE_TYPE mirrorMode; public AdvanceOptions advanceOptions; public VideoEncoderConfiguration(VideoDimensions d, int f, int b, ORIENTATION_MODE m, VIDEO_MIRROR_MODE_TYPE mirror = VIDEO_MIRROR_MODE_TYPE.VIDEO_MIRROR_MODE_DISABLED) { this.codecType = VIDEO_CODEC_TYPE.VIDEO_CODEC_NONE; this.dimensions = d; this.frameRate = f; this.bitrate = b; this.minBitrate = (int)BITRATE.DEFAULT_MIN_BITRATE; this.orientationMode = m; this.degradationPreference = DEGRADATION_PREFERENCE.MAINTAIN_QUALITY; this.mirrorMode = mirror; this.advanceOptions = new AdvanceOptions(ENCODING_PREFERENCE.PREFER_AUTO, COMPRESSION_PREFERENCE.PREFER_LOW_LATENCY); } public VideoEncoderConfiguration(int width, int height, int f, int b, ORIENTATION_MODE m, VIDEO_MIRROR_MODE_TYPE mirror = VIDEO_MIRROR_MODE_TYPE.VIDEO_MIRROR_MODE_DISABLED) { this.codecType = VIDEO_CODEC_TYPE.VIDEO_CODEC_NONE; this.dimensions = new VideoDimensions(width, height); this.frameRate = f; this.bitrate = b; this.minBitrate = (int)BITRATE.DEFAULT_MIN_BITRATE; this.orientationMode = m; this.degradationPreference = DEGRADATION_PREFERENCE.MAINTAIN_QUALITY; this.mirrorMode = mirror; this.advanceOptions = new AdvanceOptions(ENCODING_PREFERENCE.PREFER_AUTO, COMPRESSION_PREFERENCE.PREFER_LOW_LATENCY); } public VideoEncoderConfiguration(VideoEncoderConfiguration config) { this.codecType = config.codecType; this.dimensions = config.dimensions; this.frameRate = config.frameRate; this.bitrate = config.bitrate; this.minBitrate = config.minBitrate; this.orientationMode = config.orientationMode; this.degradationPreference = config.degradationPreference; this.mirrorMode = config.mirrorMode; this.advanceOptions = config.advanceOptions; } public VideoEncoderConfiguration() { this.codecType = VIDEO_CODEC_TYPE.VIDEO_CODEC_NONE; this.dimensions = new VideoDimensions((int)FRAME_WIDTH.FRAME_WIDTH_960, (int)FRAME_HEIGHT.FRAME_HEIGHT_540); this.frameRate = (int)FRAME_RATE.FRAME_RATE_FPS_15; this.bitrate = (int)BITRATE.STANDARD_BITRATE; this.minBitrate = (int)BITRATE.DEFAULT_MIN_BITRATE; this.orientationMode = ORIENTATION_MODE.ORIENTATION_MODE_ADAPTIVE; this.degradationPreference = DEGRADATION_PREFERENCE.MAINTAIN_QUALITY; this.mirrorMode = VIDEO_MIRROR_MODE_TYPE.VIDEO_MIRROR_MODE_DISABLED; this.advanceOptions = new AdvanceOptions(ENCODING_PREFERENCE.PREFER_AUTO, COMPRESSION_PREFERENCE.PREFER_LOW_LATENCY); } public 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) { this.codecType = codecType; this.dimensions = dimensions; this.frameRate = frameRate; this.bitrate = bitrate; this.minBitrate = minBitrate; this.orientationMode = orientationMode; this.degradationPreference = degradationPreference; this.mirrorMode = mirrorMode; this.advanceOptions = advanceOptions; } }
Attributes
- 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. See BITRATE.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.
- 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.Attention: 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
-
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.