Identify Time-Related Events–And/AndThen Engine

The And and AndThen ESP engines compare two or more tracks to identify combinations of events. The events must occur within specific time intervals of each other. The AndThen engine enforces the condition that, for records to be grouped, a record in an input track must start after the record in the preceding input track.

For example, in a broadcast monitoring system, 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:

  • Configure face recognition to recognize the specific person only, and object recognition to recognize the specific product only. You could then send the output tracks from the analysis tasks to the And engine to group related events.
  • Filter the output tracks from the analysis engines, and send 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. This approach can be more efficient because you do not have to limit the output of your analysis tasks.
  • Send the unfiltered output tracks from the analysis engines to an And engine and use a Lua script to filter the record groups. Each time the engine detects records that occur within a specific time interval of each other, the engine runs the function in the Lua script to determine if the records should be included in the output track. For more information about writing the Lua script, see Write a Lua Script for an ESP Engine.

To identify time-related events

  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 [Session] section, add a new task by setting the EngineN parameter. You can give the task any name, for example:

    [Session]
    Engine0=Ingest
    ...
    Engine5=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.
    InputN Specify the input tracks. Start numbering from 0.
    TimestampCondition

    (Optional) Specify time limits for matching records, based on the record timestamps. If you do not set this parameter, the records must start at exactly the same time.

    If you are processing images or documents, this parameter is ignored and records are considered related if they are associated with the same page.

    LuaScript (Optional) To add custom logic that discards groups 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.

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

  4. Save and close the configuration file. Micro Focus 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 of the other record type.

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

[Session]
...
Engine5=BreakingNews
Engine6=Syria
Engine7=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
TimestampCondition=start1>=start0-2s,start1<=start0+2s