UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FTimecode Struct Reference

#include <Timecode.h>

Public Member Functions

 FTimecode ()
 
 FTimecode (int32 InHours, int32 InMinutes, int32 InSeconds, int32 InFrames, bool InbDropFrame)
 
 FTimecode (int32 InHours, int32 InMinutes, int32 InSeconds, int32 InFrames, float InSubframe, bool InbDropFrame)
 
 FTimecode (double InSeconds, const FFrameRate &InFrameRate, bool InbDropFrame, bool InbRollover)
 
 FTimecode (double InSeconds, const FFrameRate &InFrameRate, bool InbRollover)
 
FFrameNumber ToFrameNumber (const FFrameRate &InFrameRate) const
 
FTimespan ToTimespan (const FFrameRate &InFrameRate) const
 
CORE_API FString ToString (bool bForceSignDisplay=false, bool bDisplaySubframe=false) const
 
bool IsValid () const
 

Static Public Member Functions

static FTimecode FromFrameNumber (const FFrameNumber &InFrameNumber, const FFrameRate &InFrameRate, bool InbDropFrame)
 
static FTimecode FromFrameNumber (const FFrameNumber &InFrameNumber, const FFrameRate &InFrameRate)
 
static FTimecode FromFrameTime (const FFrameTime &InFrameTime, const FFrameRate &InFrameRate, TOptional< bool > bDropFrame={})
 
static FTimecode FromTimespan (const FTimespan &InTimespan, const FFrameRate &InFrameRate, bool InbDropFrame, bool InbRollover)
 
static FTimecode FromTimespan (const FTimespan &InTimespan, const FFrameRate &InFrameRate, bool InbRollover)
 
static bool IsDropFormatTimecodeSupported (const double InRate)
 
static bool IsDropFormatTimecodeSupported (const FFrameRate &InFrameRate)
 
static bool UseDropFormatTimecode (const FFrameRate &InFrameRate)
 
static CORE_API bool UseDropFormatTimecodeByDefaultWhenSupported ()
 
static bool IsValidDropFormatTimecodeRate (const FString &InRateString)
 
static CORE_API TOptional< FTimecodeParseTimecode (const FStringView InTimecodeString)
 

Public Attributes

int32 Hours
 
int32 Minutes
 
int32 Seconds
 
int32 Frames
 
float Subframe = 0
 
bool bDropFrameFormat
 

Friends

bool operator== (const FFrameRate &A, const FFrameRate &B)
 
bool operator!= (const FFrameRate &A, const FFrameRate &B)
 
bool operator== (const FTimecode &A, const FTimecode &B)
 
bool operator!= (const FTimecode &A, const FTimecode &B)
 

Detailed Description

A timecode that stores time in HH:MM:SS format with the remainder of time represented by an integer frame count.

Constructor & Destructor Documentation

◆ FTimecode() [1/5]

FTimecode::FTimecode ( )
inline

Default construction for UObject purposes

◆ FTimecode() [2/5]

FTimecode::FTimecode ( int32  InHours,
int32  InMinutes,
int32  InSeconds,
int32  InFrames,
bool  InbDropFrame 
)
inlineexplicit

User construction from a number of hours minutes seconds and frames.

Parameters
InbDropFrame- If true, this Timecode represents a "Drop Frame Timecode" format which skips the first frames of every minute (except those ending in multiples of 10) to account for drift when using a fractional NTSC framerate.

◆ FTimecode() [3/5]

FTimecode::FTimecode ( int32  InHours,
int32  InMinutes,
int32  InSeconds,
int32  InFrames,
float  InSubframe,
bool  InbDropFrame 
)
inlineexplicit

User construction from a number of hours minutes seconds frames, and subframes.

Parameters
InbDropFrame- If true, this Timecode represents a "Drop Frame Timecode" format which skips the first frames of every minute (except those ending in multiples of 10) to account for drift when using a fractional NTSC framerate.

◆ FTimecode() [4/5]

FTimecode::FTimecode ( double  InSeconds,
const FFrameRate InFrameRate,
bool  InbDropFrame,
bool  InbRollover 
)
inlineexplicit

User construction from a time in seconds

Parameters
InbDropFrame- If true, this Timecode represents a "Drop Frame Timecode" format which skips the first frames of every minute (except those ending in multiples of 10) to account for drift when using a fractional NTSC framerate.
InbRollover- If true, the hours will be the modulo of 24.
Note
Be aware that the Cycles may not correspond to the System Time. See FDateTime and "leap seconds".

