# Hyperframe Video Creation

Generate short videos with Python + MoviePy + NumPy + ffmpeg. Title cards, generative art, multi-scene composition, synthesised orchestral audio, and animated GIFs with Pillow.

**When to use this**
Quick video prototypes, branded content, generative art clips, title cards, warnings, animated announcements, and compositing layers. Not for long-form editing or live-action production.

**The process**

1. **Plan scenes.** Define each scene as a frame function (time → HxWx3 numpy array) or as a composite of text clips over coloured backgrounds.
2. **Build clips.** Use ColorClip for backgrounds, TextClip for titles, VideoClip for procedural art. Position with absolute, relative, or centre coordinates.
3. **Compose.** CompositeVideoClip layers multiple clips. concatenate_videoclips chains scenes sequentially.
4. **Add audio (optional).** Generate synthesised drone audio as a numpy array (sine waves at harmonic frequencies with envelope shaping). Mix narration over drone with CompositeAudioClip.
5. **Render.** Write to MP4 with libx264 codec. 1280x720 for standard delivery, 640x360 for test clips.
6. **For GIFs:** Use Pillow directly, not MoviePy. Pre-load all fonts, build frames per scene, save with disposal=2 to prevent ghost trails. Keep under 1MB for reliable messaging delivery.

**Under the hood**

**1. Frame generator** — creates procedural art via NumPy meshgrid operations (explosions, day/night cycles, caustics, gradients)
**2. Compositor** — assembles multi-scene videos with MoviePy, handles audio mixing and concatenation
**3. GIF animator** — builds frame-by-frame animated GIFs with Pillow, handles text effects, background compositing, and size optimisation

**Tips**
- Frame arrays must be uint8, shape (H, W, 3), values 0-255. Wrong dtype causes silent corruption.
- CompositeAudioClip does NOT auto-infer duration. Always call .with_duration() or it crashes.
- For branded GIFs: one font family, one line per slide, dark drop shadows only (never neon glow), and N iterations means N complete GIFs — not N static previews.
- 1280x560 cinematic wide format focuses attention on text for announcement-style GIFs.
- For chat and messaging delivery: keep GIFs under 1MB. Use 64-colour global palette quantisation to shrink file size.

**Tags:** Content Creation, Design, Music & Voice