Open topic with navigation

# Macros

You can use macros to set dynamic values for some configuration parameters. For example, when you write files to disk, you can configure the file names to include video timestamps.

## System Macros

The macros in this section take values from the system that hosts Media Server.

Macro | Description
--- | ---
`%currentTime.TIME_FORMAT%` | The time, according the clock on the Media Server host, at which the macro is expanded. (Replace `TIME_FORMAT` with one of the time formats. For example, use `%currentTime.iso8601%` to obtain a timestamp in ISO 8601 format).
`%uuid%` | A unique ID.
`%system.hostname%` | The host name of the machine that Media Server is running on.
`%system.platform%` | The name of the operating system that Media Server is running on.

Tip: To have file names based on the video timestamps, rather than the current time, use the segment or record macros described below.

## Session Macros

Macro | Description
--- | ---
`%token%` | The token that identifies the `process` action request sent to Media Server.

## Segment Macros

Segment macros represent the properties of a video segment. You can use the following macros with:

- Any output task that outputs data about a video segment (for example an XML output task with `Mode=time`, `Mode=event`, or `Mode=bounded`).
- The image encoder (images can be considered as short video segments).
- The MPEG encoder (when you set the Segment configuration parameter to `TRUE`).

Macro | Description
--- | ---
`%segment.startTime.TIME_FORMAT%` | The time when the segment starts, according to the timestamps in the video.
`%segment.peakTime.TIME_FORMAT%` |
`%segment.endTime.TIME_FORMAT%` | The time when the segment ends, according to the timestamps in the video.
`%segment.duration%` | The amount of video content that the segment contains, in milliseconds.
`%segment.sequence%` | A number that indicates the position of the segment in the video (counts up from 1).
`%segment.type%` | (Output tasks only) Expands to either "pre" or "post" to indicate whether the XML was produced before or after the XSL transformation was applied.

## Record Macros

The macros in this section take values from Media Server records.

To extract time values from records, you can use the following macros:

Macro | Description
--- | ---
`%record.track.name%` | The name of the track from which the record originated.
`%record.startTime.TIME_FORMAT%` | The time at which the record starts.
`%record.peakTime.TIME_FORMAT%` | For engines that perform integration, the time at which the best source frame occurred.
`%record.endTime.TIME_FORMAT%` | The time at which the record ends.
`%record.VALUE%` | Information from the record, where `VALUE` is the path to the desired property. The path can be constructed from property names or property types.

Consider the following XML produced by the Face Recognition analysis plug-in:

    <FaceRecognitionResult>
      <face>
        <ellipse>
          <a>115.108643</a>
          <angle>2.48955297</angle>
          <b>161.1521</b>
          <center>
            <x>480</x>
            <y>340</y>
          </center>
        </ellipse>
        <lefteye>
          <center>
            <x>527</x>
            <y>319</y>
          </center>
          <radius>19</radius>
        </lefteye>
        <outOfPlaneAngleX>0</outOfPlaneAngleX>
        <outOfPlaneAngleY>0</outOfPlaneAngleY>
        <region>
          <height>258</height>
          <left>341</left>
          <top>208</top>
          <width>258</width>
        </region>
        <righteye>
          <center>
            <x>435</x>
            <y>315</y>
          </center>
          <radius>19</radius>
        </righteye>
      </face>
      <id>693e7de5-9974-4acf-9b202b8caf212c10</id>
      <identity>
        <confidence>76.3419418</confidence>
        <database>Faces</database>
        <identifier>Person01</identifier>
      </identity>
    </FaceRecognitionResult>

To extract the UUID for the record, you could use the following:

- `%record.FaceRecognitionResult.id%` expands to the UUID.
- `%record.id%` expands to the same value, because you can omit the highest level in the XML (`FaceRecognitionResult`). Omitting the output track type means that this macro would also work with records produced by Face Detection.
- `%record.UUIDData%` is even more generic, because Media Server looks for the first element of type `UUIDData`, rather than an element explicitly named `id`.

To extract the name of the person recognized by Face Recognition, you could use the following:

- `%record.FaceRecognitionResult.identity.identifier%`
- `%record.identity.identifier%` expands to the same value, because you can omit the highest level in the XML (`FaceRecognitionResult`).
- `%record.IdentityData.identifier%` is even more generic, because Media Server looks for the first element of type `IdentityData`, rather than an element explicitly named `identity`.

For more information about the macros supported by Media Server data types, see Macros Supported by Media Server Data Types.

© 2016 Hewlett Packard Enterprise Development LP | Send documentation feedback to HPE Close We welcome your comments! To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to AutonomyTPFeedback@hpe.com. Product: Topic Title: Help Topic: Feedback:

_HP_HTML5_bannerTitle.htm