frameToSmpte
Description
Converts a frame number into a SMPTE timecode string, taking into account the SMPTE_Offset value of the active clip.
The SMPTE_Offset value of the active clip specifies the timecode start for the data on the clip. It is there so that frame 1 of your data corresponds to the starting timecode of your take. Without it, your frame numbers would end up large and cumbersome.
If you want to ignore the SMPTE_Offset in the computation, specify the -ignoreOffset
flag. You may wish to do this when computing a SMPTE_Offset of your own, for instance. In that situation, you wouldn't want the existing offset value in the computation.
The frames (FF) portion of the timecode string will go from 0 to 24, 25, or 30 depending on the current timecode standard (Film, PAL, and NTSC respectively). As your scene frame rate may be a higher multiple of those standard rates (e.g. 120 fps for NTSC), the sub-frame portion indicates the "in between frame" of the frame passed in.
Functional area
System
Command syntax
Syntax
frameToSmpte frame[-ignoreOffset] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
frame | integer | yes | The frame number to convert into SMPTE timecode |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
ignoreOffset | 0 | — | — | By default, the active clip's SMPTE_Offset value is added to the frame argument to produce a final timecode value. This flag causes the offset to be ignored causing a straight frame to timecode conversion. |
Return value
string
A SMPTE timecode string in the format HH:MM:SS:FF(SubFrame).
Examples
// Print the timecode values of the start and end frames of // the play range int $playStart = `getPlayStart`; int $playEnd = `getPlayEnd`; string $playStartStr = `frameToSmpte $playStart`; string $playEndStr = `frameToSmpte $playEnd`; print $playStartStr; print $playEndStr;
Additional information
Note that, given there are two fields per video frame, as shown in the following example output:
Field 1 subframes are of the format HH:MM:SS:FF(SubFrame), with a colon between the seconds and frames; but
Field 2 subframes are of the format HH:MM:SS.FF(SubFrame), with a period between the seconds and frames.
(Frame rates that use drop frames use a semi-colon ( ; ) and a comma ( , ) in the equivalent positions.)
For example, with NTSC non-drop timecode at 119.88 fps, the subframes will look like this:
00:00:00:00(0) Field 1 of frame 0 00:00:00:00(1) Field 1 of frame 0 00:00:00.00(2) Field 2 of frame 0 00:00:00.00(3) Field 2 of frame 0 00:00:00:01(0) Field 1 of frame 1 00:00:00:01(1) Field 1 of frame 1 00:00:00.01(2) Field 2 of frame 1 00:00:00.01(3) Field 2 of frame 1 Reducing to 59.940 fps gives: 00:00:00:00(0) Field 1 of frame 0 00:00:00.00(1) Field 2 of frame 0 00:00:00:01(0) Field 1 of frame 1 00:00:00.01(1) Field 2 of frame 1