Skip to content

feat(paper2video): group wrapped-line cues + card-aware ink-tighten spotlight - #25

Closed
LingAo Xiao (ArmandXiao) wants to merge 1 commit into
mainfrom
feat/paper2video-spotlight-ink-tighten
Closed

feat(paper2video): group wrapped-line cues + card-aware ink-tighten spotlight#25
LingAo Xiao (ArmandXiao) wants to merge 1 commit into
mainfrom
feat/paper2video-spotlight-ink-tighten

Conversation

@ArmandXiao

Copy link
Copy Markdown
Contributor

Summary

The video spotlight previously drew the shape's raw declared box (PPTX off/ext or a semantic estimate), so it either dropped a wrapped title's second line or spotlighted a lot of empty leading/padding. This makes the spotlight track the intended logical unit — tightly for text, fully for cards — via two composed stages:

  1. Wrapped-line grouping (generate_visual_cues.py) — before emitting a cue, union same-group single-line title/tagline fragments into the whole wrapped run, so a cue that matched one line spotlights the whole title/tagline. Multi-line paragraph blocks are never merged, preserving the script's per-chunk progression. Guarded by VIDEO_CUE_GROUP_WRAPPED_LINES + geometry knobs (WRAP_X_EPS, WRAP_MIN_ASPECT, WRAP_GAP_FRAC).
  2. Card-aware ink-tighten (render_video.py) — shrink each spotlight box to the painted ink (glyphs) for transparent text so it hugs the content, but keep a filled card/panel whole via robust detection: page bg = the dominant colour over a coarse grid of the source slide (robust to a corner accent bar, unlike sampling the four corners), and the box is a card when most of its border ring hugs one fill colour (close_frac, which survives a thin accent bar on one edge) that differs from the page bg. Feather/dim + card thresholds are env-tunable (same defaults); best-effort — degrades to the declared box without Pillow/numpy or on low confidence.

Architecture: grouping decides WHAT unit to highlight (structure domain); ink-tighten decides HOW tightly + preserves filled cards (pixel domain); per-chunk progression is untouched.

Files changed

  • ResearchStudio-Reel/skills/paper2video/scripts/render_video.py (+112): new _ink_tighten_box() (letterbox-aware, card detection), VisualCue.no_ink_tighten override, env-tunable feather/dim + card thresholds, wired into encode_segment's spotlight loop.
  • ResearchStudio-Reel/skills/paper2video/scripts/generate_visual_cues.py (+91): new union_wrapped_line_cues() + helpers, called once per slide before appending cues.

Validation (new vs upstream-main render, identical deck+audio+cues)

  • Loose/text deck (2607.05394) — a 2-line tagline split across boxes + loose labels + filled takeaway card: 23/23 spotlight frames change, avg 5.08% pixels. Tagline now covers both lines tightly, filled cards stay fully lit (right padding no longer dimmed), loose labels hug their glyphs.
  • Card-heavy deck (2607.04438, 10-min, 38 cues) — already-tight boxes: 37/38 frames byte-identical. Card-aware correctly preserves all 8 filled cards (no "hole in the card" regression), 1 minor text tighten. Confirms this is a backward-compatible superset — it only changes a box when there is something loose to hug or a card to preserve.

Known follow-up (not in this PR)

VIDEO_SPOTLIGHT_FEATHER_PX alone is dominated by the ratio term (min(1920,1080) * 0.052 = 56), so setting only FEATHER_PX does not change the feather. Making FEATHER_PX authoritative (and picking a tighter default) is a small follow-up.

…potlight

Spotlight now composes two stages instead of drawing the raw declared box:

- generate_visual_cues.py: union same-group single-line title/tagline
  fragments into the whole wrapped unit before emitting the cue, so a cue
  that matched one line spotlights the whole title/tagline. Multi-line
  paragraph blocks are never merged, preserving the script's per-chunk
  progression. Gated by VIDEO_CUE_GROUP_WRAPPED_LINES + geometry env knobs.

- render_video.py: shrink each spotlight box to the painted ink (glyphs) for
  transparent text so it hugs the content, but keep a filled card/panel whole
  via robust detection (dominant grid page_bg + border-ring uniformity that
  survives an accent bar). Feather/dim + card thresholds are now env-tunable
  (same defaults); best-effort, degrades to the declared box without
  Pillow/numpy or on low confidence.

Net: the spotlight tracks the intended logical unit tightly (text) or fully
(cards) instead of the loose declared box. Backward-compatible superset.
@ArmandXiao

Copy link
Copy Markdown
Contributor Author

Superseded by #43, which preserves this spotlight work while moving the generic PPTX-to-video runtime into the independently maintained top-level pptx2video package. Closing this PR in favor of the consolidated standalone extraction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant