When executing commands (and also when copying files, sending emails etc.) you can use the following variables to refer to the current file being processed and other special values.

$i         Full path of the input file (after preprocessing) (eg. “/Media/Original/”)

$f        The filename part only of the input file (eg. “”)

$g        The base part of the input filename after preprocessing (eg. “file1”)

$G       The base part of the original filename before preprocessing (ie. before renaming)

$e        The extension of the input (eg. “.mov”)

$E       The file extension, converted to upper case and omitting the period (eg. “MOV”)

$p        Full path of the input file’s parent directory (eg. “/Media/Original”)

$P       The path of the input file’s parent directory relative to the root (eg. “/Original”)

$q        Name of input file’s parent directory (eg. “Original”)

$Q       Name of input file’s grandparent directory (eg. “Media”)

$R       Name of input file’s great-grandparent directory, if any

$w       The file root directory that paths are relative to (eg. the watch folder)

$r        The original input file relative to the root directory

$h        The first path component after the root, if any

$b        Full path of the original input file that triggered the action (before preprocessing)

$B       Name of the xml batch file (if this job was triggered from a batch file)

$I        The existing server clip id (if this job was triggered by a server query)

$o        Full path of the converted movie (first movie only if multiple movies were created)

$z        Full path of the updated file that the clip will refer to, if different from $i

$c        A list of all the converted movies concatenated into one string

$l         A list of all the converted movies as separate arguments

$L       A list of all the files being added by a Folder Sync action as separate arguments

$K       A list of all the files being added by a Folder Sync action concatenated together

$a        Name of catalog the clips will be published to

$t         Tape name (if known)

$s        Starting timecode of the input file (if it’s a supported media file containing timecode)

$d        Duration of the input file (if it’s a supported media file) in timecode format

$n        Number of scenes that were detected (if scene detection was enabled)

$v        A summary of the format of the input file (if it’s a supported media file)

$u        A long Unix timestamp that could be used to create a ‘unique’ filename

$U       A unique name dervived from the current timestamp, shown as letters and digits

$D       Current date as yyyymmdd, eg. 20081231

$M      Current year and month as yyyy mm, eg. 2009 01

$T       Current time as hhmmss, eg. 235959

$S       Task summary (available when sending email notification)

$j         The job name

$k        The task id

$m       The name of the importer being used

$x        The standard output of executing the previous command

$y        The error output of executing the previous command

${id}   Value of arbitrary clip fields, eg. ${U12} is User12, ${NT} is the Notes field
$1..9    Separate parts of the original filename, delimited by space or punctuation characters

$_d      The current day of month ($_D without leading zero), eg. 31

$_m     The current month number ($_M without leading zero), eg. 12

$_y      The current year ($_Y for last two digits of year only), eg. 2011

$n       Include a literal new line character (also $r for carriage return, $t for tab, etc.)

$$       Include a literal ‘$’ in the command.

Note that it is possible for a single input file to result in zero, one or many converted movies. First, you can define more than one movie conversion (for example, to create versions at different resolutions). Secondly, you can perform automatic scene detection and specify that each scene is converted to a separate file. Depending on what arguments the command you are executing expects you might therefore want to use either the $o, $c or $l variable.

Not all the variables will be available at all times. For example, $x is only available after executing command 1, clip fields are only available for server-based tasks or after importing a movie, and so on. This also means you can’t use clip fields or the tape name when naming a catalog because the catalog is opened before the clip is imported.

To determine the id of clip fields you can select “Show attribute IDs” on the CatDV client and look at the identifier that appears in parentheses when choosing a field (for example when performing a query or customising a view). For example, ‘${CREF}’ for clip id, ‘${ID2}’ for the import date, ‘${U1}’ for user field 1, ‘${@Album}’ or ‘${@FNumber}’ for a named metadata field when importing an MP3 or Exif file.

In the case of timecode values such as ${I1} for In point or ${O2} for Out2 you can provide a format modifier such as ${I1:t} to use the time as decimal seconds rather than a formatted timecode value, or ${I1:f} to display the number of frames. This is sometimes useful when passing command line arguments to a tool such as ffmpeg. In the case of timestamps such as ${RD1} or ${DT1} etc. for camera record date you can use ${RD1:s} to display a Unix timestamp (time in seconds since 1 Jan 1970), ${RD1:iso} to display in ISO format, and ${RD1:ago} to display how many seconds in the past from now the time is.

You can use variables in the following places:

  • When specifying the subject, body or recipient of an email notification
  • When setting or modifying a clip field such as Status or Notes
  • When executing a command via the command line
  • When naming the catalog to publish clips to on the server
  • When specifying the path to copy or move a file to or specifying the destination of a movie conversion (if you choose ‘Expand variables’ as the file naming option)