Skip to main content

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
  • --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 subject
  • posterior / back: Back view of the subject
  • sagittal / left / right: Side profile views
  • superior / top: Top-down view
  • inferior / bottom: Bottom-up view
  • frontal / 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.

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)

Source distribution for opencap-visualizer-cli 1.0.4
File Size Uploaded
opencap_visualizer_cli-1.0.4.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opencap-visualizer-cli 1.0.4
File Interpreter ABI Platform
opencap_visualizer_cli-1.0.4-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page