<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "QuickTime File Format",
  "identifier" : "/documentation/quicktime-file-format/Composition_offset_atom",
  "metadataVersion" : "0.1.0",
  "role" : "Atom",
  "symbol" : {
    "kind" : "Atom",
    "modules" : [
      "QuickTime File Format"
    ],
    "preciseIdentifier" : "__docc_universal_symbol_reference_$Composition_offset_atom"
  },
  "title" : "Composition offset atom ('ctts')"
}
-->

# Composition offset atom ('ctts')

An atom you use to specify out-of-order video samples.

## Overview

Video samples in encoded formats have a decode order and a presentation order (also called composition order or display order). The composition offset atom is used when there are out-of-order video samples.

- If the decode and presentation orders are the same, no composition offset atom will be present. The time-to-sample atom provides both the decode and presentation ordering of the video stream, and allows calculation of the start and end times.
- If video samples are stored out of presentation order, the time-to-sample atom provides the decode order and the composition offset atom provides the time of presentation for the decoded samples expressed as a delta on a sample-by-sample basis.

> Note: Decode time does not directly imply presentation time when working with out of order video samples. The ordering is significant.

The composition offset atom contains a sample-by-sample mapping of the decode-to-presentation time. Each entry in the composition offset table is a time delta from decode to presentation time: `CT(n) = DT(n) + CTTS(n)` where `CTTS(n)` is the (uncompressed) table entry for sample `n` `DT` is the decode time and `CT` is the composition (or display) time. The delta expressed in the composition offset table can be positive or negative.

When the time-to-sample atom and the composition offset atom are present, a reader parsing out-of-order video samples has all the information necessary to calculate the start and end times, as well as the minimum and maximum offsets between decode time and presentation time. The sample tables are scanned to obtain these values.

> Note: At the last displayed frame, the decode duration is used as presentation duration.

The type of the composition offset atom is `‘ctts’`.

The layout of a composition offset atom is as follows.

|Composition offset atom data field                                                                  |Bytes|
|----------------------------------------------------------------------------------------------------|-----|
|``doc://com.apple.qtff/documentation/quicktime-file-format/Composition_offset_atom/Size``           |4    |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Composition_offset_atom/Type`` = `'ctts'`|4    |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Composition_offset_atom/Version``        |1    |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Composition_offset_atom/Flags``          |3    |
|``doc://com.apple.qtff/documentation/quicktime-file-format/Composition_offset_atom/Entry_count``    |4    |

## Topics

### Data fields

[`Size`](/documentation/quicktime-file-format/Composition_offset_atom/Size)

A 32-bit integer that specifies the number of bytes in the composition offset atom.

[`Type`](/documentation/quicktime-file-format/Composition_offset_atom/Type)

A 32-bit integer that identifies the atom type.

[`Version`](/documentation/quicktime-file-format/Composition_offset_atom/Version)

A 1-byte specification of the version of this atom.

[`Flags`](/documentation/quicktime-file-format/Composition_offset_atom/Flags)

A 3-byte space reserved for offset flags.

[`Entry count`](/documentation/quicktime-file-format/Composition_offset_atom/Entry_count)

A 32-bit unsigned integer that specifies the number of sample numbers in the array that follows.



---

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)