Open topic with navigation

# Identify Time-Related Events in Two Tracks–And Engine

The And ESP engine compares two tracks to identify combinations of events. The engine produces an output track containing the identified record pairs.

NOTE:

To detect events in the second track that occur only after (or at the same time as) events in the first track, use the AndThen engine. For more information, see Identify Time-Related Events in Two Tracks–AndThen Engine.

For example, you might want to identify all the times that a specific person appears in conjunction with a specific product. There are several ways you can accomplish this, but all involve the And ESP engine:

- Set up the analysis engines so they produce output tracks containing only relevant events. In this case, you would configure face recognition to recognize the specified person only, and object recognition to recognize the specified product only. You could then send the output tracks from the analysis tasks to the And engine to produce a track containing pairs of records that occurred at similar times.
- Filter the output tracks from the analysis engines, before sending the filtered tracks to the And engine. In this case, you do not need to configure face recognition and object recognition to recognize only specific faces and objects; these are extracted by Filter engines before being sent to the And engine. As with the previous method, the And engine produces a track containing pairs of records that occurred at similar times.
- Send the unfiltered output tracks from the analysis engines to an And engine that uses a Lua script to determine which events it should consider. Each time the engine detects records that occur within the specified time interval of each other, the engine runs the function in the Lua script to determine if the record pair should be included in the And output track. For more information on writing a Lua script, see Write a Lua Script for an ESP Engine.

To identify time-linked events in two tracks

1. Create a new configuration to send to HPE Media Server with the `process` action, or open an existing configuration that you want to modify.

2. In the `[EventProcessing]` section, add a new task by setting the `EventProcessingEngineN` parameter. You can give the task any name, for example:

       [EventProcessing]
       EventProcessingEngine0=AndEvents

3. Create a new configuration section for the task, and set the following parameters:

   `Type` | The ESP engine to use. Set this parameter to `and`.
   `Input0` | The first input track. This track must be an output track produced by another task.
   `Input1` | The second input track. This track must be an output track produced by another task.
   `MaxTimeInterval` | (Optional) The maximum difference in time between a record in the first track to a record in the second, for the records to be considered a pair. If you are processing images or documents this parameter is ignored.
   `MinTimeInterval` | (Optional) The minimum difference in time between a record in the first track to a record in the second, for the records to be considered a pair. The default value is the negative of the `MaxTimeInterval` value, meaning that the event in the second track can occur before the event in the first track. If you are processing images or documents this parameter is ignored.

   For more details about these parameters, including the values that they accept, refer to the HPE Media Server Reference.

4. (Optional) To add custom logic that discards pairs of records unless they meet additional conditions, set the `LuaScript` parameter so that Media Server runs a Lua script to filter the results. For information about writing the script, see Write a Lua Script for an ESP Engine.

   `LuaScript` | The path and file name of a Lua script to run.

5. Save and close the configuration file. HPE recommends that you save your configuration files in the location specified by the `ConfigDirectory` parameter.

Example

The following example produces an output track named `BreakingNewsSyria.Output`. This track contains speech-to-text records that contain the word "Syria", and OCR records that match the string "Breaking News". However, the records are only included when they occur within two seconds (2000 milliseconds) of the other record type.

ESP filter tasks are used to filter the OCR and speech-to-text results, before those results are passed to the "and" ESP task.

    [EventProcessing]
    EventProcessingEngine0=BreakingNews
    EventProcessingEngine1=Syria
    EventProcessingEngine2=BreakingNewsSyria

    [BreakingNews]
    Type=filter
    Input=ocr.result
    RequiredString=Breaking News

    [Syria]
    Type=filter
    Input=speechtotext.result
    RequiredSubString=Syria

    [BreakingNewsSyria]
    Type=and
    Input0=BreakingNews.output
    Input1=Syria.output
    MaxTimeInterval=2000ms

© 2017 Hewlett Packard Enterprise Development LP | Send documentation feedback to HPE Close Send documentation feedback 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. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_HP_HTML5_bannerTitle.htm