One dispatcher for the SMPTE timecode operations, selected by an Action.
A single function covering roughly two dozen timecode operations. Action names the operation; Arg1 through Arg5 and OptionsJson are positional slots whose meaning depends on the chosen Action. Most operations take a timecode value and a frame rate token, and drop-frame is selected by the rate token itself.
Declaration
Inlay_TIMECODE ( JSONSetElement ( "{}" ;
[ "Action" ; "convert" ; JSONString ] ;
[ "Arg1" ; "01:00:00:00" ; JSONString ] ;
[ "Arg2" ; "timecode" ; JSONString ] ;
[ "Arg3" ; "23.976" ; JSONString ] ;
[ "Arg4" ; "frames" ; JSONString ]
) )
Parameters
- Action Required
- the operation to run. See Notes for the full list.
- Arg1 Required
- first operand, usually a timecode, frame count, or rate. Required for most actions.
- Arg2 Required
- second operand, usually a frame rate token or a second timecode.
- Arg3 Optional
- third operand for multi-input actions such as convert and rebase.
- Arg4 Optional
- fourth operand for convert.
- Arg5 Optional
- fifth operand for convert.
- OptionsJson Optional
- JSON for convert tuning. filmFormat is 35mm4 (default), 35mm3, 35mm2, or 16mm; mode is rebase (default) or runtime.
Returns
JSON string On success returns {"ok":true,"action":"<action>","value":...}; value is a scalar or an object depending on the action. On failure returns {"ok":false,"message":"..."}.
Use Cases
- Convert between timecode, frames, seconds, ticks, and feet for an editorial workflow.
- Add, subtract, or compare two timecodes at a given rate to compute durations.
Notes
- Actions: normalize, convert, parse, parts, isValid, rateInfo, ratePlayback, rateTimebase, rateNtsc, add, subtract, compare, scale, mod, negate, abs, rebase. Action matching is case-insensitive.
- Argument shapes: normalize(tc, rate); convert(value, fromType, fromRate, toType, [toRate], [OptionsJson]); parse(value, rate); parts(tc, rate); isValid(value, rate); rateInfo|ratePlayback|rateTimebase|rateNtsc(rate); add|subtract|compare(tcA, tcB, rate); scale(tc, factor, rate); mod(tc, divisor, rate); negate|abs(tc, rate); rebase(tc, fromRate, toRate).
- convert types: timecode, frames, seconds, ticks, feet.
- Rate tokens: 23.98/23.976, 24, 25, 29.97/29.97ndf, 29.97df, 30, 47.95, 48, 50, 59.94/59.94ndf, 59.94df, 60. The df tokens select drop-frame.
- Legacy lowercase keys action, arg1 through arg5, and optionsJson are accepted for one release cycle.