TickTime

data-variant=info
data-slots=text
UXP for Adobe Media Encoder is in public beta. This reference is being written, and the supported API surface may change before general availability.

Since: 27.0

A TickTime represents a precise point in time (or duration), used throughout the Media Encoder scripting API wherever a time value is required, such as RenderOptions.setCustomInAndOutPoints.

The TickTime class can be accessed from the main app object. Most TickTime values are created using one of the create* class methods below, rather than the constructor directly:

const app = require("mediaencoder");
const startTime = app.TickTime.createWithSeconds(0);

Constants

These TickTime Constants are class properties, accessed via the TickTime object itself.

const app = require("mediaencoder");
const TIME_ZERO = app.TickTime.TIME_ZERO;

TIME_ZERO

A TickTime representing zero.

Type: object (readonly)

Since: 27.0

TIME_ONE_SECOND

A TickTime representing one second.

Type: object (readonly)

Since: 27.0

TIME_ONE_MINUTE

A TickTime representing one minute.

Type: object (readonly)

Since: 27.0

TIME_ONE_HOUR

A TickTime representing one hour.

Type: object (readonly)

Since: 27.0

TIME_MAX

The maximum representable TickTime.

Type: object (readonly)

Since: 27.0

TIME_MIN

The minimum representable TickTime.

Type: object (readonly)

Since: 27.0

TIME_INVALID

An invalid/sentinel TickTime value.

Type: object (readonly)

Since: 27.0

Properties

These read-only instance properties are available on any TickTime instance.

const app = require("mediaencoder");
const time = app.TickTime.createWithSeconds(1.5);
time.seconds; // 1.5

seconds

The time value in seconds.

Type: number (readonly)

Since: 27.0

ticks

The time value as a ticks string.

Type: string (readonly)

Since: 27.0

ticksNumber

The time value as a ticks number.

Type: number (readonly)

Since: 27.0

Methods

createWithFrameAndFrameRate

Class method. Creates a TickTime from a frame count at a given frame rate.

Since: 27.0

Parameters

Name
Type
Description
frameCount
number
The number of frames
frameRate
object
A FrameRate object

Returns

Name
Type
Description
tickTime
object
The resulting TickTime
const app = require("mediaencoder");
const time = app.TickTime.createWithFrameAndFrameRate(30, frameRate);

createWithSeconds

Class method. Creates a TickTime from a number of seconds.

Since: 27.0

Parameters

Name
Type
Description
seconds
number
The time value in seconds

Returns

Name
Type
Description
tickTime
object
The resulting TickTime
const app = require("mediaencoder");
const startTime = app.TickTime.createWithSeconds(0);
const endTime = app.TickTime.createWithSeconds(1);

createWithTicks

Class method. Creates a TickTime from a ticks string.

Since: 27.0

Parameters

Name
Type
Description
ticks
string
The ticks string

Returns

Name
Type
Description
tickTime
object
The resulting TickTime
const app = require("mediaencoder");
const time = app.TickTime.createWithTicks("254016000000");

createWithTicksNumber

Class method. Creates a TickTime from a ticks number.

Since: 27.0

Parameters

Name
Type
Description
ticksNumber
number
The ticks number

Returns

Name
Type
Description
tickTime
object
The resulting TickTime
const app = require("mediaencoder");
const time = app.TickTime.createWithTicksNumber(254016000000);

timecodeToTime

Class method. Converts a timecode display string to a TickTime.

Since: 27.0

Parameters

Name
Type
Description
timecodeString
string
The timecode string to convert
frameRate
object
A FrameRate object
timeDisplay
object
A TimeDisplay object

Returns

Name
Type
Description
tickTime
object
The resulting TickTime
const app = require("mediaencoder");
const time = app.TickTime.timecodeToTime("00:00:01:00", frameRate, timeDisplay);

timeToTimecode

Class method. Converts a TickTime to a timecode display string.

Since: 27.0

Parameters

Name
Type
Description
tickTime
object
The TickTime to convert
frameRate
object
A FrameRate object
timeDisplay
object
A TimeDisplay object

Returns

Name
Type
Description
timecode
string
The timecode string
const app = require("mediaencoder");
const timecode = app.TickTime.timeToTimecode(time, frameRate, timeDisplay);
timecode; // "00:00:01:00"

equals

Instance method. Checks whether this TickTime is equal to another.

Since: 27.0

Parameters

Name
Type
Description
tickTime
object
The TickTime to compare against

Returns

Name
Type
Description
result
boolean
true if the two values are equal
const app = require("mediaencoder");
const a = app.TickTime.createWithSeconds(1);
const b = app.TickTime.createWithSeconds(1);
a.equals(b); // true

toFrame

Instance method. Converts this TickTime to a frame number at the given frame rate.

Since: 27.0

Parameters

Name
Type
Description
frameRate
object
A FrameRate object

Returns

Name
Type
Description
frame
number
The resulting frame number
const app = require("mediaencoder");
const time = app.TickTime.createWithSeconds(1);
time.toFrame(frameRate);

alignToNearestFrame

Instance method. Aligns this TickTime to the nearest frame boundary at the given frame rate.

Since: 27.0

Parameters

Name
Type
Description
frameRate
object
A FrameRate object

Returns

Name
Type
Description
tickTime
object
The aligned TickTime
const app = require("mediaencoder");
const time = app.TickTime.createWithSeconds(1.02);
time.alignToNearestFrame(frameRate);

alignToFrame

Instance method. Aligns this TickTime to a frame boundary at the given frame rate by flooring.

Since: 27.0

Parameters

Name
Type
Description
frameRate
object
A FrameRate object

Returns

Name
Type
Description
tickTime
object
The aligned TickTime
const app = require("mediaencoder");
const time = app.TickTime.createWithSeconds(1.02);
time.alignToFrame(frameRate);

add

Instance method. Adds another TickTime to this one.

Since: 27.0

Parameters

Name
Type
Description
tickTime
object
The TickTime to add

Returns

Name
Type
Description
tickTime
object
The resulting TickTime
const app = require("mediaencoder");
const a = app.TickTime.createWithSeconds(1);
const b = app.TickTime.createWithSeconds(2);
a.add(b); // TickTime representing 3 seconds

subtract

Instance method. Subtracts another TickTime from this one.

Since: 27.0

Parameters

Name
Type
Description
tickTime
object
The TickTime to subtract

Returns

Name
Type
Description
tickTime
object
The resulting TickTime
const app = require("mediaencoder");
const a = app.TickTime.createWithSeconds(3);
const b = app.TickTime.createWithSeconds(1);
a.subtract(b); // TickTime representing 2 seconds

multiply

Instance method. Multiplies this TickTime by a factor.

Since: 27.0

Parameters

Name
Type
Description
factor
number
The factor to multiply by

Returns

Name
Type
Description
tickTime
object
The resulting TickTime
const app = require("mediaencoder");
const time = app.TickTime.createWithSeconds(1);
time.multiply(2); // TickTime representing 2 seconds

divide

Instance method. Divides this TickTime by a divisor.

Since: 27.0

Parameters

Name
Type
Description
divisor
number
The divisor to divide by

Returns

Name
Type
Description
tickTime
object
The resulting TickTime
const app = require("mediaencoder");
const time = app.TickTime.createWithSeconds(2);
time.divide(2); // TickTime representing 1 second