Extract

The extract.py script identifies all data in a session directory generated by Record and:

  1. Extracts individual frames from all recorded .mp4 files using the sidecar .json nanosecond timestamps created during recording.

  2. Converts all recorded ROS bag topics into individual .csv files based on their original nanosecond timestamps.

  3. Uses per-source estimated_latency values (when present) to align extracted ranges across data sources as closely as possible.

To process a recorded session directory:

ros2 run data_collection extract -d 20260117_153206

To list the videos in a session without processing:

ros2 run data_collection extract -d 20260117_153206 -l

Stereo Video Splitting

For videos recorded with side_by_side set to "LR" or "RL" in the configuration (see Record), use the -S option to split the video into separate left and right channels:

ros2 run data_collection extract -d 20260117_153206 -S

This will create separate _left and _right output files (either MP4 videos or image sequences depending on the -f format option).

If a tag file is present provided on the command line, the extracted frames will be organized into subdirectories based on the tags. For example, if a stage tag “approach” is active from 10:00 to 10:30, all frames captured during that time will be saved in a subdirectory named “approach”.

Encord Integration

The encord_to_tags script allows importing labels from the Encord platform into the project’s native tag format.

ros2 run data_collection encord_to_tags --encord path/to/encord.json --sidecar path/to/video_sidecar.json

This ensures that cloud-based annotations can be used seamlessly with the local extraction and curation tools.