---
title: "Time-to-sample atom ('stts')"
framework: quicktime-file-format
role: symbol
role_heading: Atom
path: quicktime-file-format/time-to-sample_atom
---

# 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

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.  |   |   |   |   |   |   |

## Topics

### Data fields

- [Size](quicktime-file-format/time-to-sample_atom/size.md)
- [Type](quicktime-file-format/time-to-sample_atom/type.md)
- [Version](quicktime-file-format/time-to-sample_atom/version.md)
- [Flags](quicktime-file-format/time-to-sample_atom/flags.md)
- [Number of entries](quicktime-file-format/time-to-sample_atom/number_of_entries.md)
- [Time-to-sample table](quicktime-file-format/time-to-sample_atom/time-to-sample_table.md)

## See Also

### Describing samples

- [Sample table atom ('stbl')](quicktime-file-format/sample_table_atom.md)
- [Seeking with a QuickTime file](quicktime-file-format/seeking_with_a_quicktime_file.md)
- [Sample description atom ('stsd')](quicktime-file-format/sample_description_atom.md)
- [Creating video tracks at 30 frames per second](quicktime-file-format/creating_video_tracks_at_30_frames_per_second.md)
- [Creating video tracks at 29.97 frames per second](quicktime-file-format/creating_video_tracks_at_2997_frames_per_second.md)
- [Creating sound tracks at 44.1 kHz](quicktime-file-format/creating_sound_tracks_at_441_khz.md)
- [Composition offset atom ('ctts')](quicktime-file-format/composition_offset_atom.md)
- [Composition shift least greatest atom ('cslg')](quicktime-file-format/composition_shift_least_greatest_atom.md)
- [Using composition offset and composition shift least greatest atoms](quicktime-file-format/using_composition_offset_and_composition_shift_least_greatest_atoms.md)
- [Sync sample atom ('stss')](quicktime-file-format/sync_sample_atom.md)
- [Partial sync sample atom ('stps')](quicktime-file-format/partial_sync_sample_atom.md)
- [Sample-to-chunk atom ('stsc')](quicktime-file-format/sample-to-chunk_atom.md)
- [Referencing two data files with a single track](quicktime-file-format/referencing_two_data_files_with_a_single_track.md)
- [Sample size atom ('stsz')](quicktime-file-format/sample_size_atom.md)
- [Chunk offset atom ('stco')](quicktime-file-format/chunk_offset_atom.md)
