Macrodata_Labs
AboutBlogDemo
Announcing MacroHands, our SOTA model for 3D hands and camera path from egocentric video!
// Docs›
Quickstart
Running pipelines
  • In-process debugging
  • Local launcher
Reading data
  • Reader model
  • Sharding
  • LeRobot reader
  • HDF5 reader
  • Zarr reader
  • MCAP reader
  • Tabular files
  • Files and videos
  • Hugging Face
  • TensorFlow
  • Lance
  • Custom readers
Episode data
  • Episode rows
  • Frames and videos
  • Metadata, tasks, and stats
  • Converting to robot rows
Transforms
  • Row transforms
  • Async and batch transforms
  • Vectorized transforms
  • Expressions
  • Schemas and DTypes
Episode operations
  • Motion trimming
  • Subtask annotation
Inference
  • Generate text
  • Multimodal and structured output
  • Inference providers
  • Pooling
Writing data
  • Writer model
  • LeRobot writer
  • Zarr writer
  • Parquet and JSONL writers
  • Lance
  • Media assets and reducers
Examples
  • ALOHA HDF5
  • robomimic HDF5
  • Zarr replay buffer
  • MCAP Franka
  • LIBERO HDF5
  • Merge LeRobot datasets
  • Annotate subtasks
Reference
  • Path formats
  • Optional dependencies
// Docs
Quickstart
Running pipelines
  • In-process debugging
  • Local launcher
Reading data
  • Reader model
  • Sharding
  • LeRobot reader
  • HDF5 reader
  • Zarr reader
  • MCAP reader
  • Tabular files
  • Files and videos
  • Hugging Face
  • TensorFlow
  • Lance
  • Custom readers
Episode data
  • Episode rows
  • Frames and videos
  • Metadata, tasks, and stats
  • Converting to robot rows
Transforms
  • Row transforms
  • Async and batch transforms
  • Vectorized transforms
  • Expressions
  • Schemas and DTypes
Episode operations
  • Motion trimming
  • Subtask annotation
Inference
  • Generate text
  • Multimodal and structured output
  • Inference providers
  • Pooling
Writing data
  • Writer model
  • LeRobot writer
  • Zarr writer
  • Parquet and JSONL writers
  • Lance
  • Media assets and reducers
Examples
  • ALOHA HDF5
  • robomimic HDF5
  • Zarr replay buffer
  • MCAP Franka
  • LIBERO HDF5
  • Merge LeRobot datasets
  • Annotate subtasks
Reference
  • Path formats
  • Optional dependencies

Frames and videos

Work with frame tables, video sources, and clips

An episode can contain both frame tables and videos:

  • frame tables hold aligned values such as timestamp, action, state, and labels
  • videos are lazy media sources that can be decoded, clipped, remuxed, or transcoded

Frame tables

1
2
3
4
5
row = pipeline.take(1)[0]
frames = row.to_frame_table()

print(frames.names)
print(frames.num_rows)

Frame tables are Arrow-backed, which makes them efficient for slicing and writing. Common frame columns include:

ColumnMeaning
timestampSeconds from episode start.
actionRobot action vector.
observation.stateRobot state vector.
observation.*Additional observations.
task_indexLeRobot task index for each frame.

Observations

1
2
state = row.observations("state")
all_observations = row.observations()

observations() normalizes names: row.observations("state") reads observation.state.

Video sources

1
2
for key, video in row.videos.items():
    print(key, video)

Video sources may be path-backed files, bytes, in-memory frame arrays, or frame sequences. They share the same core operations:

OperationPurpose
clipped(...)Create a time-bounded view.
iter_frames()Decode video frames lazily.
iter_numpy_frames()Decode RGB arrays lazily.
write_to(...)Let a writer copy/remux/transcode media.

Clip a video view

1
2
3
4
5
6
def keep_middle(row):
    video = row.videos["observation.images.top"]
    return row.with_video(
        "observation.images.top",
        video.clipped(from_timestamp_s=1.0, to_timestamp_s=4.0),
    )

This does not immediately rewrite the media file. The writer later decides whether to remux or transcode the selected time range.

Related pages

  • Files and Videos Reader
  • Media Assets and Reducers
  • Motion Trimming

// Table of Contents

  1. Frame tables
  2. Observations
  3. Video sources
  4. Clip a video view
  5. Related pages
Macrodata_Labs
TermsPrivacyContact
  • GitHub
  • LinkedIn
  • X
  • HuggingFace
  • Discord