# Format

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

*** ** * ** ***


```
public final class Format
```

<br />

*** ** * ** ***

Represents a media format.

When building formats, populate all fields whose values are known and relevant to the type of format being constructed. For information about different types of format, see ExoPlayer's [Supported formats page](https://developer.android.com/media/media3/exoplayer/supported-formats).

## Fields commonly relevant to all formats

- `https://developer.android.com/reference/androidx/media3/common/Format#id()`
- `https://developer.android.com/reference/androidx/media3/common/Format#label()`
- `https://developer.android.com/reference/androidx/media3/common/Format#labels()`
- `https://developer.android.com/reference/androidx/media3/common/Format#language()`
- `https://developer.android.com/reference/androidx/media3/common/Format#selectionFlags()`
- `https://developer.android.com/reference/androidx/media3/common/Format#roleFlags()`
- `https://developer.android.com/reference/androidx/media3/common/Format#selectionPriority()`
- `https://developer.android.com/reference/androidx/media3/common/Format#averageBitrate()`
- `https://developer.android.com/reference/androidx/media3/common/Format#peakBitrate()`
- `https://developer.android.com/reference/androidx/media3/common/Format#codecs()`
- `https://developer.android.com/reference/androidx/media3/common/Format#metadata()`

## Fields relevant to container formats

