Skip to main content

Recording Example

This example demonstrates how to programmatically control recording on your Aria Gen2 device using the Python SDK. You'll learn how to start recordings, stop them, and download the captured data to your local machine.

Quick Start

Run the recording example script:

python ~/Downloads/projectaria_client_sdk_samples_gen2/device_record.py

The script will start a recording, wait for user input to stop, then download the recording.


What This Example Does

The script performs the following operations:

  1. Connects to the device
  2. Configures recording settings (profile, name)
  3. Starts recording on the device
  4. Waits for user to press Enter to stop
  5. Stops the recording
  6. Lists available recordings
  7. Downloads the most recent recording to your local machine

Code Walkthrough

Step 1: Import Required Modules

import argparse
import time
import aria.sdk_gen2 as sdk_gen2

Step 2: Parse Command-Line Arguments

def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument(
"--output",
dest="output_path",
type=str,
default="",
required=False,
help="Output directory to save the recording",
)
parser.add_argument(
"--duration",
dest="duration",
type=int,
default=10,
required=False,
help="Recording duration in seconds (default: 10)",
)
return parser.parse_args()

Available Options:

  • --duration: Duration of the recording
  • --output: Directory where the recording will be downloaded

Step 3: Connect to Device

device_client = sdk_gen2.DeviceClient()
config = sdk_gen2.DeviceClientConfig()
device_client.set_client_config(config)

try:
device = device_client.connect()
print(f"Successfully connected to device {device.connection_id()}")
except Exception:
print("Failed to connect to device and record")
return

This establishes a connection to the first available device.


Step 4: Configure Recording

recording_config = sdk_gen2.RecordingConfig()
recording_config.recording_name = "example_recording"
recording_config.profile_name = "profile9"
device.set_recording_config(recording_config)

RecordingConfig Options:

  • profile_name: The sensor configuration profile (profile8, profile10)
  • recording_name: A descriptive name for your recording

For profile details, see the Profiles Technical Specification.


Step 5: Start Recording

uuid = device.start_recording()
print(f"Start recording for {duration} seconds with uuid: {uuid}")
print("Recording started. Press Enter to stop recording...")
input()

What happens:

  • start_recording() begins capturing sensor data on the device
  • The recording continues until stop_recording() is called
  • Data is stored on the device's internal storage

Step 6: Stop Recording

print("Stopping recording...")
device.stop_recording()
print("Recording stopped")

The stop_recording() method stops data capture and saves the recording with a unique UUID.


Step 7: List Recordings

device.list_recordings()

Step 8: Download Recording

device.download_recording(uuid=uuid, output_path=output_path)

Recording Information:

  • uuid: Unique identifier for the recording

Download Process:

  • download_recording(uuid, output_path) downloads the recording from device to PC
  • Downloaded files are in VRS format
  • Download time depends on recording size

Complete Example Code

Here's the full recording script:

import argparse
import time
import aria.sdk_gen2 as sdk_gen2

def device_record(duration, output_path):
device_client = sdk_gen2.DeviceClient()
config = sdk_gen2.DeviceClientConfig()
device_client.set_client_config(config)

# try to connect to the device
try:
device = device_client.connect()
print(f"Successfully connected to device {device.connection_id()}")

# Set recording config with profile name
print("Setup recording config")
recording_config = sdk_gen2.RecordingConfig()
recording_config.recording_name = "example_recording"
recording_config.profile_name = "profile9"
device.set_recording_config(recording_config)

# Start and stop recording
uuid = device.start_recording()
print(f"Start recording for {duration} seconds with uuid: {uuid}")
time.sleep(duration)
device.stop_recording()

# list existing recordings on device
print("List recordings")
device.list_recordings()

# download all recordings
print(f"Download recordings {uuid}")
device.download_recording(uuid=uuid, output_path=output_path)
except Exception:
print("Failed to connect to device and record")
return


def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument(
"--output",
dest="output_path",
type=str,
default="",
required=False,
help="Output directory to save the recording",
)
parser.add_argument(
"--duration",
dest="duration",
type=int,
default=10,
required=False,
help="Recording duration in seconds (default: 10)",
)
return parser.parse_args()


if __name__ == "__main__":
args = parse_args()
device_record(args.duration, args.output_path)

Recording Profiles

For complete profile specifications, see the Profiles Technical Specification.


Working with Downloaded Recordings

Visualize VRS Files

After downloading, visualize recordings using the viewer:

aria_rerun_viewer --vrs ~/Documents/recordings/<recording_name>.vrs

For more on data processing, see the Project Aria Tools documentation.


Troubleshooting

Recording Won't Start

Problem: start_recording() fails or hangs.

Solutions:

  1. Check device connection:

    device = device_client.connect()
  2. Stop existing recording:

    device.stop_recording()
    time.sleep(2)
    device.start_recording()

Next Steps