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:

To identify time-linked events in two tracks

  1. Create a new configuration to send to 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 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

_HP_HTML5_bannerTitle.htm