- `https://developer.android.com/reference/androidx/media3/common/Format#containerMimeType()`
- If the container only contains a single media track, [fields relevant to sample formats](https://developer.android.com/reference/androidx/media3/common/Format#sample-formats) can are also be relevant and can be set to describe the sample format of that track.
- If the container only contains one track of a given type (possibly alongside tracks of other types), then fields relevant to that track type can be set to describe the properties of the track. See the sections below for [video](https://developer.android.com/reference/androidx/media3/common/Format#video-formats), [audio](https://developer.android.com/reference/androidx/media3/common/Format#audio-formats) and [text](https://developer.android.com/reference/androidx/media3/common/Format#text-formats) formats.

## Fields relevant to sample formats

- `https://developer.android.com/reference/androidx/media3/common/Format#sampleMimeType()`
- `https://developer.android.com/reference/androidx/media3/common/Format#maxInputSize()`
- `https://developer.android.com/reference/androidx/media3/common/Format#initializationData()`
- `https://developer.android.com/reference/androidx/media3/common/Format#drmInitData()`
- `https://developer.android.com/reference/androidx/media3/common/Format#subsampleOffsetUs()`
- Fields relevant to the sample format's track type are also relevant. See the sections below for [video](https://developer.android.com/reference/androidx/media3/common/Format#video-formats), [audio](https://developer.android.com/reference/androidx/media3/common/Format#audio-formats) and [text](https://developer.android.com/reference/androidx/media3/common/Format#text-formats) formats.

## Fields relevant to video formats

- `https://developer.android.com/reference/androidx/media3/common/Format#width()`
- `https://developer.android.com/reference/androidx/media3/common/Format#height()`
- `https://developer.android.com/reference/androidx/media3/common/Format#decodedWidth()`
- `https://developer.android.com/reference/androidx/media3/common/Format#decodedHeight()`
- `https://developer.android.com/reference/androidx/media3/common/Format#frameRate()`
- `https://developer.android.com/reference/androidx/media3/common/Format#rotationDegrees()`
- `https://developer.android.com/reference/androidx/media3/common/Format#mirrorHorizontal()`
- `https://developer.android.com/reference/androidx/media3/common/Format#pixelWidthHeightRatio()`
- `https://developer.android.com/reference/androidx/media3/common/Format#projectionData()`
- `https://developer.android.com/reference/androidx/media3/common/Format#stereoMode()`
- `https://developer.android.com/reference/androidx/media3/common/Format#colorInfo()`
- `https://developer.android.com/reference/androidx/media3/common/Format#maxSubLayers()`

## Fields relevant to audio formats

- `https://developer.android.com/reference/androidx/media3/common/Format#channelCount()`
- `https://developer.android.com/reference/androidx/media3/common/Format#channelMask()`
- `https://developer.android.com/reference/androidx/media3/common/Format#sampleRate()`
- `https://developer.android.com/reference/androidx/media3/common/Format#pcmEncoding()`
- `https://developer.android.com/reference/androidx/media3/common/Format#encoderDelay()`
- `https://developer.android.com/reference/androidx/media3/common/Format#encoderPadding()`

## Fields relevant to text formats

- `https://developer.android.com/reference/androidx/media3/common/Format#accessibilityChannel()`

## Fields relevant to image formats

- `https://developer.android.com/reference/androidx/media3/common/Format#tileCountHorizontal()`
- `https://developer.android.com/reference/androidx/media3/common/Format#tileCountVertical()`

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi public final class https://developer.android.com/reference/androidx/media3/common/Format.Builder` Builds `https://developer.android.com/reference/androidx/media3/common/Format` instances. |
| `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/common/Format.CueReplacementBehavior` The replacement behaviors for consecutive samples in a `https://developer.android.com/reference/androidx/media3/common/C#TRACK_TYPE_TEXT()` of type `https://developer.android.com/reference/androidx/media3/common/MimeTypes#APPLICATION_MEDIA3_CUES()`. |

| ### Constants |
|---|---|
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#CUE_REPLACEMENT_BEHAVIOR_MERGE() = 1` Subsequent cues should be merged with any previous cues that should still be shown on screen. |
| `static final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#CUE_REPLACEMENT_BEHAVIOR_REPLACE() = 2` Subsequent cues should replace all previous cues. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE() = -1` A value for various fields to indicate that the field's value is unknown or not applicable. |
| `static final long` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#OFFSET_SAMPLE_RELATIVE() = 9223372036854775807` A value for `https://developer.android.com/reference/androidx/media3/common/Format#subsampleOffsetUs()` to indicate that subsample timestamps are relative to the timestamps of their parent samples. |

| ### Public fields |
|---|---|
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#accessibilityChannel()` The Accessibility channel, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not known or applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/androidx/media3/common/C.AuxiliaryTrackType https://developer.android.com/reference/androidx/media3/common/Format#auxiliaryTrackType()` The auxiliary track type. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#averageBitrate()` The average bitrate in bits per second, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#bitrate()` The bitrate in bits per second. |
| `final int` | `https://developer.android.com/reference/androidx/media3/common/Format#channelCount()` The number of audio channels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#channelMask()` The audio channel mask. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/Format#codecs()` Codecs of the format as described in RFC 6381, or null if unknown or not applicable. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/ColorInfo` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#colorInfo()` The color metadata associated with the video, or null if not applicable. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/Format#containerMimeType()` The MIME type of the container, or null if unknown or not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/androidx/media3/common/C.CryptoType https://developer.android.com/reference/androidx/media3/common/Format#cryptoType()` The type of crypto that must be used to decode samples associated with this format, or `https://developer.android.com/reference/androidx/media3/common/C#CRYPTO_TYPE_NONE()` if the content is not encrypted. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/androidx/media3/common/Format.CueReplacementBehavior https://developer.android.com/reference/androidx/media3/common/Format#cueReplacementBehavior()` The replacement behavior that should be followed when handling consecutive samples in a `https://developer.android.com/reference/androidx/media3/common/C#TRACK_TYPE_TEXT()` of type `https://developer.android.com/reference/androidx/media3/common/MimeTypes#APPLICATION_MEDIA3_CUES()`. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#customData()` An extra opaque object that can be added to the `https://developer.android.com/reference/androidx/media3/common/Format` to provide additional information that can be passed through the player. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#decodedHeight()` The height of the video decoded picture in pixels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#decodedWidth()` The width of the video decoded picture in pixels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/DrmInitData` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#drmInitData()` DRM initialization data if the stream is protected, or null otherwise. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#encoderDelay()` The number of frames to trim from the start of the decoded audio stream, or 0 if not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#encoderPadding()` The number of frames to trim from the end of the decoded audio stream, or 0 if not applicable. |
| `final float` | `https://developer.android.com/reference/androidx/media3/common/Format#frameRate()` The frame rate in frames per second, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final int` | `https://developer.android.com/reference/androidx/media3/common/Format#height()` The height of the video in pixels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/Format#id()` An identifier for the format, or null if unknown or not applicable. |
| `final https://developer.android.com/reference/java/util/List.html<byte[]>` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#initializationData()` Initialization data that must be provided to the decoder. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/Format#label()` The default human readable label, or null if unknown or not applicable. |
| `final https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Label>` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#labels()` The human readable list of labels, or an empty list if unknown or not applicable. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/Format#language()` The language as an IETF BCP 47 conformant tag, or null if unknown or not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#maxInputSize()` The maximum size of a buffer of data (typically one sample), or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#maxNumReorderSamples()` The maximum number of samples that must be stored to correctly re-order samples from decode order to presentation order. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#maxSubLayers()` The maximum number of temporal scalable sub-layers in the video bitstream, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not applicable. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/Metadata` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#metadata()` Metadata, or null if unknown or not applicable. |
| `final boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#mirrorHorizontal()` Whether the video needs to be horizontally mirrored in order to be rendered correctly, or `false` if unknown or not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/C.PcmEncoding https://developer.android.com/reference/androidx/media3/common/Format#pcmEncoding()` The `https://developer.android.com/reference/androidx/media3/common/C.PcmEncoding` for PCM or losslessly compressed audio. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#peakBitrate()` The peak bitrate in bits per second, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#pixelFormat()` The pixel format of the video, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final float` | `https://developer.android.com/reference/androidx/media3/common/Format#pixelWidthHeightRatio()` The width to height ratio of pixels in the video, or 1.0 if unknown or not applicable. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#primaryTrackGroupId()` The `https://developer.android.com/reference/androidx/media3/common/TrackGroup#id()` of the primary `https://developer.android.com/reference/androidx/media3/common/TrackGroup` this format is embedded into. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable byte[]` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#projectionData()` The projection data for 360/VR video, or null if not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/C.RoleFlags https://developer.android.com/reference/androidx/media3/common/Format#roleFlags()` Track role flags. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#rotationDegrees()` The clockwise rotation that should be applied to the video for it to be rendered in the correct orientation, or 0 if unknown or not applicable. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/Format#sampleMimeType()` The sample MIME type, or null if unknown or not applicable. |
| `final int` | `https://developer.android.com/reference/androidx/media3/common/Format#sampleRate()` The audio sampling rate in Hz, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/C.SelectionFlags https://developer.android.com/reference/androidx/media3/common/Format#selectionFlags()` Track selection flags. |
| `final float` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#selectionPriority()` A relative preference among formats in the same `https://developer.android.com/reference/androidx/media3/common/TrackGroup`, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unset. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi @https://developer.android.com/reference/androidx/media3/common/C.StereoMode https://developer.android.com/reference/androidx/media3/common/Format#stereoMode()` The stereo layout for 360/3D/VR video, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not applicable. |
| `final long` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#subsampleOffsetUs()` For samples that contain subsamples, this is an offset that should be added to subsample timestamps. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#tileCountHorizontal()` The number of horizontal tiles in an image, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not known or applicable. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#tileCountVertical()` The number of vertical tiles in an image, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not known or applicable. |
| `final int` | `https://developer.android.com/reference/androidx/media3/common/Format#width()` The width of the video in pixels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Format.Builder` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#buildUpon()()` Returns a `https://developer.android.com/reference/androidx/media3/common/Format.Builder` initialized with the values of this instance. |
| `https://developer.android.com/reference/androidx/media3/common/Format` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#copyWithCryptoType(int)(@https://developer.android.com/reference/androidx/media3/common/C.CryptoType int cryptoType)` Returns a copy of this format with the specified `https://developer.android.com/reference/androidx/media3/common/Format#cryptoType()`. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/common/Format#equals(java.lang.Object)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html obj)` |
| `static https://developer.android.com/reference/androidx/media3/common/Format` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#fromBundle(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle.html bundle)` Restores a `Format` from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `int` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#getPixelCount()()` Returns the number of pixels if this is a video format whose `https://developer.android.com/reference/androidx/media3/common/Format#width()` and `https://developer.android.com/reference/androidx/media3/common/Format#height()` are known, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` otherwise |
| `int` | `https://developer.android.com/reference/androidx/media3/common/Format#hashCode()()` |
| `boolean` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#initializationDataEquals(androidx.media3.common.Format)(https://developer.android.com/reference/androidx/media3/common/Format other)` Returns whether the `https://developer.android.com/reference/androidx/media3/common/Format#initializationData()`s belonging to this format and `other` are equal. |
| `https://developer.android.com/reference/android/os/Bundle.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#toBundle()()` Returns a `https://developer.android.com/reference/android/os/Bundle.html` representing the information stored in this object. |
| `static https://developer.android.com/reference/java/lang/String.html` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#toLogString(androidx.media3.common.Format)(@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/common/Format format)` Returns a prettier `https://developer.android.com/reference/java/lang/String.html` than `https://developer.android.com/reference/androidx/media3/common/Format#toString()`, intended for logging. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/common/Format#toString()()` |
| `https://developer.android.com/reference/androidx/media3/common/Format` | `@https://developer.android.com/reference/androidx/media3/common/util/UnstableApi https://developer.android.com/reference/androidx/media3/common/Format#withManifestFormatInfo(androidx.media3.common.Format)(https://developer.android.com/reference/androidx/media3/common/Format manifestFormat)` |

## Constants

### CUE_REPLACEMENT_BEHAVIOR_MERGE

```
@UnstableApi
public static final int CUE_REPLACEMENT_BEHAVIOR_MERGE = 1
```

Subsequent cues should be merged with any previous cues that should still be shown on screen.

Tracks with this behavior must not contain samples with an `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` duration.

### CUE_REPLACEMENT_BEHAVIOR_REPLACE

```
@UnstableApi
public static final int CUE_REPLACEMENT_BEHAVIOR_REPLACE = 2
```

Subsequent cues should replace all previous cues.

Tracks with this behavior may contain samples with an `https://developer.android.com/reference/androidx/media3/common/C#TIME_UNSET()` duration (but the duration may also be set to a 'real' value).

### NO_VALUE

```
public static final int NO_VALUE = -1
```

A value for various fields to indicate that the field's value is unknown or not applicable.

### OFFSET_SAMPLE_RELATIVE

```
@UnstableApi
public static final long OFFSET_SAMPLE_RELATIVE = 9223372036854775807
```

A value for `https://developer.android.com/reference/androidx/media3/common/Format#subsampleOffsetUs()` to indicate that subsample timestamps are relative to the timestamps of their parent samples.

## Public fields

### accessibilityChannel

```
@UnstableApi
public final int accessibilityChannel
```

The Accessibility channel, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not known or applicable.

### auxiliaryTrackType

```
@UnstableApi
@C.AuxiliaryTrackType
public final int auxiliaryTrackType
```

The auxiliary track type.

### averageBitrate

```
@UnstableApi
public final int averageBitrate
```

The average bitrate in bits per second, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. The way in which this field is populated depends on the type of media to which the format corresponds:

- DASH representations: Always `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`.
- HLS variants: The `AVERAGE-BANDWIDTH` attribute defined on the corresponding `
  EXT-X-STREAM-INF` tag in the multivariant playlist, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not present.
- SmoothStreaming track elements: The `Bitrate` attribute defined on the corresponding `TrackElement` in the manifest, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not present.
- Progressive container formats: Often `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`, but may be populated with the average bitrate of the container if known.
- Sample formats: Often `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`, but may be populated with the average bitrate of the stream of samples with type `https://developer.android.com/reference/androidx/media3/common/Format#sampleMimeType()` if known. Note that if `https://developer.android.com/reference/androidx/media3/common/Format#sampleMimeType()` is a compressed format (e.g., `https://developer.android.com/reference/androidx/media3/common/MimeTypes#AUDIO_AAC()`), then this bitrate is for the stream of still compressed samples.

### bitrate

```
@UnstableApi
public final int bitrate
```

The bitrate in bits per second. This is the peak bitrate if known, or else the average bitrate if known, or else `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`. Equivalent to: `peakBitrate != NO_VALUE ?
peakBitrate : averageBitrate`.

### channelCount

```
public final int channelCount
```

The number of audio channels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

If both `https://developer.android.com/reference/androidx/media3/common/Format#channelCount()` and `https://developer.android.com/reference/androidx/media3/common/Format#channelMask()` are set (i.e. not `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`), they are guaranteed to match, meaning the number of set bits in `https://developer.android.com/reference/androidx/media3/common/Format#channelMask()` equals `https://developer.android.com/reference/androidx/media3/common/Format#channelCount()`.

### channelMask

```
@UnstableApi
public final int channelMask
```

The audio channel mask. Expected to be a bitmask of `https://developer.android.com/reference/android/media/AudioFormat.html``
CHANNEL_OUT_*` constants, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

If both `https://developer.android.com/reference/androidx/media3/common/Format#channelCount()` and `https://developer.android.com/reference/androidx/media3/common/Format#channelMask()` are set (i.e. not `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`), they are guaranteed to match, meaning the number of set bits in `https://developer.android.com/reference/androidx/media3/common/Format#channelMask()` equals `https://developer.android.com/reference/androidx/media3/common/Format#channelCount()`.

### codecs

```
public final @Nullable String codecs
```

Codecs of the format as described in RFC 6381, or null if unknown or not applicable.

### colorInfo

```
@UnstableApi
public final @Nullable ColorInfo colorInfo
```

The color metadata associated with the video, or null if not applicable.

### containerMimeType

```
public final @Nullable String containerMimeType
```

The MIME type of the container, or null if unknown or not applicable.

### cryptoType

```
@UnstableApi
@C.CryptoType
public final int cryptoType
```

The type of crypto that must be used to decode samples associated with this format, or `https://developer.android.com/reference/androidx/media3/common/C#CRYPTO_TYPE_NONE()` if the content is not encrypted. Cannot be `https://developer.android.com/reference/androidx/media3/common/C#CRYPTO_TYPE_NONE()` if `https://developer.android.com/reference/androidx/media3/common/Format#drmInitData()` is non-null, but may be `https://developer.android.com/reference/androidx/media3/common/C#CRYPTO_TYPE_UNSUPPORTED()` to indicate that the samples are encrypted using an unsupported crypto type.

### cueReplacementBehavior

```
@UnstableApi
@Format.CueReplacementBehavior
public final int cueReplacementBehavior
```

The replacement behavior that should be followed when handling consecutive samples in a `https://developer.android.com/reference/androidx/media3/common/C#TRACK_TYPE_TEXT()` of type `https://developer.android.com/reference/androidx/media3/common/MimeTypes#APPLICATION_MEDIA3_CUES()`.

### customData

```
@UnstableApi
public final @Nullable Object customData
```

An extra opaque object that can be added to the `https://developer.android.com/reference/androidx/media3/common/Format` to provide additional information that can be passed through the player.

This value is not included in serialized `https://developer.android.com/reference/android/os/Bundle.html` instances of this class that are used to transfer data to other processes.

### decodedHeight

```
@UnstableApi
public final int decodedHeight
```

The height of the video decoded picture in pixels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

May be larger than `https://developer.android.com/reference/androidx/media3/common/Format#height()` if cropping is applied before display.

### decodedWidth

```
@UnstableApi
public final int decodedWidth
```

The width of the video decoded picture in pixels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

May be larger than `https://developer.android.com/reference/androidx/media3/common/Format#width()` if cropping is applied before display.

### drmInitData

```
@UnstableApi
public final @Nullable DrmInitData drmInitData
```

DRM initialization data if the stream is protected, or null otherwise.

### encoderDelay

```
@UnstableApi
public final int encoderDelay
```

The number of frames to trim from the start of the decoded audio stream, or 0 if not applicable.

### encoderPadding

```
@UnstableApi
public final int encoderPadding
```

The number of frames to trim from the end of the decoded audio stream, or 0 if not applicable.

### frameRate

```
public final float frameRate
```

The frame rate in frames per second, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

If not `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`, the value is guaranteed to be positive.

### height

```
public final int height
```

The height of the video in pixels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

### id

```
public final @Nullable String id
```

An identifier for the format, or null if unknown or not applicable.

### initializationData

```
@UnstableApi
public final List<byte[]> initializationData
```

Initialization data that must be provided to the decoder. Will not be null, but may be empty if initialization data is not required.

### label

```
public final @Nullable String label
```

The default human readable label, or null if unknown or not applicable.

If non-null, the same label will be part of `https://developer.android.com/reference/androidx/media3/common/Format#labels()` too. If null, `https://developer.android.com/reference/androidx/media3/common/Format#labels()` will be empty.

### labels

```
@UnstableApi
public final List<Label> labels
```

The human readable list of labels, or an empty list if unknown or not applicable.

If non-empty, the default `https://developer.android.com/reference/androidx/media3/common/Format#label()` will be part of this list. If empty, the default `https://developer.android.com/reference/androidx/media3/common/Format#label()` will be null.

### language

```
public final @Nullable String language
```

The language as an IETF BCP 47 conformant tag, or null if unknown or not applicable.

### maxInputSize

```
@UnstableApi
public final int maxInputSize
```

The maximum size of a buffer of data (typically one sample), or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

### maxNumReorderSamples

```
@UnstableApi
public final int maxNumReorderSamples
```

The maximum number of samples that must be stored to correctly re-order samples from decode order to presentation order.

### maxSubLayers

```
@UnstableApi
public final int maxSubLayers
```

The maximum number of temporal scalable sub-layers in the video bitstream, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not applicable.

### metadata

```
@UnstableApi
public final @Nullable Metadata metadata
```

Metadata, or null if unknown or not applicable.

### mirrorHorizontal

```
@UnstableApi
public final boolean mirrorHorizontal
```

Whether the video needs to be horizontally mirrored in order to be rendered correctly, or `false` if unknown or not applicable.

### pcmEncoding

```
@C.PcmEncoding
public final int pcmEncoding
```

The `https://developer.android.com/reference/androidx/media3/common/C.PcmEncoding` for PCM or losslessly compressed audio. Set to `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` for other media types.

Value is one of the following:

- `Format.NO_VALUE`

<br />

### peakBitrate

```
@UnstableApi
public final int peakBitrate
```

The peak bitrate in bits per second, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable. The way in which this field is populated depends on the type of media to which the format corresponds:

- DASH representations: The `@bandwidth` attribute of the corresponding `
  Representation` element in the manifest.
- HLS variants: The `BANDWIDTH` attribute defined on the corresponding `
  EXT-X-STREAM-INF` tag.
- SmoothStreaming track elements: Always `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`.
- Progressive container formats: Often `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`, but may be populated with the peak bitrate of the container if known.
- Sample formats: Often `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`, but may be populated with the peak bitrate of the stream of samples with type `https://developer.android.com/reference/androidx/media3/common/Format#sampleMimeType()` if known. Note that if `https://developer.android.com/reference/androidx/media3/common/Format#sampleMimeType()` is a compressed format (e.g., `https://developer.android.com/reference/androidx/media3/common/MimeTypes#AUDIO_AAC()`), then this bitrate is for the stream of still compressed samples.

### pixelFormat

```
@UnstableApi
public final int pixelFormat
```

The pixel format of the video, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

Typically one of the `https://developer.android.com/reference/android/hardware/HardwareBuffer.html` format constants.

### pixelWidthHeightRatio

```
public final float pixelWidthHeightRatio
```

The width to height ratio of pixels in the video, or 1.0 if unknown or not applicable.

### primaryTrackGroupId

```
@UnstableApi
public final @Nullable String primaryTrackGroupId
```

The `https://developer.android.com/reference/androidx/media3/common/TrackGroup#id()` of the primary `https://developer.android.com/reference/androidx/media3/common/TrackGroup` this format is embedded into.

If `null`, the format is not known to be embedded in another stream.

### projectionData

```
@UnstableApi
public final @Nullable byte[] projectionData
```

The projection data for 360/VR video, or null if not applicable.

### roleFlags

```
@C.RoleFlags
public final int roleFlags
```

Track role flags.

### rotationDegrees

```
@UnstableApi
public final int rotationDegrees
```

The clockwise rotation that should be applied to the video for it to be rendered in the correct orientation, or 0 if unknown or not applicable. Only 0, 90, 180 and 270 are supported.

### sampleMimeType

```
public final @Nullable String sampleMimeType
```

The sample MIME type, or null if unknown or not applicable.

### sampleRate

```
public final int sampleRate
```

The audio sampling rate in Hz, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

### selectionFlags

```
@C.SelectionFlags
public final int selectionFlags
```

Track selection flags.

### selectionPriority

```
@UnstableApi
public final float selectionPriority
```

A relative preference among formats in the same `https://developer.android.com/reference/androidx/media3/common/TrackGroup`, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unset. A higher value indicates a more preferred format. The way in which this field is populated depends on the type of media to which the format corresponds:

- HLS variants: The `SCORE` attribute defined on the corresponding `
  EXT-X-STREAM-INF` and `EXT-X-I-FRAME-STREAM-INF` tags in the multivariant playlist, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not present.
- All the other types of media: Always `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()`.

### stereoMode

```
@UnstableApi
@C.StereoMode
public final int stereoMode
```

The stereo layout for 360/3D/VR video, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not applicable. Valid stereo modes are `https://developer.android.com/reference/androidx/media3/common/C#STEREO_MODE_MONO()`, `https://developer.android.com/reference/androidx/media3/common/C#STEREO_MODE_TOP_BOTTOM()`, `https://developer.android.com/reference/androidx/media3/common/C#STEREO_MODE_LEFT_RIGHT()`, `https://developer.android.com/reference/androidx/media3/common/C#STEREO_MODE_STEREO_MESH()`.

Value is one of the following:

- `Format.NO_VALUE`

<br />

### subsampleOffsetUs

```
@UnstableApi
public final long subsampleOffsetUs
```

For samples that contain subsamples, this is an offset that should be added to subsample timestamps. A value of `https://developer.android.com/reference/androidx/media3/common/Format#OFFSET_SAMPLE_RELATIVE()` indicates that subsample timestamps are relative to the timestamps of their parent samples.

### tileCountHorizontal

```
@UnstableApi
public final int tileCountHorizontal
```

The number of horizontal tiles in an image, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not known or applicable.

### tileCountVertical

```
@UnstableApi
public final int tileCountVertical
```

The number of vertical tiles in an image, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if not known or applicable.

### width

```
public final int width
```

The width of the video in pixels, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown or not applicable.

## Public methods

### buildUpon

```
@UnstableApi
public Format.Builder buildUpon()
```

Returns a `https://developer.android.com/reference/androidx/media3/common/Format.Builder` initialized with the values of this instance.

### copyWithCryptoType

```
@UnstableApi
public Format copyWithCryptoType(@C.CryptoType int cryptoType)
```

Returns a copy of this format with the specified `https://developer.android.com/reference/androidx/media3/common/Format#cryptoType()`.

### equals

```
public boolean equals(@Nullable Object obj)
```

### fromBundle

```
@UnstableApi
public static Format fromBundle(Bundle bundle)
```

Restores a `Format` from a `https://developer.android.com/reference/android/os/Bundle.html`.

### getPixelCount

```
@UnstableApi
public int getPixelCount()
```

Returns the number of pixels if this is a video format whose `https://developer.android.com/reference/androidx/media3/common/Format#width()` and `https://developer.android.com/reference/androidx/media3/common/Format#height()` are known, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` otherwise

### hashCode

```
public int hashCode()
```

### initializationDataEquals

```
@UnstableApi
public boolean initializationDataEquals(Format other)
```

Returns whether the `https://developer.android.com/reference/androidx/media3/common/Format#initializationData()`s belonging to this format and `other` are equal.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/Format other` | The other format whose `https://developer.android.com/reference/androidx/media3/common/Format#initializationData()` is being compared. |

| Returns |
|---|---|
| `boolean` | Whether the `https://developer.android.com/reference/androidx/media3/common/Format#initializationData()`s belonging to this format and `other` are equal. |

### toBundle

```
@UnstableApi
public Bundle toBundle()
```

Returns a `https://developer.android.com/reference/android/os/Bundle.html` representing the information stored in this object.

### toLogString

```
@UnstableApi
public static String toLogString(@Nullable Format format)
```

Returns a prettier `https://developer.android.com/reference/java/lang/String.html` than `https://developer.android.com/reference/androidx/media3/common/Format#toString()`, intended for logging.

### toString

```
public String toString()
```

### withManifestFormatInfo

```
@UnstableApi
public Format withManifestFormatInfo(Format manifestFormat)
```