VideoEncoderConstraints


@ExperimentalApi
public final class VideoEncoderConstraints


Immutable set of user-provided constraints that CodecDB can optimize around.

VideoEncoderConstraintsPresets provides instances with presets for common encoding use cases. Callers can override individual constraints via buildUpon.

Summary

Nested types

Builder for VideoEncoderConstraints instances.

Constants

static final int

Target quality level representing acceptable quality (VMAF 76).

static final int

Target quality level representing good quality (VMAF 82).

static final int

Target quality level representing the minimum recommended quality (VMAF 70).

static final int

Target quality level representing near-lossless quality (VMAF 94).

static final int

Target quality level representing very good quality (VMAF 88).

Public fields

final int

The set of C.VideoCodecFlags that are allowed.

final boolean

Whether B-frames are allowed for the content to be encoded.

final int

The bit depth of the content to be encoded.

final int

The required bitrate mode for the encoder.

final double

The user-specified frame rate of the content to be encoded in frames per second.

final int

The user-specified height of the content to be encoded in pixels.

final float

The desired key-frame interval to be set in the encoder, in seconds.

final int

The maximum bitrate in bits per second, or NO_VALUE if unset.

final double

The target quality as a VMAF score in (0, 100], or NO_VALUE if unset.

final int

The user-specified width of the content to be encoded in pixels.

Public methods

VideoEncoderConstraints.Builder

Returns a Builder initialized with the values of this instance.

boolean
int
String

Constants

QUALITY_LEVEL_ACCEPTABLE

public static final int QUALITY_LEVEL_ACCEPTABLE = 76

Target quality level representing acceptable quality (VMAF 76).

Recommended when bitrate or file size is a concern.

QUALITY_LEVEL_GOOD

public static final int QUALITY_LEVEL_GOOD = 82

Target quality level representing good quality (VMAF 82).

Recommended for content exported to the device gallery or high-quality social media uploads.

QUALITY_LEVEL_MINIMUM

public static final int QUALITY_LEVEL_MINIMUM = 70

Target quality level representing the minimum recommended quality (VMAF 70).

Use this level only when bitrate is constrained.

QUALITY_LEVEL_NEAR_LOSSLESS

public static final int QUALITY_LEVEL_NEAR_LOSSLESS = 94

Target quality level representing near-lossless quality (VMAF 94).

Recommended for camera capture or archival.

QUALITY_LEVEL_VERY_GOOD

public static final int QUALITY_LEVEL_VERY_GOOD = 88

Target quality level representing very good quality (VMAF 88).

Balances visual fidelity and file size.

Public fields

allowedCodecs

@C.VideoCodecFlags
public final int allowedCodecs

The set of C.VideoCodecFlags that are allowed.

bFramesAllowed

public final boolean bFramesAllowed

Whether B-frames are allowed for the content to be encoded.

bitDepth

public final int bitDepth

The bit depth of the content to be encoded.

bitrateMode

@VideoEncoderSettings.BitrateMode
public final int bitrateMode

The required bitrate mode for the encoder.

frameRate

public final double frameRate

The user-specified frame rate of the content to be encoded in frames per second.

height

public final int height

The user-specified height of the content to be encoded in pixels.

keyFrameIntervalSeconds

public final float keyFrameIntervalSeconds

The desired key-frame interval to be set in the encoder, in seconds.

maxBitrate

public final int maxBitrate

The maximum bitrate in bits per second, or NO_VALUE if unset.

Exactly one of targetQuality and maxBitrate is set.

targetQuality

public final double targetQuality

The target quality as a VMAF score in (0, 100], or NO_VALUE if unset.

Exactly one of targetQuality and maxBitrate is set.

width

public final int width

The user-specified width of the content to be encoded in pixels.

Public methods

buildUpon

public VideoEncoderConstraints.Builder buildUpon()

Returns a Builder initialized with the values of this instance.

equals

public boolean equals(@Nullable Object o)

hashCode

public int hashCode()

toString

public String toString()