Add gnommo.sh wrapper and fix slide/scaling issues
gnommo.sh: - Bash wrapper for easy CLI usage - Commands: validate, transcribe, align, render, all - `gnommo.sh -p video1 all` runs full pipeline Slide scaling: - Slides now scale to full frame (1920x1080) - Transparent areas show through to layers below - Positioned at 0,0 for full overlay targetheight percentage: - Supports percentage values like "100%" - Calculates actual height from frame resolution - "100%" on 1080p = 1080px height Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+11
-7
@@ -128,7 +128,11 @@ def build_filter_complex(
|
||||
|
||||
# Scale and position talking head
|
||||
th_config = plan.config.talking_head
|
||||
th_height = th_config.target_height if th_config.target_height > 0 else height
|
||||
if th_config.target_height > 0:
|
||||
th_height = th_config.target_height
|
||||
else:
|
||||
# Percentage-based: calculate from frame height
|
||||
th_height = int(height * th_config.target_height_percent)
|
||||
|
||||
filters.append(
|
||||
f"[{talking_head_idx}:v]scale=-1:{th_height}[head]"
|
||||
@@ -142,24 +146,24 @@ def build_filter_complex(
|
||||
current_label = "base"
|
||||
|
||||
# Add slide overlays with time-based enable
|
||||
# Slides are scaled to full frame - transparency shows layers below
|
||||
for i, event in enumerate(plan.slide_events):
|
||||
slide_idx = slide_start_idx + slide_inputs.index(event.slide_id)
|
||||
layout = SLIDE_LAYOUTS.get(event.slide_def.type, SLIDE_LAYOUTS["square"])
|
||||
|
||||
# Scale slide to fit layout while preserving aspect ratio
|
||||
# Scale slide to full frame size (transparent areas show through)
|
||||
slide_label = f"s{i}"
|
||||
filters.append(
|
||||
f"[{slide_idx}:v]scale={layout['width']}:{layout['height']}:"
|
||||
f"force_original_aspect_ratio=decrease[{slide_label}]"
|
||||
f"[{slide_idx}:v]scale={width}:{height}:"
|
||||
f"force_original_aspect_ratio=decrease,pad={width}:{height}:(ow-iw)/2:(oh-ih)/2:color=0x00000000[{slide_label}]"
|
||||
)
|
||||
|
||||
# Overlay with time-based enable
|
||||
# Overlay at 0,0 (full frame) with time-based enable
|
||||
next_label = f"v{i}" if i < len(plan.slide_events) - 1 else "vout"
|
||||
enable_expr = f"between(t,{event.start_time:.3f},{event.end_time:.3f})"
|
||||
|
||||
filters.append(
|
||||
f"[{current_label}][{slide_label}]overlay="
|
||||
f"x={layout['x']}:y={layout['y']}:"
|
||||
f"x=0:y=0:"
|
||||
f"enable='{enable_expr}'[{next_label}]"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user