◆ FTimecode() [5/5]

FTimecode::FTimecode ( double  InSeconds,
const FFrameRate InFrameRate,
bool  InbRollover 
)
inlineexplicit

User construction from a time in seconds

Parameters
InbRollover- If true, the hours will be the modulo of 24.
Note
Be aware that the Cycles may not correspond to the System Time. See FDateTime and "leap seconds".

Member Function Documentation

◆ FromFrameNumber() [1/2]

static FTimecode FTimecode::FromFrameNumber ( const FFrameNumber InFrameNumber,
const FFrameRate InFrameRate 
)
inlinestatic

Create a FTimecode from a specific frame number at the given frame rate.

Parameters
InFrameNumber- The frame number to convert into a timecode. This should already be converted to InFrameRate's resolution.
InFrameRate- The framerate that this timecode is based in. This should be the playback framerate as it is used to determine when the Frame value wraps over.

◆ FromFrameNumber() [2/2]

static FTimecode FTimecode::FromFrameNumber ( const FFrameNumber InFrameNumber,
const FFrameRate InFrameRate,
bool  InbDropFrame 
)
inlinestatic

Create a FTimecode from a specific frame number at the given frame rate. Optionally supports creating a drop frame timecode, which drops certain timecode display numbers to help account for NTSC frame rates which are fractional.

Parameters
InFrameNumber- The frame number to convert into a timecode. This should already be converted to InFrameRate's resolution.
InFrameRate- The framerate that this timecode is based in. This should be the playback framerate as it is used to determine when the Frame value wraps over.
InbDropFrame- If true, the returned timecode will drop the first two frames on every minute (except when Minute % 10 == 0) This is only valid for NTSC framerates (29.97, 59.94) and will assert if you try to create a drop-frame format from a non-valid framerate. All framerates can be represented when in non-drop frame format.

◆ FromFrameTime()

static FTimecode FTimecode::FromFrameTime ( const FFrameTime InFrameTime,
const FFrameRate InFrameRate,
TOptional< bool bDropFrame = {} 
)
inlinestatic

Create a FTimecode from a specific frame time at the given frame rate.

Parameters
InFrameTime- The frame time to convert into a timecode. This should already be converted to InFrameTimes's resolution.
InFrameRate- The framerate that this timecode is based in. This should be the playback framerate as it is used to determine when the Frame value wraps over.
bDropFrame- Optional parameter to indicate if we are in drop frame format.

◆ FromTimespan() [1/2]

static FTimecode FTimecode::FromTimespan ( const FTimespan InTimespan,
const FFrameRate InFrameRate,
bool  InbDropFrame,
bool  InbRollover 
)
inlinestatic

Create a FTimecode from a timespan at the given frame rate. Optionally supports creating a drop frame timecode, which drops certain timecode display numbers to help account for NTSC frame rates which are fractional.

Parameters
InTimespan- The timespan to convert into a timecode.
InFrameRate- The framerate that this timecode is based in. This should be the playback framerate as it is used to determine when the Frame value wraps over.
InbDropFrame- If true, the returned timecode will drop the first two frames on every minute (except when Minute % 10 == 0) This is only valid for NTSC framerates (29.97, 59.94) and will assert if you try to create a drop-frame format from a non-valid framerate. All framerates can be represented when in non-drop frame format.
InbRollover- If true, the hours will be the modulo of 24.

◆ FromTimespan() [2/2]

static FTimecode FTimecode::FromTimespan ( const FTimespan InTimespan,
const FFrameRate InFrameRate,
bool  InbRollover 
)
inlinestatic

Create a FTimecode from a timespan at the given frame rate.

Parameters
InTimespan- The timespan to convert into a timecode.
InFrameRate- The framerate that this timecode is based in. This should be the playback framerate as it is used to determine when the Frame value wraps over.
InbRollover- If true, the hours will be the modulo of 24.

◆ IsDropFormatTimecodeSupported() [1/2]

static bool FTimecode::IsDropFormatTimecodeSupported ( const double  InRate)
inlinestatic

Drop frame is only support for frame rate of 29.97 or 59.94.

◆ IsDropFormatTimecodeSupported() [2/2]

static bool FTimecode::IsDropFormatTimecodeSupported ( const FFrameRate InFrameRate)
inlinestatic

