Skip to content

Open-source AI podcast clipper. Generate vertical clips with face tracking and burned-in captions. CLI, MCP server, web app.

Seat the name card under the logo and keep captions under the chin (#251)

Nika Siradzec3d60076c33e
diff --git a/remotion/src/CaptionedClip.tsx b/remotion/src/CaptionedClip.tsx
index d60a0b2..71900c0 100644
--- a/remotion/src/CaptionedClip.tsx
+++ b/remotion/src/CaptionedClip.tsx
@@ -12,13 +12,12 @@ import type { TopicChipProps } from "./components/TopicChip";
import { ProgressBar } from "./components/ProgressBar";
import type { ProgressBarProps } from "./components/ProgressBar";
import { Cards } from "./components/Cards";
-import { cardAt } from "./cards";
import type { Card } from "./cards";
import type { Brand } from "./components/Cards";
-import { MOTION, motionAt } from "./motion";
+import { MOTION } from "./motion";
import type { Motion } from "./motion";
import {
- brandCaptions, captionZone, STYLES, LOGO_CAPTION_GAP, LOGO_HEIGHT, LOGO_INSET, safeFor,
+ brandCaptions, captionScale, captionZone, STYLES, LOGO_CAPTION_GAP, LOGO_HEIGHT, LOGO_INSET, safeFor,
} from "./types";
import type { Word, CaptionStyle, CaptionPosition, LogoPosition } from "./types";
import { resolveTheme } from "./style/theme";
@@ -56,7 +55,7 @@ export interface CaptionedClipProps {
theme?: ThemeInput | null;
}
-const ON_PAGE = 0.8;
+const CARDED = 0.75;
export const CaptionedClip: React.FC<CaptionedClipProps> = ({
videoSrc,
@@ -94,23 +93,7 @@ export const CaptionedClip: React.FC<CaptionedClipProps> = ({
const nameCardSeconds = nameCard?.title ? (nameCard.seconds ?? 3) : 0;
const pastNameCard = frame / fps >= nameCardSeconds;
- const upNow = pastNameCard ? cardAt(cards ?? [], frame / fps) : null;
- /*
- * How far in the card is, rather than whether it is.
- *
- * The card cross-fades over six frames and the captions used to answer on
- * the frame it started: shrinking and jumping while the thing they were
- * getting out of the way of was still arriving. Reading the card's own fade
- * means the two move together, so a card coming up looks like one move
- * instead of a card fading under captions that already snapped.
- */
- const cardIn = upNow
- ? motionAt({
- frame, fps, start: upNow.start, end: upNow.end,
- motion: upNow.motion ?? MOTION.card,
- }).opacity
- : 0;
- const captionShrink = 1 + (ON_PAGE - 1) * cardIn;
+ const captionShrink = cards?.length ? CARDED : 1;
/*
* Captions used to drop toward the bottom edge while a card held the frame,
* on the reasoning that there is no chin down there to clear. There is no
@@ -149,7 +132,7 @@ export const CaptionedClip: React.FC<CaptionedClipProps> = ({
*/
const settledStyle: CaptionStyle = {
...captionStyle,
- fontSize: voice.fontSize * captionSize * ON_PAGE,
+ fontSize: voice.fontSize * captionSize * captionShrink,
};
/*
@@ -222,7 +205,7 @@ export const CaptionedClip: React.FC<CaptionedClipProps> = ({
title={nameCard.title}
subtitle={nameCard.subtitle}
seconds={nameCardSeconds}
- bottom={captionZone(captionStyle) + 24}
+ top={(topTaken + 12) * captionScale(height)}
/>
)}
{!theme && nameCard?.title && (
diff --git a/remotion/src/style/styled.tsx b/remotion/src/style/styled.tsx
index 5c8e107..2412ecf 100644
--- a/remotion/src/style/styled.tsx
+++ b/remotion/src/style/styled.tsx
@@ -28,8 +28,8 @@ export const StyledNameCard: React.FC<{
title: string;
subtitle?: string;
seconds: number;
- bottom: number;
-}> = ({ theme, title, subtitle, seconds, bottom }) => {
+ top: number;
+}> = ({ theme, title, subtitle, seconds, top }) => {
const frame = useCurrentFrame();
const { fps, height } = useVideoConfig();
const s = captionScale(height);
@@ -38,7 +38,7 @@ export const StyledNameCard: React.FC<{
if (frame < 8 || out >= 1) return null;
return (
<Reveal theme={theme} role="name" f={frame} at={8} fps={fps} style={{
- left: 60 * s, bottom, display: "flex", flexDirection: "column",
+ left: 60 * s, top, display: "flex", flexDirection: "column",
alignItems: "flex-start", gap: 6 * s, opacity: 1 - out,
textShadow: theme.surface === "none" ? `0 ${2 * s}px ${14 * s}px rgba(0,0,0,0.8)` : undefined,
}}>
@@ -49,7 +49,7 @@ export const StyledNameCard: React.FC<{
{subtitle && (
<Paper theme={theme} seed={72} color={theme.color.stripAlt} scale={s}
style={{ marginLeft: theme.surface === "none" ? 0 : 30 * s, transform: `rotate(${theme.tilt * 0.6}deg)` }}>
- <div style={{ ...fontOf(theme.type.label, 42 * s), color: theme.surface === "none" ? theme.color.accent : theme.color.ink,
+ <div style={{ ...fontOf(theme.type.label, 42 * s), color: theme.color.ink,
padding: theme.surface === "none" ? 0 : `${12 * s}px ${26 * s}px` }}>
{subtitle}
</div>