Close

Experimental:Timecode Class

The Timecode class holds a timecode value.

  • str (Optional) - Initializes the Timecode object from a Timecode formatted String: ie. hh:mm:ss:ff or hh:mm:ss.ff
  • fps - (Keyword, Optional) Initialize the Timecode object with the specified fps. If not specified it will be initialized with the rate of the local time.
  • hour - (Keyword, Optional) Specify the hour. Should be left blank if a String arg is provided
  • minute - (Keyword, Optional) Specify the minute. Should be left blank if a String arg is provided. 0 by default.
  • second - (Keyword, Optional) Specify the second. Should be left blank if a String arg is provided. 0 by default.
  • frame - (Keyword, Optional) Specify the frame. Should be left blank if a String arg is provided. 0 by default.
  • negative - (Keyword, Optional) Specify whether the Timecode is negative. Should be left blank if a String arg is provided. False by default.
  • smpte - (Keyword, Optional) Specify whether the Timecode is SMPTE standard. True by default.
t = tdu.Timecode() # 00:00:00:00 with fps=me.time.rate	
t2 = tdu.Timecode('01:11:11:15', fps=30) # 01:11:11:15 with fps=30
t3 = tdu.Timecode(frame=185, fps=30) # 00:00:06:05 with fps=30
t4 = tdu.Timecode(hour=1, minute=2, second=3, frame=4, negative=True, fps=30) # -01:02:03:04 with fps=30


Members

dropFrame(Read Only):

True if the Timecode is drop-frame, False otherwise.

fps(Read Only):

Get or set the framerate (in frames per second) of the Timecode.

frame(Read Only):

The Timecode frame: 0 to fps-1

hour(Read Only):

The Timecode hour: 0 to 99 if non-SMPTE, 0 to 23 otherwise.

minute(Read Only):

The Timecode minute: 0 to 59.

negative(Read Only):

True if the Timecode is negative, and False otherwise. Always False if the Timecode is following SMPTE standard.

second(Read Only):

The Timecode second: 0 to 59.

smpte(Read Only):

True if the Timecode is SMPTE standard, and False otherwise. SMPTE Timecodes cannot be negative and cannot exceed 24 hours.

text(Read Only):

Get the text format of the Timecode.

totalFrames(Read Only):

The total number of Timecode frames, which is calculated from the hour, minute, second, frame values. Whether or not the Timecode is drop frame will also affect the value.

totalSeconds(Read Only):

The total number of Timecode seconds, which is calculated from the hour, minute, second, frame values. Whether or not the Timecode is drop frame will also affect the value.

Methods

setComponents(hour, minute, second, frame, negative=False, fps=None)None:

Set the Timecode from individual time components.

  • hour - The new hour value.
  • minute - The new minute value.
  • second - The new second value.
  • frame - The new frame value.
  • negative (Keyword, Optional) - Whether the new Timecode is negative, False by default.
  • fps (Keyword, Optional) - The Timecode's FPS. If not specified then the FPS will not change.
n.setComponents(12, 22, 33, 45, negative=True, fps=60) -> new Timecode will be -12:22:33:45.

setString(timecodeStr, fps=None)None:

Set the Timecode from a string formated as [-]hh:mm:ss:ff.

  • timecodeStr - The string in the format: [-]hh:mm:ss:ff.
  • fps (Keyword, Optional) - The Timecode's FPS. If not specified then the FPS will not change.
n.setString('01:01:00:00', fps=60)

setTotalFrames(totalFrames, fps=None)None:

Set the Timecode to a single integer value representing the new total frames.

  • totalFrames - The new total frame value.
  • fps (Keyword, Optional) - The Timecode's FPS. If not specified then the FPS will not change.
n.setTotalFrames(120, fps=60) # new Timecode will be 00:00:02:00

TouchDesigner Build: