# Track

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

*** ** * ** ***


```
@UnstableApi
class Track
```

<br />

*** ** * ** ***

Encapsulates information describing an MP4 track.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track`. |
| `@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/kotlin/androidx/annotation/IntDef(value = ) annotation https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track.Transformation` The transformation to apply to samples in the track, if any. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#TIMESCALE_UNSET() = -1` An unset or unknown timescale. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#TRANSFORMATION_CEA608_CDAT() = 1` A transformation for caption samples in cdat atoms. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#TRANSFORMATION_MEBX_UNBOX() = 2` A transformation for boxed metadata samples in `mebx` tracks, extracting the box payload matching the target `local_key_id`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#TRANSFORMATION_NONE() = 0` A no-op sample transformation. |

| ### Public constructors |
|---|
| `[Track](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#Track(int,int,long,long,long,long,androidx.media3.common.Format,int,androidx.media3.extractor.mp4.TrackEncryptionBox[],int,long[],long[],boolean,int))( id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, @https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, timescale: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, movieTimescale: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, durationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, mediaDurationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, @https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track.Transformation sampleTransformation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, sampleDescriptionEncryptionBoxes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox!>?, nalUnitLengthFieldLength: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, editListDurations: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>?, editListMediaTimes: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>?, shouldBeExposed: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, chapterTrackId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track.Builder` instead. <br /> |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track.Builder!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#buildUpon()()` Returns a new `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track.Builder` initialized with the values of this instance. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track!` | `[copyWithFormat](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#copyWithFormat(androidx.media3.common.Format))(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#buildUpon()` instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track!` | `[copyWithoutEditLists](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#copyWithoutEditLists())()` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#buildUpon()` instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox?` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#getSampleDescriptionEncryptionBox(int)(sampleDescriptionIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox` for the given sample description index. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#chapterTrackId()` The identifier of the associated chapter track, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` if there is none. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#durationUs()` The duration of the track in microseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if unknown. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/ImmutableLongArray.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#editListDurations()` Durations of edit list segments in the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#movieTimescale()`, or ` null` if there is no edit list. |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/ImmutableLongArray.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#editListMediaTimes()` Media times for edit list segments in the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#timescale()`, or ` null` if there is no edit list. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#format()` The format. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#id()` The track identifier. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#mediaDurationUs()` The duration of the media in microseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if unknown. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#movieTimescale()` The movie timescale, or `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#TIMESCALE_UNSET()` if unknown. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#nalUnitLengthFieldLength()` The length in bytes of the NALUnitLength field in each sample. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track.Transformation https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#sampleTransformation()` One of `TRANSFORMATION_*`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#shouldBeExposed()` Whether the track should be exposed to the player. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#timescale()` The track timescale, defined as the number of time units that pass in one second, or `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#TIMESCALE_UNSET()` if unknown. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.TrackType https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#type()` One of `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_AUDIO()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_VIDEO()` and `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_TEXT()`. |

## Constants

### TIMESCALE_UNSET

```
const val TIMESCALE_UNSET = -1: Long
```

An unset or unknown timescale.

### TRANSFORMATION_CEA608_CDAT

```
const val TRANSFORMATION_CEA608_CDAT = 1: Int
```

A transformation for caption samples in cdat atoms.

### TRANSFORMATION_MEBX_UNBOX

```
const val TRANSFORMATION_MEBX_UNBOX = 2: Int
```

A transformation for boxed metadata samples in `mebx` tracks, extracting the box payload matching the target `local_key_id`.

### TRANSFORMATION_NONE

```
const val TRANSFORMATION_NONE = 0: Int
```

A no-op sample transformation.

## Public constructors

### Track

```
[Track](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#Track(int,int,long,long,long,long,androidx.media3.common.Format,int,androidx.media3.extractor.mp4.TrackEncryptionBox[],int,long[],long[],boolean,int))(
    id: Int,
    @C.TrackType type: Int,
    timescale: Long,
    movieTimescale: Long,
    durationUs: Long,
    mediaDurationUs: Long,
    format: Format!,
    @Track.Transformation sampleTransformation: Int,
    sampleDescriptionEncryptionBoxes: Array<TrackEncryptionBox!>?,
    nalUnitLengthFieldLength: Int,
    editListDurations: LongArray<Long>?,
    editListMediaTimes: LongArray<Long>?,
    shouldBeExposed: Boolean,
    chapterTrackId: Int
)
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track.Builder` instead.

## Public functions

### buildUpon

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

Returns a new `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track.Builder` initialized with the values of this instance.

### copyWithFormat

```
fun [copyWithFormat](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#copyWithFormat(androidx.media3.common.Format))(format: Format!): Track!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#buildUpon()` instead.

### copyWithoutEditLists

```
fun [copyWithoutEditLists](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#copyWithoutEditLists())(): Track!
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#buildUpon()` instead.

### getSampleDescriptionEncryptionBox

```
fun getSampleDescriptionEncryptionBox(sampleDescriptionIndex: Int): TrackEncryptionBox?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox` for the given sample description index.

| Parameters |
|---|---|
| `sampleDescriptionIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The given sample description index |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox?` | The `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/TrackEncryptionBox` for the given sample description index. Maybe null if no such entry exists. |

## Public properties

### chapterTrackId

```
val chapterTrackId: Int
```

The identifier of the associated chapter track, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#INDEX_UNSET()` if there is none.

### durationUs

```
val durationUs: Long
```

The duration of the track in microseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if unknown.

### editListDurations

```
val editListDurations: ImmutableLongArray?
```

Durations of edit list segments in the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#movieTimescale()`, or `
null` if there is no edit list.

### editListMediaTimes

```
val editListMediaTimes: ImmutableLongArray?
```

Media times for edit list segments in the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#timescale()`, or `
null` if there is no edit list.

### format

```
val format: Format!
```

The format.

### id

```
val id: Int
```

The track identifier.

### mediaDurationUs

```
val mediaDurationUs: Long
```

The duration of the media in microseconds, or `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TIME_UNSET()` if unknown.

### movieTimescale

```
val movieTimescale: Long
```

The movie timescale, or `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#TIMESCALE_UNSET()` if unknown.

### nalUnitLengthFieldLength

```
val nalUnitLengthFieldLength: Int
```

The length in bytes of the NALUnitLength field in each sample. 0 for tracks that don't use length-delimited NAL units.

### sampleTransformation

```
@Track.Transformation
val sampleTransformation: Int
```

One of `TRANSFORMATION_*`. Defines the transformation to apply before outputting each sample.

### shouldBeExposed

```
val shouldBeExposed: Boolean
```

Whether the track should be exposed to the player.

### timescale

```
val timescale: Long
```

The track timescale, defined as the number of time units that pass in one second, or `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mp4/Track#TIMESCALE_UNSET()` if unknown.

### type

```
@C.TrackType
val type: Int
```

One of `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_AUDIO()`, `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_VIDEO()` and `https://developer.android.com/reference/kotlin/androidx/media3/common/C#TRACK_TYPE_TEXT()`.