Sprite Character Presenter
Build deterministic 1920×1080 (30 fps) presentation videos featuring a 2D chibi/cartoon sprite presenter walking between slide margins, talking with pupil-aligned 6-viseme lip-sync and natural blinks, pointing with a glowing laser pointer, syncing 1× embedded GIF animations, and closing with a front-facing 90° bow.
Pair with:
vercel-gateway-voice-cloningwhen narrating with a cloned voice (Fish Audio S2.1 Pro or Voxtral Mini TTS).Garinmckayl/animawhen generating short scientific/mechanism animation GIF clips to embed and sync 1× inside slides viascripts/extract_slides.py --gif.
Directory Layout
Create a working directory (e.g., video_work/) with:
video_work/
├── script.json # Slide timing, poses, laser cues, GIF anchors
├── sprites/
│ ├── sheet_poses.jpg # 6 poses on solid #00FF00 green screen
│ ├── sheet_mouths_eyes.jpg # 6 visemes + closed-eye blink + happy eyes
│ ├── sheet_turnaround.jpg # 5 angles: front, q3_left, side_left, back, q3_right
│ ├── sheet_walk.jpg # 8 walk frames facing right
│ └── sheet_bow.jpg # (optional) 2 front-facing frames: bow_mid, bow_90
├── slides/ # Generated by scripts/extract_slides.py
├── audio/ # Generated by edge-tts or vercel-gateway-voice-cloning
└── remotion/ # Copied from scripts/remotion-template/
Sprite Sheet Rules
- Solid bright green
#00FF00background with no shadows or gradient; avoid green clothing on the character. - Resolution scaling:
scripts/cut.pyandscripts/face.pyautomatically scale connected-componentminpxand pupil search bounds for both1280×720and1024×576sheets. - Front-facing 90° bow (
sheet_bow.jpg): Generate 2 side-by-side front-facing frames on#00FF00— polite 35° bow (pose_bow_mid) and deep 90° bow (pose_bow_90).scripts/cut.pyappliesbow_mid's scale factor tobow_90so the character bends downward naturally on the red feet baseline rather than stretching back up toTARGET_H. - Horizontal flip derivation:
pose_point_right,turn_side_right,walkL_0..7,face_point_right_m0..5, andblink_point_rightare derived automatically by flipping aroundFX = CW / 2 = 450.
End-to-End Workflow
1. Cut Sprites and Composite Lip-Sync Faces
python3 scripts/cut.py --work-dir ./video_work
python3 scripts/face.py --work-dir ./video_work
Inspect video_work/sprites/preview/cuts.png, bow_check.png, and mouth_neutral.png before proceeding. Confirm every character's feet sit cleanly on the red baseline and no halo or misaligned mouth patch appears.
2. Export PPTX Slides and 1× GIF MP4s
Requires LibreOffice (soffice), Poppler (pdftoppm), and ffmpeg.
python3 scripts/extract_slides.py \
--pptx /path/to/deck.pptx \
--out-dir ./video_work/slides \
--gif 5=/path/to/anim_slide5.gif \
--gif 6=/path/to/anim_slide6.gif
extract_slides.py parses <p:pic> coordinates directly from ppt/slides/slideN.xml, transcodes each GIF to deterministic 30 fps CFR H.264 MP4 (crf 14), extracts first/last freeze frames (_start.png, _end.png), and writes slides/layout_meta.json.
3. Generate Narration Audio + Lip-Sync Cues
- Fast prototype: Generate audio with
edge-tts(-rate=+0%) and analyze lip-sync cues. - Cloned voice (recommended for final): Use the companion
vercel-gateway-voice-cloningskill (fish-audio/s2.1-prowith lossless WAV + pure 2-pass linear-18 LUFSnormalization) to populatevideo_work/audio/<id>_44k.wav,video_work/audio/<id>_cues.json, andvideo_work/audio/manifest.json. - macOS Rhubarb SIGSEGV fallback: Rhubarb v1.14.0 (
x86_64) crashes withSIGSEGVunder Rosetta 2 on Apple Silicon. Use the native Python RMS + Zero-Crossing Rate 30 fps viseme analyzer (included invercel-gateway-voice-cloning/scripts/audio_utils.py), which emits the exact RhubarbmouthCuesJSON schema (X,A–F).
4. Compile Timeline
Write video_work/script.json (see examples/script.example.json), then compile:
python3 scripts/build_timeline.py --work-dir ./video_work --fps 30
Key timeline guarantees:
- 1× GIF sync: Segments with
gifAnchorSecandgifMaxEndSecassert that narration never overruns its visual milestone window. - Freeze frames: Slides with
gifMode: "freeze_end"hold the final GIF frame cleanly after playback ends;"freeze_start_and_end"holds the first frame during pre-GIF intro narration and the last frame afterward. - Laser pointer placement: Place
laserCuescoordinates (x,yin 1920×1080 space) slightly left of bullet text or on diagram elements so the glowing red dot highlights without obscuring text. - Additive closing bow: Setting
"closingBow": trueon the final slide runs: 45f unobstructed slide → 36f backdrop dim + walk to center (x=960,scale=1.30) → front-facing closing line → 12f bow transition → 75fpose_bow_90hold.
5. Render in Remotion and Run QA
Copy scripts/remotion-template/ to video_work/remotion/, symlink sprites/png, slides, and audio into remotion/public/, install dependencies, and render:
cp -R scripts/remotion-template ./video_work/remotion
cd ./video_work/remotion
mkdir -p public
ln -sfn ../../sprites/png public/sprites
ln -sfn ../../slides public/slides
ln -sfn ../../audio public/audio
npm install
npx remotion render Presenter ../rendered/presentation_final.mp4 --codec=h264 --crf=18 --concurrency=4
Then extract QA stills and 1× continuous audio-on review clips:
python3 scripts/qa_render.py rendered/presentation_final.mp4 rendered/qa_final --work-dir ./video_work
Common Pitfalls
| Symptom | Cause | Fix |
|---|---|---|
expected N figures, found M in cut.py | Sheet resolution differs or extra noise blob | Check scale_minpx or remove stray markings on green screen |
bow_90 stretches taller than bow_mid | Normalized independently to TARGET_H | Always cut both via cut_bow_sheet() sharing bow_mid's scale |
| Rhubarb crashes with signal 11 on macOS | x86_64 binary under Rosetta 2 | Use native Python RMS+ZCR viseme analyzer instead |
| GIF drifts out of sync with narration | Looping or variable-framerate GIF | Transcode via extract_slides.py (-fps_mode cfr -r 30) and anchor with gifAnchorSec |
| Character overlaps slide text | Static right-margin X on dense slides | Vary characterX, characterSide, and characterScale (e.g. 0.56–0.72) per slide |