.. _Concepts/Timecode:

Timecode
========

Overview
--------

A :class:`Draft.Timecode` is used to embed on write and extract on read a timecode in a DPX or EXR image file or in a video file.

Implementation Details
----------------------

A :class:`~Draft.Timecode` object stores the hours, the minutes, the seconds and the frame associated to a timecode as described in SMPTE standard. In addition, a flag indicating whether the :class:`~Draft.Timecode` object represents a non-drop frame or a drop frame timecode is stored. 

A :class:`~Draft.Timecode` is created using a string with format hh:mm:ss:ff for non-drop frame timecode and hh:mm:ss;ff for drop frame timecode, where hh indicates the hours in the range [0..23], mm the minutes in the range [0..59], ss the seconds in the range [0..59] and ff the frame in the range [0..59].

In the case of a DPX or EXR image file, a :class:`Draft.ImageInfo` can be used to embed or to extract a :class:`~Draft.Timecode`.
In the case of a video file, the :class:`~Draft.Timecode` to be embedded can be specified when creating a :class:`Draft.VideoEncoder` and a :class:`Draft.VideoDecoder` has a :attr:`~Draft.VideoDecoder.timecode` property that can be used to extract the embedded timecode.

Relevant Cookbook Recipes
-------------------------

* :ref:`Basic/EmbedTimecodeInImageFile`

* :ref:`Intermediate/EmbedTimecodeInVideoFile`


