Add live video streaming for in-progress renders

This commit is contained in:
giles
2026-02-03 00:27:19 +00:00
parent 9302283e86
commit a57be27907
2 changed files with 46 additions and 2 deletions

View File

@@ -255,7 +255,12 @@ def run_stream(
# Create temp directory for work
work_dir = Path(tempfile.mkdtemp(prefix="stream_"))
recipe_path = work_dir / "recipe.sexp"
output_path = work_dir / output_name
# Write output to shared cache for live streaming access
cache_dir = Path(os.environ.get("CACHE_DIR", "/data/cache"))
stream_dir = cache_dir / "streaming" / run_id
stream_dir.mkdir(parents=True, exist_ok=True)
output_path = stream_dir / "output.mp4" # Always mp4 for streaming
# Create symlinks to effect directories so relative paths work
(work_dir / "sexp_effects").symlink_to(sexp_effects_dir)
@@ -438,7 +443,9 @@ def run_stream(
}
finally:
# Cleanup temp directory
# Cleanup temp directory and streaming directory
import shutil
if work_dir.exists():
shutil.rmtree(work_dir, ignore_errors=True)
if stream_dir.exists():
shutil.rmtree(stream_dir, ignore_errors=True)