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

Sets bitrate.

VideoEncoderSettings.Builder

Sets bitrateMode.

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

Sets encoding operating rate and priority.

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

Sets profile and level.

VideoEncoderSettings.Builder

Sets the maximum number of B frames allowed between I or P frames in the produced video.

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
setTemporalLayers(
    int numNonBidirectionalLayers,
    int numBidirectionalLayers
)

Sets the number of temporal layers to request from the video encoder.

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.

setBitrate

@CanIgnoreReturnValue
public VideoEncoderSettings.Builder setBitrate(int bitrate)

Sets bitrate. The default value is NO_VALUE.

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
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.

setMaxBFrames

@CanIgnoreReturnValue
public VideoEncoderSettings.Builder setMaxBFrames(int maxBFrames)

Sets the maximum number of B frames allowed between I or P frames in the produced video. The default value is NO_VALUE which means that B frame encoding is disabled.

Parameters
int maxBFrames

the maximum number of B frames allowed.

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.

setTemporalLayers

@CanIgnoreReturnValue
public VideoEncoderSettings.Builder setTemporalLayers(
    int numNonBidirectionalLayers,
    int numBidirectionalLayers
)

Sets the number of temporal layers to request from the video encoder.

The default value for both parameters is NO_VALUE which indicates that no temporal layering schema will be set for the encoder.

Parameters
int numNonBidirectionalLayers

the number of predictive layers to have. This value must be stricly positive. A value of '0' explicitly requests no temporal layers from the encoder, regardless of the requested 'numBidirectionalLayers'.

int numBidirectionalLayers

the number of bi-directional layers to have. This value must be greater than or equal to zero. A value greater than 1 constructs a hierarchical-B coding structure.

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.