# -*- coding: utf-8 -*-
"""One-off CPU vs GPU render benchmark: same subs.ass, same audio graph,
different encoder. Writes to a throwaway path so it never touches the
approved output file."""
import importlib.util
import json
import sys
import time
from pathlib import Path

sys.stdout.reconfigure(encoding="utf-8")

spec = importlib.util.spec_from_file_location("make_movie", r"C:\ai\AUTOMOVIE\make_movie.py")
mm = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mm)

mm.OUT_HD = Path(r"C:\Users\segaa\AppData\Local\Temp\claude\C--ai-AUTOMOVIE\bdf7a8c6-d815-423c-84a6-2474df26f790\scratchpad\gpu_bench_1080p.mp4")

narr = json.loads(Path(r"C:\ai\AUTOMOVIE\build\narration.json").read_text(encoding="utf-8"))

print(f"ffmpeg binary: {mm.FFMPEG}")
print(f"encoder probe: {mm.pick_encoder()}")

t0 = time.time()
mm.stage_render(narr, hd=True)
dt = time.time() - t0
print(f"\nGPU render wall time: {dt:.1f}s  ({dt/60:.2f} min)")
