Open-source AI podcast clipper. Generate vertical clips with face tracking and burned-in captions. CLI, MCP server, web app.
Python ai-toolsauto-captionscaptionscliffmpegmcpmcp-serveropusclip-alternativepodcast-clipspodcastsshortform-videovertical-videowhisper
fix: split-screen clustering, thumbnail styling, and outro-to-thumb transition
Nika Siradze7958c1744e3a
diff --git a/backend/cli.py b/backend/cli.pyindex 5d7fa1c..31defd4 100644--- a/backend/cli.py+++ b/backend/cli.py@@ -401,10 +401,10 @@ def cmd_process(args):)if paths:thumb_video = os.path.join(clip_thumb_dir, "thumb_frame.mp4")- _thumb_to_video(paths[0], thumb_video)+ _thumb_to_video(paths[0], thumb_video, duration=1.5)from services.video_processor import concat_outrofinal_with_thumb = result["output_path"].replace(".mp4", "_with_thumb.mp4")- concat_outro(result["output_path"], thumb_video, final_with_thumb, crossfade_duration=0.3)+ concat_outro(result["output_path"], thumb_video, final_with_thumb, crossfade_duration=0.15)os.replace(final_with_thumb, result["output_path"])print(f" + thumbnail appended ({len(paths)} variations in {os.path.basename(clip_thumb_dir)}/)")except Exception as e:diff --git a/backend/services/thumbnail_generator.py b/backend/services/thumbnail_generator.pyindex f8e61c4..891d18b 100644--- a/backend/services/thumbnail_generator.py+++ b/backend/services/thumbnail_generator.py@@ -578,16 +578,10 @@ def generate_thumbnail(x = (w - tw) // 2if line2_style == "highlight":- try:- draw.rounded_rectangle(- [x - hl_pad_x, y - hl_pad_y, x + tw + hl_pad_x, y + th + hl_pad_y],- radius=12, fill=(*accent_color, 255),- )- except AttributeError:- draw.rectangle(- [x - hl_pad_x, y - hl_pad_y, x + tw + hl_pad_x, y + th + hl_pad_y],- fill=(*accent_color, 255),- )+ draw.rectangle(+ [x - hl_pad_x, y - hl_pad_y, x + tw + hl_pad_x, y + th + hl_pad_y],+ fill=(*accent_color, 255),+ )draw.text((x, y), line, fill=(*dark_text, 255), font=font2)y += th + hl_pad_y * 2else:diff --git a/backend/services/thumbnail_html.py b/backend/services/thumbnail_html.pyindex c5150fb..f75be79 100644--- a/backend/services/thumbnail_html.py+++ b/backend/services/thumbnail_html.py@@ -36,29 +36,29 @@ def _load_config() -> dict:"frame_border_color": None, # None = accent# Text box- "box_x": "110px", # CSS left+ "box_x": "40px", # CSS left — near edge with safe area"box_y": "73%", # CSS top (no photo)"box_y_with_photo": "76%",- "box_width": "860px", # CSS width- "box_min_height": "220px",+ "box_width": "1000px", # CSS width — max width with safe areas+ "box_min_height": "180px","box_border_width": 3,"box_border_color": None, # None = accent"box_fill_color": "rgba(26,26,46,0.90)",- "box_padding": "28px 36px",+ "box_padding": "24px 32px",# Line 1 (top line — typically white text)- "line1_font_size": "64px",+ "line1_font_size": "56px","line1_font_weight": "600","line1_letter_spacing": "1px","line1_line_height": 1.15,- "line1_margin_bottom": "10px",+ "line1_margin_bottom": "8px","line1_uppercase": True,"line1_color": "#FFFFFF","line1_nowrap": True,# Line 2 (bottom line — highlighted)- "line2_font_size": "60px",- "line2_font_weight": "500",+ "line2_font_size": "52px",+ "line2_font_weight": "400","line2_font_style": "italic","line2_letter_spacing": "1px","line2_line_height": 1.15,@@ -364,7 +364,7 @@ body {{background: {hl_color};color: {l2_text_color};padding: {l2_hl_pad};- border-radius: 6px;+ border-radius: 0;display: inline-block;box-decoration-break: clone;-webkit-box-decoration-break: clone;diff --git a/backend/services/video_processor.py b/backend/services/video_processor.pyindex 1e4b972..3498845 100644--- a/backend/services/video_processor.py+++ b/backend/services/video_processor.py@@ -411,31 +411,38 @@ def _build_speaker_aware_crop(if len(face_observations) < 5:return None- # Cluster faces by position (left vs right)+ # Cluster faces by position (left vs right).+ # Simple split: faces in the left half vs right half of the frame.+ # This is more robust than radius-based clustering which can merge+ # faces that are close to the center line.positions = np.array([obs[1] for obs in face_observations])- cluster_radius = width * 0.20 # 20% of frame width — groups face positions with natural head movement+ mid_x = width // 2- clusters = []- used = np.zeros(len(positions), dtype=bool)- sorted_idx = np.argsort(positions)+ left_pos = positions[positions < mid_x]+ right_pos = positions[positions >= mid_x]- for idx in sorted_idx:- if used[idx]:- continue- mask = np.abs(positions - positions[idx]) < cluster_radius- mask &= ~used- if np.any(mask):- cluster_center = int(np.median(positions[mask]))- clusters.append({- "center_x": cluster_center,- "count": int(np.sum(mask)),- "crop_x": max(0, min(cluster_center - crop_w // 2, width - crop_w)),- })- used |= mask+ clusters = []+ if len(left_pos) >= 3:+ cx = int(np.median(left_pos))+ clusters.append({+ "center_x": cx,+ "count": len(left_pos),+ "crop_x": max(0, min(cx - crop_w // 2, mid_x - crop_w)),+ })+ if len(right_pos) >= 3:+ cx = int(np.median(right_pos))+ clusters.append({+ "center_x": cx,+ "count": len(right_pos),+ "crop_x": max(mid_x, min(cx - crop_w // 2, width - crop_w)),+ })if len(clusters) < 2:- if clusters:- return str(clusters[0]["crop_x"])+ # Not a clear split-screen — try single cluster from all positions+ if len(positions) >= 3:+ cx = int(np.median(positions))+ crop_x = max(0, min(cx - crop_w // 2, width - crop_w))+ return str(crop_x)return None# Sort clusters left to right@@ -986,52 +993,24 @@ def _detect_face_center(if not face_positions:return None- # Cluster face positions to detect split-screen layouts.- # Use a tighter radius (15%) so faces at 25% and 75% don't merge.+ # Detect split-screen: check if faces appear in both halvespositions = np.array(face_positions)- cluster_radius = width * 0.15-- clusters = []- used = np.zeros(len(positions), dtype=bool)- sorted_idx = np.argsort(positions)-- for idx in sorted_idx:- if used[idx]:- continue- mask = np.abs(positions - positions[idx]) < cluster_radius- mask &= ~used- if np.any(mask):- cluster_center = int(np.median(positions[mask]))- clusters.append({- "center_x": cluster_center,- "count": int(np.sum(mask)),- })- used |= mask-- if len(clusters) >= 2:- # Split-screen: faces in distinct horizontal groups.- # Pick the cluster with the most detections, then crop to- # that HALF of the frame (not just center on face — centering- # still shows the seam between cameras).- clusters.sort(key=lambda c: c["count"], reverse=True)- best_cx = clusters[0]["center_x"]-- # Snap to the half containing this face- if best_cx < width // 2:- # Left half: crop starts at 0- half_w = width // 2- face_x = best_cx # within the left half- else:- # Right half: crop starts at midpoint- half_w = width - width // 2- face_x = best_cx-- crop_x = face_x - crop_w // 2- # Clamp to stay within the chosen half- if best_cx < width // 2:- crop_x = max(0, min(crop_x, half_w - crop_w))+ mid_x = width // 2++ left_count = np.sum(positions < mid_x)+ right_count = np.sum(positions >= mid_x)++ if left_count >= 3 and right_count >= 3:+ # Split-screen — pick the side with the most detections,+ # clamp crop to that half so we never show the seam.+ if left_count >= right_count:+ side_pos = positions[positions < mid_x]+ face_x = int(np.median(side_pos))+ crop_x = max(0, min(face_x - crop_w // 2, mid_x - crop_w))else:- crop_x = max(width // 2, min(crop_x, width - crop_w))+ side_pos = positions[positions >= mid_x]+ face_x = int(np.median(side_pos))+ crop_x = max(mid_x, min(face_x - crop_w // 2, width - crop_w))else:face_x = int(np.median(face_positions))crop_x = face_x - crop_w // 2