Drop frame is only support for frame rate of 29.97 or 59.94.

◆ IsValid()

bool FTimecode::IsValid ( ) const
inline

Will return true if the timecode represents a valid timecode value where

Minutes is +/- [0, 59] Seconds is +/- [0, 59] Frames [INT_MIN, INT_MAX] Subframes >= 0

◆ IsValidDropFormatTimecodeRate()

static bool FTimecode::IsValidDropFormatTimecodeRate ( const FString &  InRateString)
inlinestatic

Returns true if the given frame rate string represents a supported drop frame timecode frame rate, or false otherwise.

Drop frame timecode is only supported for NTSC_30 (29.97 FPS) or NTSC_60 (59.94 FPS) frame rates.

◆ ParseTimecode()

TOptional< FTimecode > FTimecode::ParseTimecode ( const FStringView  InTimecodeString)
static

Parses a string representation of a timecode.

Supported SMPTE drop frame (DF) and non-drop frame (NDF) formats variations:

  • NDF: HH:MM:SS:FF
  • DF: HH:MM:SS;FF or HH:MM:SS.FF or HH;MM;SS;FF or HH.MM.SS.FF.

The 2 digits per number is not enforced. It is possible to parse high frame numbers (above 60), such as for audio timecodes. Full SMPTE compliance is not ensured by the parser (i.e. greater than 24h, negative time and any number of frames per second).

Sub-frame variation: Supports the sub-frame variation where the frame number is a decimal number: HH:MM:SS:FF.ZZ.

Side effect of supporting sub-frame is that this function can't unambiguously parse partial timecodes.

Parameters
InTimecodeStringA string representation of a timecode
Returns
Parsed timecode if valid.

◆ ToFrameNumber()

FFrameNumber FTimecode::ToFrameNumber ( const FFrameRate InFrameRate) const
inline

Converts this Timecode back into a Frame Number at the given framerate, taking into account if this is a drop-frame format timecode.

◆ ToString()

FString FTimecode::ToString ( bool  bForceSignDisplay = false,
bool  bDisplaySubframe = false 
) const

Get the Qualified Timecode formatted in HH:MM:SS:FF or HH:MM:SS;FF depending on if this represents drop-frame timecode or not.

Parameters
bForceSignDisplay- Forces the timecode to be prepended with a positive or negative sign. Standard behavior is to only show the sign when the value is negative.
bDisplaySubframe- If subframe decimal digits are desired.

◆ ToTimespan()

FTimespan FTimecode::ToTimespan ( const FFrameRate InFrameRate) const
inline

Converts this Timecode back into a timespan at the given framerate, taking into account if this is a drop-frame format timecode.

◆ UseDropFormatTimecode()

static bool FTimecode::UseDropFormatTimecode ( const FFrameRate InFrameRate)
inlinestatic

If the frame rate support drop frame format and the app wish to use drop frame format by default.

◆ UseDropFormatTimecodeByDefaultWhenSupported()

bool FTimecode::UseDropFormatTimecodeByDefaultWhenSupported ( )
static

By default, should we generate a timecode in drop frame format when the frame rate does support it.

Friends And Related Symbol Documentation

◆ operator!= [1/2]

bool operator!= ( const FFrameRate A,
const FFrameRate B 
)
friend

◆ operator!= [2/2]

bool operator!= ( const FTimecode A,
const FTimecode B 
)
friend

◆ operator== [1/2]

bool operator== ( const FFrameRate A,
const FFrameRate B 
)
friend

◆ operator== [2/2]

bool operator== ( const FTimecode A,
const FTimecode B 
)
friend

Member Data Documentation

◆ bDropFrameFormat

bool FTimecode::bDropFrameFormat

If true, this Timecode represents a Drop Frame timecode used to account for fractional frame rates in NTSC play rates.

◆ Frames

int32 FTimecode::Frames

How many frames does this timecode represent

◆ Hours

int32 FTimecode::Hours

IMPORTANT: If you change the struct data, ensure that you also update the version in NoExportTypes.h
How many hours does this timecode represent

◆ Minutes

int32 FTimecode::Minutes

How many minutes does this timecode represent

◆ Seconds

int32 FTimecode::Seconds

How many seconds does this timecode represent

◆ Subframe

float FTimecode::Subframe = 0

The subframe value provided when converting to FFrameTime


The documentation for this struct was generated from the following files: