This repository contains a Bash script for automating a photogrammetry workflow on macOS. It takes video files as input and uses FFmpeg and COLMAP to generate a 3D sparse point cloud.
This script is a modified version of AeroGenesiX’s modified version of Polyfjord’s original Windows batch script, rewritten to run smoothly on macOS systems.
- One-Command Automation: Processes all videos in the input folder in a single run.
- GPU Acceleration: Utilizes Apple Silicon GPU support in COLMAP for faster processing.
- Frame Range Fix: Corrects the “2× frame range” issue that appears on some macOS setups.
- Error Handling: Skips already processed videos and ensures the workflow executes step by step without breaking.
- Organized Output: Keeps results clean with a structured project folder.
- Apple Silicon Ready: Tested on MacBook Air M4 with Homebrew’s COLMAP build, and should work on other macOS systems too.
-
COLMAP – Structure-from-motion and multi-view stereo pipeline.
-
FFmpeg – For frame extraction.
- Recommended installation via Homebrew:
brew install ffmpeg colmap
- Or via Conda:
conda install -c conda-forge colmap
- Recommended installation via Homebrew:
Project_Folder/
├── VIDEOS/ # Place input video files (.mp4, .mov) here.
├── SCENES/ # The script saves all outputs here.
└── SCRIPTS/ # The run_colmap.sh script lives here.
-
Set Up Folders: Create the structure shown above.
-
Add Videos: Copy your
.mp4or.movfiles into theVIDEOS/folder. -
Save the Script: Place the script (
run_colmap.sh) in theSCRIPTS/folder. -
Update Paths: Edit the script and update these variables to match your system installation: (If installed via Homebrew only, both are usually in `/opt/homebrew/bin/.) If you are unable to find paths, run these command to find where colmap and ffmpeg binaries are located
which colmap ffmpeg -
Make it Executable:
chmod +x run_colmap.sh
-
Run the Script: From inside the
SCRIPTS/folder:./run_colmap.sh
-
COLMAP not found: Run which colmap and update the script path.
-
FFmpeg not found: Run which ffmpeg and update the script path.
-
Slow processing: If it feels too slow, downscale your input video or reduce --SiftExtraction.max_image_size in the script (e.g., from 4096 → 2048).
-
GPU out of memory: Try lowering the frame size as above, or process shorter clips.
I’ve also successfully adapted Polyfjord’s batch script to run with GLOMAP on macOS. I’ll provide updates and documentation for that workflow when I get more time.