Adding fixes to the pipeline

This commit is contained in:
2026-03-14 21:29:59 +01:00
parent b6bc5a0463
commit 6949124fa7
6 changed files with 236 additions and 201 deletions
+13 -7
View File
@@ -269,17 +269,23 @@ def build_ffmpeg_command(plan: RenderPlan, output_path: Path) -> list[str]:
always_visible_inputs.append(input_idx)
input_idx += 1
# Input: background image/video (if specified)
from .cache import resolve_with_cache
bg_file = plan.config.background or plan.config.background_video
has_background = bool(bg_file)
# Input: background — resolved via handle in shared_assets/videos.json
import json as _json
bg_handle = plan.config.background
has_background = bool(bg_handle)
bg_idx = None
bg_is_image = False
if has_background:
bg_path = project_path / bg_file
bg_path, _ = resolve_with_cache(bg_path, project_path)
shared_assets_dir = project_path.parent / "shared_assets"
videos_json_bg = shared_assets_dir / "videos.json"
if not videos_json_bg.exists():
raise RenderError(f"shared_assets/videos.json not found (needed for background handle '{bg_handle}')")
bg_videos = _json.loads(videos_json_bg.read_text())
if bg_handle not in bg_videos:
raise RenderError(f"Background handle '{bg_handle}' not found in shared_assets/videos.json")
bg_path = shared_assets_dir / bg_videos[bg_handle]["source_file"]
if not bg_path.exists():
bg_path = project_path.parent / bg_file
raise RenderError(f"Background file not found: {bg_path} (from handle '{bg_handle}')")
image_extensions = {".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".webp"}
bg_is_image = bg_path.suffix.lower() in image_extensions
# Loop background videos infinitely