video-promo/render_all.py

42 lines
1001 B
Python

"""Render all promo scenes with Manim."""
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).parent
SCENES = [
("transformer.py", "Transformer"),
("architecture.py", "Architecture"),
("continuous_batching.py", "ContinuousBatching"),
("prefix_cache.py", "PrefixCache"),
]
def render(file_name, scene_name, quality="-qh"):
script_path = ROOT / file_name
media_dir = ROOT / "output"
cmd = [
sys.executable,
"-m",
"manim",
str(script_path),
scene_name,
quality,
"--media_dir",
str(media_dir),
]
print(f"Rendering {scene_name}...")
subprocess.run(cmd, check=True)
print(f" Done → {media_dir / 'videos' / scene_name.lower()}.mp4")
if __name__ == "__main__":
quality = "-qh" # 1080p; use -l for draft, -4k for ultra
if len(sys.argv) > 1:
quality = sys.argv[1]
for f, s in SCENES:
render(f, s, quality)
print("All scenes rendered.")