public final class

VideoEncoderSettings.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.transformer.VideoEncoderSettings.Builder

Overview

Builds VideoEncoderSettings instances.

Summary

Constructors
publicBuilder()

Creates a new instance.

Methods
public VideoEncoderSettingsbuild()

Builds the instance.

public VideoEncoderSettings.BuilderexperimentalSetEnableHighQualityTargeting(boolean enableHighQualityTargeting)

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

public VideoEncoderSettings.BuildersetBitrate(int bitrate)

Sets VideoEncoderSettings.bitrate.

public VideoEncoderSettings.BuildersetBitrateMode(int bitrateMode)

Sets VideoEncoderSettings.bitrateMode.

public VideoEncoderSettings.BuildersetEncoderPerformanceParameters(int operatingRate, int priority)

Sets encoding operating rate and priority.

public VideoEncoderSettings.BuildersetEncodingProfileLevel(int encodingProfile, int encodingLevel)

Sets VideoEncoderSettings.profile and VideoEncoderSettings.level.

public VideoEncoderSettings.BuildersetiFrameIntervalSeconds(float iFrameIntervalSeconds)

Sets VideoEncoderSettings.iFrameIntervalSeconds.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Creates a new instance.

Methods

public VideoEncoderSettings.Builder setBitrate(int bitrate)

Sets VideoEncoderSettings.bitrate. The default value is VideoEncoderSettings.NO_VALUE.

Can not be set if enabling VideoEncoderSettings.Builder.experimentalSetEnableHighQualityTargeting(boolean).

Parameters:

bitrate: The VideoEncoderSettings.bitrate in bits per second.

Returns:

This builder.

public VideoEncoderSettings.Builder setBitrateMode(int bitrateMode)

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

Value must be in VideoEncoderSettings.BitrateMode.

Parameters:

bitrateMode: The VideoEncoderSettings.bitrateMode.

Returns:

This builder.

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

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

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

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

Parameters:

encodingProfile: The VideoEncoderSettings.profile.
encodingLevel: The VideoEncoderSettings.level.

Returns:

This builder.

public VideoEncoderSettings.Builder setiFrameIntervalSeconds(float iFrameIntervalSeconds)

Sets VideoEncoderSettings.iFrameIntervalSeconds. The default value is VideoEncoderSettings.DEFAULT_I_FRAME_INTERVAL_SECONDS.

Parameters:

iFrameIntervalSeconds: The VideoEncoderSettings.iFrameIntervalSeconds.

Returns:

This builder.

public VideoEncoderSettings.Builder setEncoderPerformanceParameters(int operatingRate, int priority)

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

Parameters:

operatingRate: The in frames per second.
priority: The .

Returns:

This builder.

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 .

Can not be enabled alongside setting a custom bitrate with VideoEncoderSettings.Builder.setBitrate(int).

public VideoEncoderSettings build()

Builds the instance.