VideoEncoderSettings.Builder


class VideoEncoderSettings.Builder


Builds VideoEncoderSettings instances.

Summary

Public constructors

Creates a new instance.

Public functions

VideoEncoderSettings!

Builds the instance.

VideoEncoderSettings.Builder!

Sets whether to enable automatic adjustment of the bitrate to target a high quality encoding.

VideoEncoderSettings.Builder!

Sets bitrate.

VideoEncoderSettings.Builder!

Sets bitrateMode.

VideoEncoderSettings.Builder!

Sets encoding operating rate and priority.

VideoEncoderSettings.Builder!
@CanIgnoreReturnValue
setEncodingProfileLevel(encodingProfile: Int, encodingLevel: Int)

Sets profile and level.

VideoEncoderSettings.Builder!

Sets the threshold duration between input frames beyond which to repeat the previous frame if no new frame has been received, in microseconds.

VideoEncoderSettings.Builder!

Sets iFrameIntervalSeconds.

Public constructors

Builder

Builder()

Creates a new instance.

Public functions

build

fun build(): VideoEncoderSettings!

Builds the instance.

experimentalSetEnableHighQualityTargeting

@CanIgnoreReturnValue
fun experimentalSetEnableHighQualityTargeting(
    enableHighQualityTargeting: Boolean
): VideoEncoderSettings.Builder!

Sets whether to enable automatic adjustment of the bitrate to target a high quality encoding.

This method is experimental and may be removed or changed without warning.

Default value is false.

Requires BITRATE_MODE_VBR.

Can not be enabled alongside setting a custom bitrate with setBitrate.

setBitrate

@CanIgnoreReturnValue
fun setBitrate(bitrate: Int): VideoEncoderSettings.Builder!

Sets bitrate. The default value is NO_VALUE.

Can not be set if enabling experimentalSetEnableHighQualityTargeting.

Parameters
bitrate: Int

The bitrate in bits per second.

Returns
VideoEncoderSettings.Builder!

This builder.

setBitrateMode

@CanIgnoreReturnValue
fun setBitrateMode(@VideoEncoderSettings.BitrateMode bitrateMode: Int): VideoEncoderSettings.Builder!

Sets bitrateMode. The default value is MediaCodecInfo.EncoderCapabilities.BITRATE_MODE_VBR.

Value must be in BitrateMode.

Parameters
@VideoEncoderSettings.BitrateMode bitrateMode: Int

The bitrateMode.

Returns
VideoEncoderSettings.Builder!

This builder.

setEncoderPerformanceParameters

@CanIgnoreReturnValue
@VisibleForTesting
fun setEncoderPerformanceParameters(operatingRate: Int, priority: Int): VideoEncoderSettings.Builder!

Sets encoding operating rate and priority. The default values are NO_VALUE, which is treated as configuring the encoder for maximum throughput.

To disable the configuration for either operating rate or priority, use RATE_UNSET for that argument.

Parameters
operatingRate: Int

The operating rate in frames per second.

priority: Int

The priority.

Returns
VideoEncoderSettings.Builder!

This builder.

setEncodingProfileLevel

@CanIgnoreReturnValue
fun setEncodingProfileLevel(encodingProfile: Int, encodingLevel: Int): VideoEncoderSettings.Builder!

Sets profile and level. The default values are both NO_VALUE.

The value must be one of the values defined in MediaCodecInfo.CodecProfileLevel, or NO_VALUE.

Profile settings will be ignored when using DefaultEncoderFactory and encoding to H264.

Parameters
encodingProfile: Int

The profile.

encodingLevel: Int

The level.

Returns
VideoEncoderSettings.Builder!

This builder.

setRepeatPreviousFrameIntervalUs

@CanIgnoreReturnValue
fun setRepeatPreviousFrameIntervalUs(repeatPreviousFrameIntervalUs: Long): VideoEncoderSettings.Builder!

Sets the threshold duration between input frames beyond which to repeat the previous frame if no new frame has been received, in microseconds. The default value is NO_VALUE, which means that frames are not automatically repeated.

Parameters
repeatPreviousFrameIntervalUs: Long

The frame repeat interval, in microseconds.

Returns
VideoEncoderSettings.Builder!

This builder.

setiFrameIntervalSeconds

@CanIgnoreReturnValue
fun setiFrameIntervalSeconds(iFrameIntervalSeconds: Float): VideoEncoderSettings.Builder!

Sets iFrameIntervalSeconds. The default value is DEFAULT_I_FRAME_INTERVAL_SECONDS.

Parameters
iFrameIntervalSeconds: Float

The iFrameIntervalSeconds.

Returns
VideoEncoderSettings.Builder!

This builder.