ON THIS PAGE

  • Holistic Record
  • Environment variable configuration
  • Example of functionality
  • Holistic Replay
  • Example of functionality
  • Limitations

Holistic Record and Replay

To simplify development and later testing and debugging of your application, you can record and replay test data. This can be done without any changes to your code with the use of environmental variables and configuration files. You can create a holistic recording using the holistic_record.py script and then replay it by setting the DEPTHAI_REPLAY environment variable to the path of the recording.Holistic record and replay works by recording the calibration, camera features information, and data (messages) of source nodes used in an application (Camera and IMU) which can then be replayed as if the source nodes sent the same data again.

Holistic Record

Holistic record records enabled source node streams to a tar file. This can be enabled in code:

Python

Python
1with dai.Pipeline as pipeline:
2    config = dai.RecordConfig()
3    config.outputDir = "./recordings";
4    config.videoEncoding.enabled = True # Use video encoding
5    config.videoEncoding.profile = dai.VideoEncoderProperties.Profile.H264_MAIN
6
7    pipeline.enableHolisticRecord(config)

C++

C++
1dai::Pipeline pipeline;
2dai::RecordConfig config;
3config.outputDir = "./recordings";
4config.videoEncoding.enabled = true;  // Use video encoding
5config.videoEncoding.profile = dai::VideoEncoderProperties::Profile::H264_MAIN;
6
7pipeline.enableHolisticRecord(config);
or by using the DEPTHAI_RECORD environment variable:
Command Line
1DEPTHAI_RECORD="./recordings" python3 application.py

Environment variable configuration

In the above example, the DEPTHAI_RECORD environment variable is set to the recording output directory. This enabled holistic recording with the default configuration options. If you want more control you set the variable to the path to a configuration file:
JSON
1{
2    "outputDir": "recordings/",
3    "compressionLevel": 3,
4    "syncCameraOutputs": true,
5    "videoEncoding": {
6	"enabled": true,
7        "bitrate": 0,
8        "lossless": false,
9        "profile": "MJPEG",
10        "quality": 80
11    }
12}
The configuration parameters are as follows:
  • outputDir sets the output directory of the recording
  • compressionLevel configures the compression of the metadata. It ranges from 0 to 5 (inclusive) which corresponds to the following compression levels: NONE, FASTEST, FAST, DEFAULT, SLOW, SLOWEST
  • syncCameraOutputs enables camera output synchronization. This prevents dropped messages from causing issues when replaying into StereoDepth or similar nodes that require synchronized frames.
  • videoEncoding configures the VideoEncoder that encodes the camera stream:
    • enabled enables the VideoEncoder. When false, the output of the Camera node is recorded which can decrease the device CPU usage while increasing bandwidth usage
    • profile sets the encoding profile
    • bitrate sets the VideoEncoder bitrate (when set to 0 it is determined automatically)
    • lossless determines whether the encoding should be lossles where applicable
    • quality determines the encoding quality where applicable

Example of functionality

Holistic Replay

Holistic replay replays recorded source streams. It automatically loops the input streams and updates message timestamps and sequence numbers accordingly. Similarly to holistic record it can be enabled in code:

Python

Python
1with dai.Pipeline as pipeline:
2    pipeline.enableHolisticReplay("./recordings/recording.tar")

C++

C++
1dai::Pipeline pipeline;
2pipeline.enableHolisticReplay("./recordings/recording.tar");
or by using the DEPTHAI_REPLAY environment variable:
Command Line
1DEPTHAI_REPLAY="./recordings/recording.tar" python3 application.py

Example of functionality

Limitations

This functionality is a work in progress and comes with some limitations:
  • As replaying requires sending messages from the host to the device, using this functionality significantly reduces the fps of the pipeline.
  • The frame timestamps can drift on each loop when replaying, as the loop timestamp offsets are calculated independently for each camera stream. This can cause issues with message synchronization after some time.
  • At this point in time, only single device pipelines can be holistically recorded and replayed.