From 632bef29a617603e7a46441bafc08086ccfa09d2 Mon Sep 17 00:00:00 2001 From: Tobias Juelg Date: Sun, 10 May 2026 10:30:58 +0200 Subject: [PATCH] feat(convert): lerobot data convert video codec --- python/rcs/__main__.py | 4 ++++ python/rcs/lerobot_joint_converter.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/python/rcs/__main__.py b/python/rcs/__main__.py index dc0b3cdf..344060d4 100644 --- a/python/rcs/__main__.py +++ b/python/rcs/__main__.py @@ -147,6 +147,9 @@ def lerobot_convert( success: Annotated[bool, typer.Option(help="Only include successful episodes. Example: --success")] = True, n: Annotated[int, typer.Option(help="Maximum number of episodes to convert. -1 means all. Example: --n 50")] = -1, video_encoding: Annotated[bool, typer.Option(help="Should the image data be video encoded")] = False, + video_backend: Annotated[ + str | None, typer.Option(help="Video backend to use if image data is video encoded e.g. torchcodec") + ] = None, ): cameras = camera_specs_to_configs(camera_specs) if camera_specs is not None else list(DEFAULT_CAMERAS) run_conversion( @@ -164,6 +167,7 @@ def lerobot_convert( success=success, n=n, video_encoding=video_encoding, + video_backend=video_backend, ) diff --git a/python/rcs/lerobot_joint_converter.py b/python/rcs/lerobot_joint_converter.py index 33d0fced..60b800c3 100644 --- a/python/rcs/lerobot_joint_converter.py +++ b/python/rcs/lerobot_joint_converter.py @@ -99,6 +99,7 @@ def __init__( image_batch_size: int = DEFAULT_IMAGE_BATCH_SIZE, per_robot_arm_dim: int = DEFAULT_PER_ROBOT_ARM_DIM, video_encoding: bool = False, + video_backend: str | None = None, ): self.root = Path(root) self.conn = duckdb.connect() @@ -133,6 +134,7 @@ def __init__( features=self._build_features(), image_writer_threads=10, image_writer_processes=5, + video_backend=video_backend, ) def _build_features(self) -> dict[str, dict[str, Any]]: @@ -416,6 +418,7 @@ def run_conversion( success: bool = True, n: int = -1, video_encoding: bool = False, + video_backend: str | None = None, ) -> None: robot_type_converted = RobotType(robot_type) gripper_type_converted = GripperType(gripper_type) @@ -432,6 +435,7 @@ def run_conversion( image_batch_size=image_batch_size, per_robot_arm_dim=per_robot_arm_dim, video_encoding=video_encoding, + video_backend=video_backend, ) converter.generate_examples(success=success, n=n)