OpenCap Visualizer CLI
A command-line tool for generating videos from OpenCap biomechanics JSON files. Convert your motion capture data into high-quality MP4 videos without manually opening a browser.
Features
- Headless video generation: Create videos programmatically from JSON files
- Multiple camera angles: Supports anatomical views (anterior, posterior, sagittal, etc.)
- Batch processing: Process multiple subjects simultaneously
- Customizable settings: Control loops, zoom, centering, and camera positioning
- High-quality output: Generates MP4 videos ready for sharing or analysis
Installation
pip install opencap-visualizer-cli
Prerequisites
The tool requires:
- Python 3.8+
- Playwright browsers (automatically installed)
- FFmpeg (for video conversion)
After installation, run the setup command to install required browsers:
playwright install chromium
Quick Start
Generate a video from a JSON file:
opencap-visualizer data.json --output my_animation.mp4
Generate with specific camera angle and multiple loops:
opencap-visualizer data.json --output my_animation.mp4 --camera anterior --loops 3
Process multiple subjects:
opencap-visualizer subject1.json subject2.json subject3.json --output multi_subject.mp4
Usage
opencap-visualizer [JSON_FILES...] [OPTIONS]
Arguments
JSON_FILES: One or more OpenCap JSON files to visualize
Options
--output, -o: Output video filename (default: animation.mp4)--camera: Camera view angle (default: right)- Anatomical terms:
anterior,posterior,sagittal,superior,inferior,frontal,coronal - Directional terms:
front,back,left,right,top,bottom
- Anatomical terms:
--loops: Number of animation loops (default: 2)--zoom: Camera zoom factor (default: 1.5 for slight zoom out)--no-center: Disable automatic centering of subjects--width: Video width in pixels (default: 1920)--height: Video height in pixels (default: 1080)
Camera Views
The tool supports various anatomical viewing angles:
anterior/front: Front-facing view of the subjectposterior/back: Back view of the subjectsagittal/left/right: Side profile viewssuperior/top: Top-down viewinferior/bottom: Bottom-up viewfrontal/coronal: Coronal plane views
Examples
Basic usage:
opencap-visualizer walking_data.json
Custom output with back view:
opencap-visualizer squat_data.json --output squat_back_view.mp4 --camera posterior
Multiple subjects with specific settings:
opencap-visualizer person1.json person2.json \
--output comparison.mp4 \
--camera sagittal \
--loops 4 \
--zoom 2.0
High-resolution video:
opencap-visualizer data.json \
--output hd_video.mp4 \
--width 3840 \
--height 2160 \
--camera anterior
JSON File Format
The tool expects OpenCap JSON files with the following structure:
{
"time": [0.0, 0.033, 0.066, ...],
"bodies": {
"pelvis": {
"translation": [[x1, y1, z1], [x2, y2, z2], ...],
"rotation": [[rx1, ry1, rz1], [rx2, ry2, rz2], ...],
"attachedGeometries": [...]
},
"femur_r": {
"translation": [...],
"rotation": [...],
"attachedGeometries": [...]
}
}
}
Troubleshooting
Browser installation issues:
playwright install chromium --force
FFmpeg not found:
- macOS:
brew install ffmpeg - Ubuntu/Debian:
sudo apt-get install ffmpeg - Windows: Download from https://ffmpeg.org/
Large file processing: For large JSON files or long animations, increase timeout:
# The tool automatically adjusts timeouts based on file size
opencap-visualizer large_file.json --loops 1 # Reduce loops for faster processing
Web Interface
This CLI tool is built on top of the OpenCap Visualizer web application. You can also use the interactive web interface at: https://opencap-visualizer.onrender.com/
Support
- Issues: Report bugs and feature requests on GitHub
- Documentation: Full documentation available in the repository
- Community: Join discussions about OpenCap and biomechanics visualization
License
MIT License - see LICENSE.md for details.
Part of the OpenCap ecosystem - Tools for democratizing human movement analysis.
Metadata
Release files for opencap-visualizer-cli 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opencap_visualizer_cli-1.0.4.tar.gz | 7.8 kB | Without provenance | Details for opencap_visualizer_cli-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opencap_visualizer_cli-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for opencap_visualizer_cli-1.0.4-py3-none-any.whl |
Total release size: 15.7 kB
Release files / opencap_visualizer_cli-1.0.4.tar.gz
| Download URL | opencap_visualizer_cli-1.0.4.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
deca2a5d7945c1851db07b718ad2c5f5b5e16fd858c0a25374be1344f330dcbb
|
|
BLAKE2b-256 checksum How to use checksums |
6a8c9a511e7b6dbc61f23390a10e7e9ac1bd60aba9531e4843f79a2c53cffe1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / opencap_visualizer_cli-1.0.4-py3-none-any.whl
| Download URL | opencap_visualizer_cli-1.0.4-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ec65f341fde50c7354c77fba89a90d1e22ea36b02dad345167bad58b8f2981e
|
|
BLAKE2b-256 checksum How to use checksums |
942a2f08bfae4fa8fa308e3ab0ab31d973051dd9207c90c25b35b2c4dcdf843d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for opencap-visualizer-cli 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.