VideoEncoderSettings.Builder


public final class VideoEncoderSettings.Builder


Builds VideoEncoderSettings instances.

Summary

Public constructors

Creates a new instance.

Public methods

VideoEncoderSettings

Builds the instance.

VideoEncoderSettings.Builder
@CanIgnoreReturnValue
experimentalSetEnableHighQualityTargeting(
    boolean enableHighQualityTargeting
)

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(int encodingProfile, int encodingLevel)

Sets profile and level.

VideoEncoderSettings.Builder
@CanIgnoreReturnValue
setRepeatPreviousFrameIntervalUs(long repeatPreviousFrameIntervalUs)

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
@CanIgnoreReturnValue
setiFrameIntervalSeconds(float iFrameIntervalSeconds)

Sets iFrameIntervalSeconds.

Public constructors

Builder

public Builder()

Creates a new instance.

Public methods

build

public VideoEncoderSettings build()

Builds the instance.

experimentalSetEnableHighQualityTargeting

@CanIgnoreReturnValue
public VideoEncoderSettings.Builder experimentalSetEnableHighQualityTargeting(
    boolean enableHighQualityTargeting
)

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
public VideoEncoderSettings.Builder setBitrate(int bitrate)

Sets bitrate. The default value is NO_VALUE.

Can not be set if enabling experimentalSetEnableHighQualityTargeting.

Parameters
int bitrate

The bitrate in bits per second.

Returns
VideoEncoderSettings.Builder

This builder.

setBitrateMode

@CanIgnoreReturnValue
public VideoEncoderSettings.Builder setBitrateMode(@VideoEncoderSettings.BitrateMode int bitrateMode)

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

Value must be in BitrateMode.

Parameters
@VideoEncoderSettings.BitrateMode int bitrateMode

The bitrateMode.

Returns
VideoEncoderSettings.Builder

This builder.

setEncoderPerformanceParameters

@CanIgnoreReturnValue
@VisibleForTesting
public VideoEncoderSettings.Builder setEncoderPerformanceParameters(int operatingRate, int priority)

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
int operatingRate

The operating rate in frames per second.

int priority

The priority.

Returns
VideoEncoderSettings.Builder

This builder.

setEncodingProfileLevel

@CanIgnoreReturnValue
public VideoEncoderSettings.Builder setEncodingProfileLevel(int encodingProfile, int encodingLevel)

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
int encodingProfile

The profile.

int encodingLevel

The level.

Returns
VideoEncoderSettings.Builder

This builder.

setRepeatPreviousFrameIntervalUs

@CanIgnoreReturnValue
public VideoEncoderSettings.Builder setRepeatPreviousFrameIntervalUs(long repeatPreviousFrameIntervalUs)

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
long repeatPreviousFrameIntervalUs

The frame repeat interval, in microseconds.

Returns
VideoEncoderSettings.Builder

This builder.

setiFrameIntervalSeconds

@CanIgnoreReturnValue
public VideoEncoderSettings.Builder setiFrameIntervalSeconds(float iFrameIntervalSeconds)

Sets iFrameIntervalSeconds. The default value is DEFAULT_I_FRAME_INTERVAL_SECONDS.

Parameters
float iFrameIntervalSeconds

The iFrameIntervalSeconds.

Returns
VideoEncoderSettings.Builder

This builder.