Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 1.7 KB

File metadata and controls

50 lines (38 loc) · 1.7 KB

Revised Plan: Fix Transition Size Bug + Full Encode

Problem

MovieGo's Sequence (used for crossfades) enforces that all clips sharing a transition have identical pixel dimensions:

composite/transition.go:81
if a.Size() != b.Size() { return ErrTransitionSize }

Our resize logic computes newW = srcW * targetH / srcH per image. Different source aspect ratios produce slightly different integer widths (1613–1620px), which causes crossfades to fail at runtime.

Fix

After resizing to target height, pad narrower images to exact target width with black bars so every output image is exactly targetW × targetH.

// After BiLinear.Scale(...)
if newW < targetW {
    padded := image.NewRGBA(image.Rect(0, 0, targetW, targetH))
    draw.Draw(padded, padded.Bounds(), &image.Uniform{color.Black}, image.Point{}, draw.Src)
    draw.Draw(padded, dst.Bounds(), dst, image.Point{}, draw.Src)
    dst = padded
}

Also add "image/color" back to imports for color.Black.

Steps

# Action Detail
1 Install ffmpeg sudo apt-get install -y ffmpeg
2 Clean stale resized rm -rf /home/chaschel/Documents/go/teaser/resized
3 Fix main.go Add padding step + "image/color" import
4 Build go build -o teaser .
5 Run encode ./teaser -src /home/chaschel/Documents/odyssey -step 4
6 Verify Check teaser.mp4 duration and file size

Reference

  • MovieGo source: /home/chaschel/Documents/go/moviego-main
  • Transition size constraint: composite/transition.go:81
  • ConcatCompose handles mixed sizes by centering on max canvas (composite/concat.go)
  • But SequenceConcatChain requires same-size clips for transitions