Skip to content

Commit

Permalink
demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Seeeeeyo committed Jan 21, 2025
1 parent 953513b commit 3577a8c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

A web-based 3D viewer for OpenCap motion capture data with automated video recording capabilities.

## Demo

[Watch Demo Video](./demo/sub2.webm)

This demo shows:
- Side-by-side comparison of two animations
- Automatic camera angle changes
- 3D model visualization with labels
- Smooth playback and transitions

## Features

- Load and visualize OpenCap JSON files in 3D
Expand Down
14 changes: 11 additions & 3 deletions automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def automate_recording(json1_path, json2_path, output_video_path, wait_time=5, n

# Set download directory to current directory
download_dir = os.path.dirname(os.path.abspath(output_video_path))
output_filename = os.path.basename(output_video_path)
chrome_options.add_experimental_option("prefs", {
"download.default_directory": download_dir,
"download.prompt_for_download": False,
Expand All @@ -55,6 +56,9 @@ def automate_recording(json1_path, json2_path, output_video_path, wait_time=5, n
# Wait for models to load
time.sleep(wait_time)

# Set the recording filename using JavaScript
driver.execute_script(f"document.querySelector('#app').__vue__.$children[0].recordingFileName = '{output_filename}';")

# Get the canvas element for mouse interactions
canvas = driver.find_element(By.CSS_SELECTOR, "#mocap canvas")

Expand Down Expand Up @@ -115,10 +119,14 @@ def automate_recording(json1_path, json2_path, output_video_path, wait_time=5, n
# Wait for download to complete
time.sleep(2)

# Move the downloaded file to the desired location
downloaded_file = os.path.join(download_dir, "animation-recording.webm")
# Move the downloaded file to the desired location if it has a different name
downloaded_file = os.path.join(download_dir, output_filename)
if not os.path.exists(downloaded_file):
old_file = os.path.join(download_dir, "animation-recording.webm")
if os.path.exists(old_file):
shutil.move(old_file, downloaded_file)

if os.path.exists(downloaded_file):
shutil.move(downloaded_file, output_video_path)
print(f"Video saved to: {output_video_path}")
else:
print("Warning: Recording file not found in downloads directory")
Expand Down
File renamed without changes.
Binary file removed output_video.webm
Binary file not shown.

0 comments on commit 3577a8c

Please sign in to comment.