From be224c1c91b1205be5b4a3d682e1b95fbe245b89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas94@gmx.net>
Date: Wed, 4 Jan 2023 10:27:08 +0100
Subject: [PATCH] `colmap2nerf.py`: only download ffmpeg and colmap if not
 installed system-wide

---
 scripts/colmap2nerf.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/colmap2nerf.py b/scripts/colmap2nerf.py
index 4dd0b9c..252ef3e 100755
--- a/scripts/colmap2nerf.py
+++ b/scripts/colmap2nerf.py
@@ -54,7 +54,9 @@ def do_system(arg):
 
 def run_ffmpeg(args):
 	ffmpeg_binary = "ffmpeg"
-	if os.name == 'nt':
+
+	# On Windows, if FFmpeg isn't found, try automatically downloading it from the internet
+	if os.name == "nt" and os.system(f"where {ffmpeg_binary} >nul 2>nul") != 0:
 		ffmpeg_glob = os.path.join(ROOT_DIR, "external", "ffmpeg", "*", "bin", "ffmpeg.exe")
 		candidates = glob(ffmpeg_glob)
 		if not candidates:
@@ -90,7 +92,9 @@ def run_ffmpeg(args):
 
 def run_colmap(args):
 	colmap_binary = "colmap"
-	if os.name == 'nt':
+
+	# On Windows, if FFmpeg isn't found, try automatically downloading it from the internet
+	if os.name == "nt" and os.system(f"where {colmap_binary} >nul 2>nul") != 0:
 		colmap_glob = os.path.join(ROOT_DIR, "external", "colmap", "*", "COLMAP.bat")
 		candidates = glob(colmap_glob)
 		if not candidates:
-- 
GitLab