Skip to main content
Unlike a video or an image sequence, an MCAP Scene has no frame grid. It stores 3D labels as events on a nanosecond timeline. Point cloud segmentation and time-series annotations use label spaces. An uploaded MCAP recording is a continuous MCAP Scene. In the SDK, its label row is event-based: LabelRowV2.is_event_based is True.
Do not use the frame-based ObjectInstance methods, such as set_for_frames() and remove_from_frames(), on a continuous MCAP Scene. Use upsert_event(), delete_event(), and get_events() for 3D objects, and get_space() with put_object_instance() for point cloud segmentation and time-series ranges.

Writing Labels

Each example below is a standalone script with two tabs: Single Scene labels one MCAP Scene, and Bulk labels several Scenes, using bundles to initialize and save the label rows. Replace the values in the # User input section, the labels dictionary in the Bulk scripts, and the coordinates, with your own values. The ontology must contain the corresponding shape: a cuboid, point cloud segmentation, or time range. Each script saves the labels when run.

3D Objects

Root 3D objects, such as cuboids, spheres, keypoints, and polylines, use events at scene-relative nanosecond timestamps. Each upsert sets the geometry until the next event; a delete ends the object at that timestamp. The SDK uses hold behavior rather than interpolating geometry between keyframes. The example below labels a cuboid over [2 s, 5 s), updating it at 3.5 s.
Encord’s 3D annotation event model follows Foxglove’s add/replace/delete model. See SceneUpdate for updates and deletions, and SceneEntity for object IDs, geometry, and lifetime.
Useful Concepts: Interpolation uses hold behavior. A 3D object retains the geometry from its latest upsert until the next event. In the cuboid example, the geometry at 3 s is the geometry written at 2 s; at 4 s it is the geometry written at 3.5 s. Positions and rotations are not linearly interpolated between label events. Sensor frame transforms have their own interpolation behavior. Stored events and resolved annotations are different. object_instance.get_events() returns stored upserts and deletes in timestamp order; only upserts have coordinates. object_instance.get_ranges() returns the inclusive ranges where the object exists. To read its geometry between events, use object_instance.get_annotation(frame=3_000_000_000).coordinates. Despite the parameter name frame, this is a nanosecond timestamp relative to the Scene start. The resolved annotation is read-only; use upsert_event() to write a change. A delete ends the object immediately. An upsert at 2 s followed by a delete at 5 s means the object exists over [2 s, 5 s): it is absent at exactly 5 s, and reading it there raises LabelRowError. The corresponding inclusive SDK range ends at 4_999_999_999 ns. Every track must end with a delete before export or save; if the last included timestamp is t, delete at t + 1 ns. Point-index ranges and time-series ranges include both endpoints.

Point Cloud Segmentation

Address a point cloud message with its topic and absolute MCAP log_time in nanoseconds. Point index ranges are inclusive and refer to the exact point order in that message. Filtering or reordering the point cloud changes those indices. To read the log_time with the Go version of the MCAP CLI, extract the first column of its text output (integer nanoseconds). Replace the file and topic with your recording’s values:

Time Series

Use the exact numeric sub-channel ID, such as /spot/cmd_vel.angular.x, rather than only the parent topic. Both endpoints of a time-series Range are inclusive and expressed in nanoseconds relative to the Scene start. See Time Series layouts to identify a sub-channel in your recording.

Reading Labels

JSON export

Initialize the label row to read its saved annotations. This example exports all loaded labels to JSON.
export MCAP labels

Other SDK methods

For root 3D objects, frame means nanoseconds relative to the Scene start. obj below is an ObjectInstance:
Read MCAP labels
For point cloud segmentation and time-series labels, use label spaces: For general 3D ontology examples and non-MCAP point cloud data, see Point Cloud (3D).