> Documentation index: https://developer.android.com/reference/llms.txt

# VideoEncoderConstraints

Artifact: [androidx.media3:media3-transformer](https://developer.android.com/jetpack/androidx/releases/media3.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/media3/transformer/codecdb/VideoEncoderConstraints.java+class:androidx.media3.transformer.codecdb.VideoEncoderConstraints)

*** ** * ** ***


```
@ExperimentalApi
class VideoEncoderConstraints
```

<br />

*** ** * ** ***

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 |
|---|
| `class VideoEncoderConstraints.Builder` Builder for `VideoEncoderConstraints` instances. |

| ### Constants |
|---|---|
| `const Int` | `QUALITY_LEVEL_ACCEPTABLE = 76` Target quality level representing acceptable quality (VMAF 76). |
| `const Int` | `QUALITY_LEVEL_GOOD = 82` Target quality level representing good quality (VMAF 82). |
| `const Int` | `QUALITY_LEVEL_MINIMUM = 70` Target quality level representing the minimum recommended quality (VMAF 70). |
| `const Int` | `QUALITY_LEVEL_NEAR_LOSSLESS = 94` Target quality level representing near-lossless quality (VMAF 94). |
| `const Int` | `QUALITY_LEVEL_VERY_GOOD = 88` Target quality level representing very good quality (VMAF 88). |

| ### Public functions |
|---|---|
| `VideoEncoderConstraints.Builder!` | `buildUpon()` Returns a `Builder` initialized with the values of this instance. |
| `Boolean` | `equals(o: Any?)` |
| `Int` | `hashCode()` |
| `String!` | `toString()` |

| ### Public properties |
|---|---|
| `Int` | `@C.VideoCodecFlags allowedCodecs` The set of `C.VideoCodecFlags` that are allowed. |
| `Boolean` | `bFramesAllowed` Whether B-frames are allowed for the content to be encoded. |
| `Int` | `bitDepth` The bit depth of the content to be encoded. |
| `Int` | `@VideoEncoderSettings.BitrateMode bitrateMode` The required bitrate mode for the encoder. |
| `Double` | `frameRate` The user-specified frame rate of the content to be encoded in frames per second. |
| `Int` | `height` The user-specified height of the content to be encoded in pixels. |
| `Float` | `keyFrameIntervalSeconds` The desired key-frame interval to be set in the encoder, in seconds. |
| `Int` | `maxBitrate` The maximum bitrate in bits per second, or `NO_VALUE` if unset. |
| `Double` | `targetQuality` The target quality as a VMAF score in (0, 100\], or `NO_VALUE` if unset. |
| `Int` | `width` The user-specified width of the content to be encoded in pixels. |

## Constants

### QUALITY_LEVEL_ACCEPTABLE

```
const val QUALITY_LEVEL_ACCEPTABLE = 76: Int
```

Target quality level representing acceptable quality (VMAF 76).

Recommended when bitrate or file size is a concern.

### QUALITY_LEVEL_GOOD

```
const val QUALITY_LEVEL_GOOD = 82: Int
```

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

```
const val QUALITY_LEVEL_MINIMUM = 70: Int
```

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

Use this level only when bitrate is constrained.

### QUALITY_LEVEL_NEAR_LOSSLESS

```
const val QUALITY_LEVEL_NEAR_LOSSLESS = 94: Int
```

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

Recommended for camera capture or archival.

### QUALITY_LEVEL_VERY_GOOD

```
const val QUALITY_LEVEL_VERY_GOOD = 88: Int
```

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

Balances visual fidelity and file size.

## Public functions

### buildUpon

```
fun buildUpon(): VideoEncoderConstraints.Builder!
```

Returns a `Builder` initialized with the values of this instance.

### equals

```
fun equals(o: Any?): Boolean
```

### hashCode

```
fun hashCode(): Int
```

### toString

```
fun toString(): String!
```

## Public properties

### allowedCodecs

```
@C.VideoCodecFlags
val allowedCodecs: Int
```

The set of `C.VideoCodecFlags` that are allowed.

### bFramesAllowed

```
val bFramesAllowed: Boolean
```

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

### bitDepth

```
val bitDepth: Int
```

The bit depth of the content to be encoded.

### bitrateMode

```
@VideoEncoderSettings.BitrateMode
val bitrateMode: Int
```

The required bitrate mode for the encoder.

### frameRate

```
val frameRate: Double
```

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

### height

```
val height: Int
```

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

### keyFrameIntervalSeconds

```
val keyFrameIntervalSeconds: Float
```

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

### maxBitrate

```
val maxBitrate: Int
```

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

Exactly one of `targetQuality` and `maxBitrate` is set.

### targetQuality

```
val targetQuality: Double
```

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

Exactly one of `targetQuality` and `maxBitrate` is set.

### width

```
val width: Int
```

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