<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "QuickTime File Format",
  "identifier" : "/documentation/quicktime-file-format/Time-to-sample_atom",
  "metadataVersion" : "0.1.0",
  "role" : "Atom",
  "symbol" : {
    "kind" : "Atom",
    "modules" : [
      "QuickTime File Format"
    ],
    "preciseIdentifier" : "__docc_universal_symbol_reference_$Time-to-sample_atom"
  },
  "title" : "Time-to-sample atom ('stts')"
}
-->

# Time-to-sample atom ('stts')

An atom that stores duration information for a media’s samples, providing a mapping from a time in a media to the corresponding data sample.

## Overview

Time-to-sample atoms store duration information for a media’s samples, providing a mapping from a time in a media to the corresponding data sample. The time-to-sample atom has an atom type of `'stts'`.

You can determine the appropriate sample for any time in a media by examining the time-to-sample atom table, which is contained in the time-to-sample atom.

The atom contains a compact version of a table that allows indexing from time to sample number. Other tables provide sample sizes and pointers from the sample number. Each entry in the table gives the number of consecutive samples with the same time delta, and the delta of those samples. By adding the deltas, a complete time-to-sample map can be built.

The atom contains time deltas: `DT(n+1) = DT(n) + STTS(n)` where `STTS(n)` is the (uncompressed) table entry for sample `n` and `DT` is the display time for sample `(n)`. The sample entries are ordered by time stamps; therefore, the deltas are all nonnegative. The `DT` axis has a zero origin; `DT(i) = SUM` (for `j=0` to `i-1` of `delta(j)`), and the sum of all deltas gives the length of the media in the track (not mapped to the overall time scale, and not considering any edit list). The edit list atom provides the initial DT value if it is nonempty (nonzero).

The layout of the time-to-sample atom is as follows.

|Time-to-sample atom data field                                                                       |Bytes   |
|-----------------------------------------------------------------------------------------------------|--------|
|``doc://com.apple.qtff/documentation/quicktime-file-format/Time-to-sample_atom/Size``                |4       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Time-to-sample_atom/Type`` = `'ctts'`     |4       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Time-to-sample_atom/Version``             |1       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Time-to-sample_atom/Flags``               |3       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Time-to-sample_atom/Number_of_entries``   |4       |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Time-to-sample_atom/Time-to-sample_table``|Variable|

## Topics

### Data fields

[`Size`](/documentation/quicktime-file-format/Time-to-sample_atom/Size)

A 32-bit integer that specifies the number of bytes in this time-to-sample atom.

[`Type`](/documentation/quicktime-file-format/Time-to-sample_atom/Type)

A 32-bit integer that identifies the atom type.

[`Version`](/documentation/quicktime-file-format/Time-to-sample_atom/Version)

A 1-byte specification of the version of this time-to-sample atom.

[`Flags`](/documentation/quicktime-file-format/Time-to-sample_atom/Flags)

A 3-byte space for time-to-sample flags.

[`Number of entries`](/documentation/quicktime-file-format/Time-to-sample_atom/Number_of_entries)

A 32-bit integer containing the count of entries in the time-to-sample table.

[`Time-to-sample table`](/documentation/quicktime-file-format/Time-to-sample_atom/Time-to-sample_table)

A table that defines the duration of each sample in the media.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)