TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/huggingface/lerobot/llms.txt
Use this file to discover all available pages before exploring further.
lerobot-record command records robot demonstrations to create datasets for training.
Command
src/lerobot/scripts/lerobot_record.py
Overview
The recording script:- Captures robot observations (cameras, joint states) and actions
- Supports teleoperation or policy-driven recording
- Encodes videos efficiently with hardware acceleration
- Streams encoded videos in real-time (optional)
- Uploads datasets to Hugging Face Hub
- Visualizes data with Rerun
Key Options
Robot Configuration
Robot type:
so100_follower, koch_follower, aloha, etc.Serial port for robot connection (e.g.,
/dev/ttyUSB0).Unique identifier for this robot instance.
Camera configuration dictionary.Example:
Teleoperation Configuration
Teleoperator type:
so100_leader, koch_leader, keyboard, etc.Serial port for teleoperator device.
Unique identifier for teleoperator.
Dataset Configuration
Dataset repository ID in format
{username}/{dataset_name}.Task description (e.g., “Pick the cube and place it in the box”).
Local directory for dataset storage.
Frames per second for recording.
Number of episodes to record.
Maximum duration per episode in seconds.
Time allocated for resetting between episodes.
Video Encoding Options
Video codec:
h264, hevc, libsvtav1, auto, or hardware codecs like h264_nvenc, h264_videotoolbox.Enable real-time video encoding during capture (makes save_episode instant).
Number of threads per encoder. Lower values reduce CPU usage.
Maximum frames to buffer per camera when using streaming encoding.
Number of episodes to accumulate before batch encoding videos.
Upload Options
Upload dataset to Hugging Face Hub.
Create private repository on Hub.
Tags for dataset card.
Visualization Options
Display robot data in Rerun viewer.
IP address for remote Rerun server.
Port for remote Rerun server.
Usage Examples
Basic Recording with Teleoperation
Recording with Streaming Video Encoding
Streaming encoding makessave_episode() instant by encoding in real-time:
Recording with Hardware Video Encoding
Bimanual Robot Recording
Recording with Visualization
Recording with Policy (Autonomous)
Recording with Multiple Cameras
Using RealSense Cameras
Recording Workflow
- Connect Devices: Plug in robot and teleoperator
- Calibrate (if needed): Run
lerobot-calibratefirst - Start Recording: Run
lerobot-recordcommand - Episode Loop:
- Reset environment (manual)
- Press Enter to start episode
- Perform demonstration
- Press Enter to stop episode
- Episode is saved automatically
- Upload: Dataset is pushed to Hub when complete
Keyboard Controls
During recording:- Enter: Start/stop episode recording
- Ctrl+C: Stop recording and finalize dataset
- Space: Pause/resume (if using keyboard teleop)
Output Structure
Video Encoding Performance
Streaming vs Batch Encoding
Streaming Encoding (--dataset.streaming_encoding=true):
- Encodes frames in real-time during capture
save_episode()is near-instant- Uses more CPU during recording
- Recommended for most use cases
- Writes PNG images during capture
- Encodes to video after episode ends
save_episode()takes time- Lower CPU usage during recording
Hardware Acceleration
Use hardware encoders for best performance:Tips
- Camera Testing: Use
lerobot-find-camerasto identify camera indices - Port Finding: Use
lerobot-find-portto identify device ports - Calibration: Run
lerobot-calibratebefore first use - FPS Stability: Use
--dataset.streaming_encoding=truefor stable FPS - Storage: ~1GB per 10 minutes of multi-camera recording at 30fps
- Network: Upload to Hub happens after all episodes are recorded
See Also
- lerobot-replay - Replay recorded episodes
- lerobot-teleoperate - Test teleoperation
- lerobot-calibrate - Calibrate devices
- LeRobotDataset - Dataset format
- Robot API - Robot interface