Skip to main content

Convert 2D videos to stereoscopic 3D spatial videos for Apple Vision Pro using AI depth estimation

Project description

Spatial Video Maker

Convert 2D videos to stereoscopic 3D spatial videos for Apple Vision Pro using AI depth estimation. Runs locally on macOS with Apple Silicon Metal acceleration.

Installation

uv tool install spatial-maker

Requirements

  • macOS with Apple Silicon (for Metal acceleration)
  • ffmpeg with VideoToolbox support
  • spatial CLI for MV-HEVC output
brew install ffmpeg spatial

Model Checkpoints

Download Depth Anything V2 checkpoints:

mkdir -p ~/.spatial-maker/checkpoints

# Small (fastest, 24.8M params)
curl -L -o ~/.spatial-maker/checkpoints/depth_anything_v2_vits.pth \
  https://huggingface.co/depth-anything/Depth-Anything-V2-Small/resolve/main/depth_anything_v2_vits.pth

# Base (balanced, 97.5M params)
curl -L -o ~/.spatial-maker/checkpoints/depth_anything_v2_vitb.pth \
  https://huggingface.co/depth-anything/Depth-Anything-V2-Base/resolve/main/depth_anything_v2_vitb.pth

# Large (best quality, 335.3M params)
curl -L -o ~/.spatial-maker/checkpoints/depth_anything_v2_vitl.pth \
  https://huggingface.co/depth-anything/Depth-Anything-V2-Large/resolve/main/depth_anything_v2_vitl.pth

You only need the model sizes you plan to use. vits (small) is a good default.

Usage

# Single file
spatial-maker video.mp4

# Specify output path
spatial-maker video.mp4 -o output_spatial.mov

# Process all videos in a folder
spatial-maker /path/to/videos/

Options

# Depth model size: vits (fast), vitb (balanced), vitl (best)
spatial-maker video.mp4 --encoder vitl

# 3D intensity in pixels (20-50 recommended)
spatial-maker video.mp4 --max-disparity 40

# Process only first 10 seconds (for testing)
spatial-maker video.mp4 --duration 10

# Skip downscaling (if input is already 1080p@24fps)
spatial-maker video.mp4 --skip-downscale

# Keep intermediate files
spatial-maker video.mp4 --keep-intermediate

# JSON progress output (for GUI integration)
spatial-maker video.mp4 --json-progress

Pipeline

Input 2D Video
    |
[Downscale to 1080p @ 24fps]
    |
[Depth estimation + stereo pair creation (Depth Anything V2 + DIBR)]
    |
[Audio extraction + muxing]
    |
[MV-HEVC spatial video via spatial CLI]
    |
Spatial Video (.mov)

Parameters

Parameter Description Recommended
--encoder Depth model size (vits/vitb/vitl) vits for speed, vitl for quality
--max-disparity 3D intensity in pixels 20-50 for 1080p
--duration Limit processing time (seconds) Use for testing
--skip-downscale Keep original resolution Only if already 1080p
--json-progress Emit JSON progress to stdout For GUI integration

3D Intensity Guide

  • 20-30: Subtle, comfortable for long viewing
  • 30-40: Moderate, good balance
  • 40-50: Strong, more immersive

Development

git clone https://github.com/mrgnw/spatial-maker.git
cd spatial-maker
uv sync
uv run spatial-maker video.mp4

Acknowledgments

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spatial_maker-0.1.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spatial_maker-0.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file spatial_maker-0.1.0.tar.gz.

File metadata

  • Download URL: spatial_maker-0.1.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.9

File hashes

Hashes for spatial_maker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 625d10e7dc17e346dd4f4afbe0975f5d5d2a75cd54bc8faa29b698880b9382d2
MD5 82e0d01cabfbd39657fdf152f782cc1d
BLAKE2b-256 fca7f426a9a9487955a717d1f105838987f2f6f4a8dcc51fba385079fa70c4e0

See more details on using hashes here.

File details

Details for the file spatial_maker-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spatial_maker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cfd4033d6a3f852ba61495ecaf3dfcb5ec13f1b41d57629696a871102a9cccf
MD5 ae5c2f8eba2dd0aeb35d5c4d634f144e
BLAKE2b-256 69f1ebefcc19a6d56b722af0f3701c3debb5685805d2bbf1d79a5616d92caecb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page