Problem
Currently every phrase in a song generates a unique video segment. A typical 4-minute track has ~15 segments, but many are repeated section types (Drop 1 = Drop 2, Buildup 1 = Buildup 2).
Proposal
Modify _plan_segments() in pipeline.py to detect repeated section types within a single track and reuse the first generated video for subsequent identical sections.
Add a segment_reuse_map keyed by (section_label, energy_bucket, mood_quadrant). When a new segment matches an existing key, copy/symlink the existing video instead of regenerating.
Impact
- Reduces unique segments per track from ~15 to ~6
- Saves ~60% of video generation cost per track
- Zero quality tradeoff for repeated sections
Files to Modify
src/pipeline.py -- _plan_segments() and generate_for_track()
src/generator/cache.py -- extend cache key for intra-track reuse
Cost Impact
| Before |
After |
Savings |
| $23/track |
$9.60/track |
58% |
| $115,000 / 5K tracks |
$48,000 / 5K tracks |
$67,000 |
Labels: cost-optimization, high-priority
Problem
Currently every phrase in a song generates a unique video segment. A typical 4-minute track has ~15 segments, but many are repeated section types (Drop 1 = Drop 2, Buildup 1 = Buildup 2).
Proposal
Modify
_plan_segments()inpipeline.pyto detect repeated section types within a single track and reuse the first generated video for subsequent identical sections.Add a
segment_reuse_mapkeyed by(section_label, energy_bucket, mood_quadrant). When a new segment matches an existing key, copy/symlink the existing video instead of regenerating.Impact
Files to Modify
src/pipeline.py--_plan_segments()andgenerate_for_track()src/generator/cache.py-- extend cache key for intra-track reuseCost Impact
Labels: cost-optimization, high-priority