# AudioEncoderSettings.Builder

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

*** ** * ** ***


```
public final class AudioEncoderSettings.Builder
```

<br />

*** ** * ** ***

Builds `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings` instances.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings.Builder#Builder()()` Creates a new instance. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings` | `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings.Builder#build()()` Builds the instance. |
| `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings.Builder#setBitrate(int)(int bitrate)` Sets the `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings#bitrate()`. |
| `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings.Builder` | `@https://checkerframework.org/api/com/google/errorprone/annotations/CanIgnoreReturnValue.html https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings.Builder#setProfile(int)(int profile)` Sets the `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings#profile()`. |

## Public constructors

### Builder

```
public Builder()
```

Creates a new instance.

## Public methods

### build

```
public AudioEncoderSettings build()
```

Builds the instance.

### setBitrate

```
@CanIgnoreReturnValue
public AudioEncoderSettings.Builder setBitrate(int bitrate)
```

Sets the `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings#bitrate()`.

The default value is `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings#NO_VALUE()`.

The encoder may ignore the requested bitrate to improve the encoding quality.

| Parameters |
|---|---|
| `int bitrate` | The bitrate in bits per second. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings.Builder` | This builder. |

### setProfile

```
@CanIgnoreReturnValue
public AudioEncoderSettings.Builder setProfile(int profile)
```

Sets the `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings#profile()`.

The default value is `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings#NO_VALUE()` and the appropriate profile will be used automatically.

The requested profile must be one of the values defined in `https://developer.android.com/reference/android/media/MediaCodecInfo.CodecProfileLevel.html` and must be compatible with the requested `https://developer.android.com/reference/androidx/media3/transformer/Transformer.Builder#setAudioMimeType(java.lang.String)`. When using the `https://developer.android.com/reference/androidx/media3/transformer/DefaultEncoderFactory`, if the encoder does not support the requested profile, then it will be ignored to avoid any encoder configuration failures.

| Parameters |
|---|---|
| `int profile` | The profile. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/transformer/AudioEncoderSettings.Builder` | This builder. |