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

The AndThen ESP engine compares two tracks to identify events in the second track that occur within a specific time interval after (or at the same time as) events in the first track. The engine produces a track containing the identified record pairs.

NOTE: The AndThen engine enforces the order of events in the two tracks: events in the second track must occur after events in the first track. To detect events in two tracks that occur within a specified time interval, when the event order does not matter, use an And task. For more information, see Identify Time-Related Events in Two Tracks–And 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 `[Session]` section, add a new task by setting the `EngineN` parameter. You can give the task any name, for example:

       [Session]
       Engine0=Ingest
       ...
       Engine5=AndThen

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

   `Type` | The ESP engine to use. Set this parameter to `andthen`.
   `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.
   `TimestampCondition` | (Optional) Specifies 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.
   `LuaScript` | (Optional) The name of a Lua script that defines conditions that a record pair must meet in order to be included in the output track. For information about writing the script, see Write a Lua Script for an ESP Engine.

   For more information about these parameters and the values 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 (`RedLightBreach.Output`) containing records produced when a number plate is detected up to five seconds (5000 milliseconds) after traffic lights turn red. The engine takes tracks produced by SceneAnalysis and NumberPlate engines. The SceneAnalysis output track contains a record for every time the traffic lights turned red. The Numberplate output track contains a record for every number plate detected in the video.

    [RedLightBreach]
    Type=andthen
    Input0=sceneanalysis.ResultWithSource
    Input1=numberplate.ResultWithSource
    TimestampCondition=start1 <= start0 +5s

© Copyright 2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm