Skip to content

footage

footage("myFile")

To use a footage item from the Project panel as an object in an expression, use the global footage method, as in footage("myFile").

You can also access a footage object using the source attribute on a layer whose source is a footage item (i.e. thisLayer.source)

On this page, we’re going to use footage("myFile") as a sample on how to call these items, however note that any method that returns a Footage object will work.


footage("myFile").duration

Returns the duration of the footage item, in seconds.

Number


footage("myFile").frameDuration

Returns the duration of a frame in the footage item, in seconds.

Number


footage("myFile").height

Returns the height of the footage item, in pixels.

Number


footage("myFile").name

Returns the name of the footage item as shown in the Project panel.

String


footage("myFile").ntscDropFrame

Returns true if the timecode is in drop-frame format.

Boolean


footage("myFile").pixelAspect

Returns the pixel aspect ratio of the footage item.

Number


footage("myFile").sourceData

Returns the data of a JSON file as an array of sourceData objects.

The structure of the JSON file will determine the size and complexity of the array.

Individual data streams can be referenced as hierarchal attributes of the data.

An array of sourceData objects; read-only.

Given a data stream named “Color”, the following will return the value of “Color” from the first data object:

footage("sample.json").sourceData[0].Color

Typical use is to assign a JSON file’s sourceData to a variable, and then reference the desired data stream. For example:

const myData = footage("sample.json").sourceData;
myData[0].Color;

footage("myFile").sourceText

Returns the contents of a JSON file as a string.

The eval() method can be used to convert the string to an array of sourceData objects, identical to the results of the Footage.sourceData attribute, from which the individual data streams can be referenced as hierarchal attributes of the data.

String, the contents of the JSON file; read-only.

const myData = eval(footage("sample.json").sourceText);
myData.sampleValue;

footage("myFile").width

Returns the width of the footage item, in pixels.

Number


footage("myFile").dataKeyCount(dataPath)

Returns the number of samples in a specificed dynamic data stream in a MGJSON file.

Accepts a single array value to define the path in the hierarchy to the desired dynamic data stream.

ParameterTypeDescription
dataPathArrayRequired. The path in the hierarchy to a static or dynamic data stream.

The number of samples in the dynamic data stream.

To return the count of samples for the first child:

footage("sample.mgjson").dataKeyCount([0])

To return the count of samples for the second group:

footage("sample.mgjson").dataKeyCount([1][0])

footage("myFile").dataKeyTimes(dataPath[, t0=startTime][, t1=endTime])

Returns the time in seconds for the samples of a specificed dynamic data stream in a MGJSON file.

Optionally specify the time span from which to return samples. By default the time for all samples between startTime and endTime in the dynamicdata stream are returned, as defined by the data stream’s samplesTemporalExtent property in the MGJSON file.

Accepts a single array value to define the path in the hierarchy to the desired dynamic data stream.

ParameterTypeDescription
dataPathArrayRequired. The path in the hierarchy to a static or dynamic data stream.
t0NumberOptional. The start time, in seconds, of the span from which to return samples. Defaults to startTime.
t1NumberOptional. The end time, in seconds, of the span from which to return samples. Defaults to endTime.

Array of numbers representing the sample times.

Return the times of samples between 1 second and 3 seconds for the first child:

footage("sample.mgjson").dataKeyTimes([0], 1, 3)

footage("myFile").dataKeyValues(dataPath[, t0=startTime][, t1=endTime])

Returns the values for the samples of a specificed dynamic data stream in a MGJSON file.

Optionally specify the time span from which to return samples. By default the time for all samples between startTime and endTime in the dynamicdata stream are returned, as defined by the data stream’s samplesTemporalExtent property in the MGJSON file.

Accepts a single array value to define the path in the hierarchy to the desired dynamic data stream.

ParameterTypeDescription
dataPathArrayRequired. The path in the hierarchy to a static or dynamic data stream.
t0NumberOptional. The start time, in seconds, of the span from which to return samples. Defaults to startTime.
t1NumberOptional. The end time, in seconds, of the span from which to return samples. Defaults to endTime.

Array of numbers representing the sample values.

Return the values of samples between 1 second and 3 seconds for the first child:

footage("sample.mgjson").dataKeyValues([0], 1, 3)

footage("myFile").dataValue(dataPath)

Returns the value of specificed static or dynamic data stream in a MGJSON file.

Accepts a single array value to define the path in the hierarchy to the desired data stream.

ParameterTypeDescription
dataPathArrayRequired. The path in the hierarchy to a static or dynamic data stream.

The value of the data stream.

To return data of the first child:

footage("sample.mgjson").dataValue([0])

To return data of the first child in the second group:

footage("sample.mgjson").dataValue([1][0])