A web-based 3D viewer for OpenCap motion capture data with automated video recording capabilities.
This demo shows:
- Side-by-side comparison of two animations
- Automatic camera angle changes
- 3D model visualization with labels
- Smooth playback and transitions
- Load and visualize OpenCap JSON files in 3D
- Compare two animations side by side
- Adjustable offsets in X, Y, and Z directions
- Color-coded models with labels
- Video recording with multiple camera angles
- Playback speed control
- Interactive timeline
- Node.js (v14 or higher)
- Python 3.7+
- Google Chrome browser
- npm or yarn
- Install Node.js dependencies:
npm install
- Create and activate a Python virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install Python dependencies:
pip install -r requirements.txt
- Start the development server:
npm run serve
- The viewer will be available at
http://localhost:3000
- Open the viewer in your browser
- Load your JSON files
- Use the controls to:
- Adjust model positions using offset controls
- Control playback using the timeline
- Adjust playback speed
- Record videos using the record button
Use the Python script to automate the recording process:
python automation.py path/to/first.json path/to/second.json output_video.webm
Optional arguments:
--wait
: Adjust loading wait time (default: 5 seconds)--loops
: Number of camera angle changes (default: 3)
Example:
python automation.py test1.json test2.json comparison.webm --wait 10 --loops 4
The automated recording cycles through these views:
- Front view (0°)
- Side view (90°)
- Back view (180°)
- High angle diagonal view (45°)
The viewer expects OpenCap JSON files with the following structure:
{
"time": [...],
"bodies": {
"body_name": {
"translation": [...],
"rotation": [...],
"attachedGeometries": [...]
}
}
}
-
If the video doesn't download:
- Check Chrome's download permissions
- Ensure the output directory is writable
-
If models don't appear:
- Verify JSON file format
- Check browser console for errors
- Increase the wait time using
--wait
-
If camera controls don't work:
- Ensure the browser window is focused
- Try refreshing the page
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request