# Hybrid scene backgrounds with ChatGPT Image/Codex

Use this when producing final-near educational/social shorts where the core value is a clear mechanism reveal, not cinematic realism alone.

## Core pattern

```text
FinalVoiceoverScript
→ FinalVideoPlan
→ SceneBackgroundPlan
→ ChatGPT Image/Codex text-free backgrounds
→ deterministic motion renderer overlays
→ TTS + renderer-owned subtitles
→ FFmpeg assembly
```

AI image/video tools provide mood, texture, and scene-specific atmosphere. The deterministic renderer owns all truth-bearing content: labels, arrows, UI text, email content, numbers, subtitles, captions, and calls to action.

## When to prefer ChatGPT Image/Codex over local Qwen/ComfyUI

Prefer ChatGPT Image/Codex for keyframes/backgrounds when:

- local GPU memory is also needed for a video model or other workload;
- the shot only needs text-free background texture;
- speed and iteration matter more than local model purity;
- generated text would be risky and should be avoided entirely.

Local Qwen/ComfyUI remains useful for fully local/offline workflows or when the user explicitly wants local generation. Do not default to local Qwen if Codex image generation is available and cheaper/faster for simple backgrounds.

## Prompt guardrails

Each scene background prompt should explicitly include:

- `Vertical 9:16`
- scene-specific atmosphere, e.g. clean demo / weird email / wrong routing / three-way split / final rule
- `no readable text`
- `no logos`
- `no watermarks`
- `no UI labels`
- `no fake letters`
- `leave central negative space for renderer-owned overlays`

## Planning artifact

Use a pure, side-effect-free `SceneBackgroundPlan` before calling an image generator. Recommended fields per asset:

```text
scene_id
provider = chatgpt_image_codex
prompt
output_path
renderer_owned_overlay_required = True
```

Validation should reject side effects, external calls, non-PNG outputs, duplicate scene IDs, prompts that do not explicitly forbid readable text/logos, and assets that do not require renderer-owned overlays.

## Renderer integration

The motion renderer should accept a mapping rather than one global background:

```python
background_paths = {
    "clean-demo": ".../clean-demo.png",
    "weird-email": ".../weird-email.png",
    "wrong-routing": ".../wrong-routing.png",
    "three-way-split": ".../three-way-split.png",
    "final-rule": ".../final-rule.png",
}
```

This keeps visual variety high while preserving deterministic overlays.

## QA checklist

Before sending the review clip:

- verify audio duration and video duration are aligned;
- extract representative frames, especially the densest mechanism scene;
- visually check mobile readability, subtitle overlap, clipping, and fake text/logos;
- ensure the key mechanism is clearer than a static card;
- keep generated media ignored by Git; commit only code, tests, and docs.

## Beginner-friendly correction

If the user says the clip feels too abstract or not suitable for AI beginners, pivot the script and visuals to a concrete everyday failure first. Example: `one weird email arrives`, missing name, wrong format, unclear request. Then reveal the system principle (`Go through / Review / Stop`). Do not polish abstract architecture language before this rewrite.