Skip to content

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

Draw the topic chip, progress bar and cards the templates already offer (#189)

Nika Siradzed8b596f8a84c
diff --git a/backend/cli.py b/backend/cli.py
index 4b9af34..37d1dc8 100644
--- a/backend/cli.py
+++ b/backend/cli.py
@@ -475,6 +475,21 @@ def cmd_studio(args):
"--intro-seconds", str(args.intro_seconds),
"--outro-seconds", str(args.outro_seconds),
]
+ # Only when asked for, so a studio cut that names none of these is the
+ # same command it was before they existed.
+ if getattr(args, "topic", None):
+ cmd += ["--topic", args.topic,
+ "--topic-position", getattr(args, "topic_position", "top-left") or "top-left"]
+ if getattr(args, "progress", False):
+ cmd += ["--progress"]
+ if getattr(args, "progress_color", None):
+ cmd += ["--progress-color", args.progress_color]
+ if getattr(args, "cards", None):
+ cmd += ["--cards", args.cards]
+ if getattr(args, "brand", None):
+ cmd += ["--brand", args.brand]
+ if getattr(args, "font_family", None):
+ cmd += ["--font-family", args.font_family]
if args.outro_title is not None:
cmd += ["--outro-title", args.outro_title]
if args.platforms is not None:
@@ -676,6 +691,26 @@ def cmd_process(args):
config["logo_position"] = args.logo_position
if getattr(args, "logo_scale", None) is not None:
config["logo_scale"] = args.logo_scale
+ # Switched-on parts of the look. Absent stays absent: the renderer draws
+ # nothing for a key that is not here, which is what every render did before
+ # these flags existed.
+ if getattr(args, "topic", None):
+ config["topic"] = {
+ "label": args.topic,
+ "position": getattr(args, "topic_position", "top-left") or "top-left",
+ }
+ if getattr(args, "progress", False):
+ config["progress"] = (
+ {"color": args.progress_color} if getattr(args, "progress_color", None) else {}
+ )
+ if getattr(args, "brand", None):
+ try:
+ config["brand"] = json.loads(args.brand)
+ except (ValueError, TypeError):
+ print(" Warning: --brand is not valid JSON; using the default colours",
+ file=sys.stderr)
+ if getattr(args, "font_family", None):
+ config["font_family"] = args.font_family
if getattr(args, "no_outro", False):
config["outro_path"] = ""
elif args.outro:
@@ -1178,6 +1213,10 @@ def cmd_process(args):
caption_font_scale=config.get("caption_font_scale", 100),
logo_position=config.get("logo_position", "top-left"),
logo_scale=config.get("logo_scale", 1.0),
+ topic=config.get("topic"),
+ progress=config.get("progress"),
+ brand=config.get("brand"),
+ font_family=config.get("font_family"),
crop_strategy=config.get("crop_strategy", "face"),
format=config.get("format", "vertical"),
transcript_words=words,
@@ -1403,6 +1442,10 @@ def cmd_process(args):
caption_font_scale=config.get("caption_font_scale", 100),
logo_position=config.get("logo_position", "top-left"),
logo_scale=config.get("logo_scale", 1.0),
+ topic=config.get("topic"),
+ progress=config.get("progress"),
+ brand=config.get("brand"),
+ font_family=config.get("font_family"),
crop_strategy=config.get("crop_strategy", "face"),
format=config.get("format", "vertical"),
transcript_words=words,
@@ -4251,6 +4294,19 @@ def main():
help="Logo placement (default: top-left)")
proc.add_argument("--logo-scale", type=float, choices=[0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.05, 1.1, 1.15, 1.2, 1.25, 1.3, 1.35, 1.4, 1.45, 1.5],
help="Logo size multiplier (default: 1)")
+ # The parts a show's look switches on. Each is off unless asked for, so a
+ # command that names none of them cuts exactly what it cut before.
+ proc.add_argument("--topic", help="Standing label saying what the clip is about")
+ proc.add_argument("--topic-position", dest="topic_position", choices=["top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"],
+ default="top-left", help="Where the topic label sits (default: top-left)")
+ proc.add_argument("--progress", action="store_true",
+ help="Draw how much of the clip is left along the bottom edge")
+ proc.add_argument("--progress-color", dest="progress_color",
+ help="Colour of the progress bar, e.g. '#3B9CFF'")
+ proc.add_argument("--brand", help="Show colours as JSON: "
+ '{"accent":"#4C9DF5","ink":"#FFFFFF","surface":"#0A0D14"}')
+ proc.add_argument("--font-family", dest="font_family",
+ help="The show's own typeface, ahead of the built-in stack")
proc.add_argument("--outro", help="Outro video (asset name or path)")
proc.add_argument("--name-card", dest="name_card",
help="Lower third naming the speaker, shown for the first seconds")
@@ -4323,6 +4379,17 @@ def main():
studio.add_argument("--logo", help="Logo image (asset name or path)")
studio.add_argument("--logo-position", choices=["top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"], default="top-left")
studio.add_argument("--logo-scale", type=float, default=1.0)
+ studio.add_argument("--topic", help="Standing label saying what the clip is about")
+ studio.add_argument("--topic-position", dest="topic_position", choices=["top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"],
+ default="top-left")
+ studio.add_argument("--progress", action="store_true",
+ help="Draw how much of the clip is left along the bottom edge")
+ studio.add_argument("--progress-color", dest="progress_color")
+ studio.add_argument("--cards", help="On-screen cards as JSON, each with kind/start/end")
+ studio.add_argument("--brand", help="Show colours as JSON: "
+ '{"accent":"#4C9DF5","ink":"#FFFFFF","surface":"#0A0D14"}')
+ studio.add_argument("--font-family", dest="font_family",
+ help="The show's own typeface, ahead of the built-in stack")
studio.add_argument("--intro", help="Intro video (asset name or path)")
studio.add_argument("--outro", help="Outro video (asset name or path)")
studio.add_argument("--name-card", dest="name_card",
diff --git a/backend/clip_studio.py b/backend/clip_studio.py
index 0e19e75..6056b2f 100644
--- a/backend/clip_studio.py
+++ b/backend/clip_studio.py
@@ -119,9 +119,21 @@ def _find_paragraph(words: list, phrase: str) -> tuple[float, float]:
return start, end
+def _json_arg(raw, name):
+ """A JSON argument, or nothing. Malformed loses the part, never the clip."""
+ if not raw:
+ return None
+ try:
+ return json.loads(raw)
+ except (ValueError, TypeError):
+ print(f" Warning: {name} is not valid JSON; ignoring it", file=sys.stderr, flush=True)
+ return None
+
+
def _render_fragment(video, start, end, words, style, crop, title, out_dir, fmt="vertical",
logo=None, name_card=None, motion=None, caption_position="auto",
- caption_scale=1.0, logo_position="top-left", logo_scale=1.0):
+ caption_scale=1.0, logo_position="top-left", logo_scale=1.0,
+ topic=None, progress=None, cards=None, brand=None, font_family=None):
"""Render the fragment with face-crop + captions via the existing engine."""
from services.clip_generator import generate_clip
print(f" [fragment] rendering {start:.1f}s–{end:.1f}s ({style}, crop={crop}, {fmt})", flush=True)
@@ -133,6 +145,7 @@ def _render_fragment(video, start, end, words, style, crop, title, out_dir, fmt=
crop_strategy=crop, format=fmt,
transcript_words=words, title=title, output_dir=out_dir,
logo_path=logo, name_card=name_card, motion=motion,
+ topic=topic, progress=progress, cards=cards, brand=brand, font_family=font_family,
clean_fillers=True, allow_ass_fallback=True,
progress_callback=lambda p, m: print(f" {p}% {m}", flush=True),
)
@@ -229,6 +242,20 @@ def main():
ap.add_argument("--logo", default=None, help="Logo image (asset name or path)")
ap.add_argument("--logo-position", default="top-left", choices=["top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"])
ap.add_argument("--logo-scale", type=float, default=1.0)
+ ap.add_argument("--topic", default=None,
+ help="Standing label saying what the clip is about")
+ ap.add_argument("--topic-position", default="top-left",
+ choices=["top-left", "top-center", "top-right",
+ "bottom-left", "bottom-center", "bottom-right"])
+ ap.add_argument("--progress", action="store_true",
+ help="Draw how much of the clip is left along the bottom edge")
+ ap.add_argument("--progress-color", default=None)
+ ap.add_argument("--cards", default=None,
+ help="On-screen cards as JSON, each with kind/start/end")
+ ap.add_argument("--brand", default=None,
+ help='Show colours as JSON: {"accent":"#4C9DF5","ink":"#FFF","surface":"#000"}')
+ ap.add_argument("--font-family", default=None,
+ help="The show's own typeface, ahead of the built-in stack")
ap.add_argument("--intro", default=None, help="Intro video (asset name or path)")
ap.add_argument("--outro", default=None, help="Outro video (asset name or path)")
# bookends (defaults are None so we can tell what the user explicitly set;
@@ -327,6 +354,14 @@ def main():
caption_scale=max(0.7, min(1.5, args.caption_scale)),
logo_position=args.logo_position,
logo_scale=max(0.5, min(1.5, args.logo_scale)),
+ topic=({"label": args.topic, "position": args.topic_position} if args.topic else None),
+ progress=(
+ ({"color": args.progress_color} if args.progress_color else {})
+ if args.progress else None
+ ),
+ cards=_json_arg(args.cards, "--cards"),
+ brand=_json_arg(args.brand, "--brand"),
+ font_family=args.font_family,
)
platforms = [p.strip() for p in platforms_str.split(",") if p.strip()]
diff --git a/backend/main.py b/backend/main.py
index 52ec787..da7e237 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -172,6 +172,11 @@ def handle_create_clip(task_id: str, params: dict):
caption_position=params.get("caption_position", "auto"),
caption_font_scale=params.get("caption_font_scale", 100),
logo_position=params.get("logo_position", "top-left"),
+ topic=params.get("topic"),
+ progress=params.get("progress"),
+ cards=params.get("cards"),
+ brand=params.get("brand"),
+ font_family=params.get("font_family"),
crop_strategy=params.get("crop_strategy", "face"),
format=params.get("format", "vertical"),
crop_keyframes=params.get("crop_keyframes"),
@@ -234,6 +239,11 @@ def handle_batch_clips(task_id: str, params: dict):
caption_position=clip.get("caption_position", params.get("caption_position", "auto")),
caption_font_scale=clip.get("caption_font_scale", params.get("caption_font_scale", 100)),
logo_position=clip.get("logo_position", params.get("logo_position", "top-left")),
+ topic=clip.get("topic", params.get("topic")),
+ progress=clip.get("progress", params.get("progress")),
+ cards=clip.get("cards", params.get("cards")),
+ brand=clip.get("brand", params.get("brand")),
+ font_family=clip.get("font_family", params.get("font_family")),
crop_strategy=clip.get("crop_strategy", "face"),
format=clip.get("format", params.get("format", "vertical")),
transcript_words=params.get("transcript_words", []),
diff --git a/backend/services/clip_generator.py b/backend/services/clip_generator.py
index ab4c078..a9a0b87 100644
--- a/backend/services/clip_generator.py
+++ b/backend/services/clip_generator.py
@@ -496,6 +496,15 @@ def _report_remotion_failure(
print(f" Remotion {stage} {label}: {line[:200]}", file=sys.stderr, flush=True)
+# Watermark.tsx's own numbers, so the ffmpeg fallback puts the mark where the
+# Remotion renderer would have put it. Authored against a 1920-tall frame and
+# scaled by the height a render actually produced, exactly as captionScale does.
+REMOTION_REFERENCE_HEIGHT = 1920
+REMOTION_LOGO_HEIGHT = 126
+REMOTION_LOGO_INSET = 180
+REMOTION_LOGO_EDGE = 108
+
+
def _kept_caption_overlay_path(output_path: str) -> str:
base, _ = os.path.splitext(os.path.abspath(output_path))
return f"{base}_captions.mov"
@@ -515,6 +524,11 @@ def _render_with_remotion(
caption_font_scale: int = 100,
logo_position: str = "top-left",
logo_scale: float = 1.0,
+ topic: Optional[dict] = None,
+ progress: Optional[dict] = None,
+ cards: Optional[list] = None,
+ brand: Optional[dict] = None,
+ font_family: Optional[str] = None,
) -> tuple[bool, Optional[str]]:
"""
Render captions using Remotion. Returns (success, optional_prores_overlay_path).
@@ -656,6 +670,26 @@ def _render_with_remotion(
cmd.extend(["--name-card-accent", str(name_card["accent"])])
if motion:
cmd.extend(["--motion", json.dumps(motion)])
+ # The parts a template switches on. Each is only sent when it has a
+ # value, so a caller that passes none renders what it always rendered.
+ if topic and topic.get("label"):
+ cmd.extend(["--topic", str(topic["label"])])
+ if topic.get("position"):
+ cmd.extend(["--topic-position", str(topic["position"])])
+ if topic.get("color"):
+ cmd.extend(["--topic-color", str(topic["color"])])
+ if topic.get("background"):
+ cmd.extend(["--topic-background", str(topic["background"])])
+ if progress:
+ cmd.append("--progress")
+ if progress.get("color"):
+ cmd.extend(["--progress-color", str(progress["color"])])
+ if cards:
+ cmd.extend(["--cards", json.dumps(cards)])
+ if brand:
+ cmd.extend(["--brand", json.dumps(brand)])
+ if font_family:
+ cmd.extend(["--font-family", str(font_family)])
if keep_caption_overlay:
cmd.append("--keep-overlay")
@@ -734,6 +768,11 @@ def generate_clip(
allow_ass_fallback: bool = False,
use_ass_captions: bool = False,
keep_caption_overlay: bool = False,
+ topic: Optional[dict] = None,
+ progress: Optional[dict] = None,
+ cards: Optional[list] = None,
+ brand: Optional[dict] = None,
+ font_family: Optional[str] = None,
progress_callback: Optional[Callable[[int, str], None]] = None,
) -> dict:
"""
@@ -1052,6 +1091,11 @@ def generate_clip(
caption_font_scale=caption_font_scale,
logo_position=logo_position,
logo_scale=logo_scale,
+ topic=topic,
+ progress=progress,
+ cards=cards,
+ brand=brand,
+ font_family=font_family,
)
if not remotion_ok and not allow_ass_fallback:
@@ -1076,6 +1120,21 @@ def generate_clip(
gradient_opacity = style_config.get("gradient_opacity", 0.6)
use_logo = bool(logo_path)
+ """
+ The mark, the size Remotion would have drawn it.
+
+ This path burns a logo with ffmpeg because Remotion could
+ not run, and it used a flat 80px in a fixed corner: it read
+ neither the frame height nor the template's logo scale. The
+ same clip therefore carried a different mark depending on
+ which renderer happened to succeed, and the studio preview
+ only ever showed the Remotion one. These are Watermark.tsx's
+ own numbers against the frame this render actually produced.
+ """
+ from services.video_processor import get_dimensions
+ _, out_h = get_dimensions(cropped_path)
+ logo_s = (out_h or REMOTION_REFERENCE_HEIGHT) / REMOTION_REFERENCE_HEIGHT
+
burn_captions(
input_path=cropped_path,
ass_path=ass_path,
@@ -1083,9 +1142,9 @@ def generate_clip(
gradient_overlay=use_gradient,
gradient_opacity=gradient_opacity,
logo_path=logo_path if use_logo else None,
- logo_height=style_config.get("logo_height", 80),
- logo_margin_x=style_config.get("logo_margin_x", 30),
- logo_margin_y=style_config.get("logo_margin_y", 40),
+ logo_height=round(REMOTION_LOGO_HEIGHT * logo_s * logo_scale),
+ logo_margin_x=round(REMOTION_LOGO_EDGE * logo_s),
+ logo_margin_y=round(REMOTION_LOGO_INSET * logo_s),
logo_position=logo_position,
)
else:
diff --git a/cli/VERSION b/cli/VERSION
index 35b46ae..43c4dbe 100644
--- a/cli/VERSION
+++ b/cli/VERSION
@@ -1 +1 @@
-2.7.16
+2.7.17
diff --git a/package-lock.json b/package-lock.json
index d349279..d5f661a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "podcli",
- "version": "2.7.16",
+ "version": "2.7.17",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "podcli",
- "version": "2.7.16",
+ "version": "2.7.17",
"license": "AGPL-3.0-only",
"dependencies": {
"@fontsource/dm-sans": "^5.3.0",
diff --git a/package.json b/package.json
index 744b649..ace545f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "podcli",
- "version": "2.7.16",
+ "version": "2.7.17",
"private": true,
"description": "AI-powered podcast clip generator for TikTok/YouTube Shorts. Transcribe, find viral moments, export vertical clips with burned captions.",
"type": "module",
diff --git a/remotion/render.mjs b/remotion/render.mjs
index a9ebe9a..17f3aa2 100644
--- a/remotion/render.mjs
+++ b/remotion/render.mjs
@@ -12,6 +12,11 @@
* --style branded \
* --output /path/to/captioned.mp4 \
* [--logo /path/to/logo.png] \
+ * [--topic "Fitness"] [--topic-position top-left] \
+ * [--progress] [--progress-color '#3B9CFF'] \
+ * [--cards '[{"kind":"stat","start":2,"end":6,"value":"70%"}]'] \
+ * [--brand '{"accent":"#4C9DF5","ink":"#FFFFFF","surface":"#0A0D14"}'] \
+ * [--font-family "Inter"] \
* [--fps 30]
*
* node remotion/render.mjs --prebundle # Bundle only, no render
@@ -25,7 +30,7 @@ import os from "os";
import crypto from "crypto";
-const BOOLEAN_FLAGS = new Set(["prebundle", "keep-overlay"]);
+const BOOLEAN_FLAGS = new Set(["prebundle", "keep-overlay", "progress"]);
function parseArgs() {
const args = process.argv.slice(2);
@@ -182,6 +187,38 @@ async function main() {
}
}
+ /*
+ * The parts a template switches on.
+ *
+ * Absent means null, and null draws nothing, so a caller that sends none of
+ * these renders exactly what it rendered before they existed. A malformed
+ * value is dropped with a line on stderr rather than failing the render: a
+ * clip without its chip is worth more than no clip.
+ */
+ const json = (name) => {
+ if (!opts[name]) return null;
+ try {
+ return JSON.parse(opts[name]);
+ } catch {
+ console.error(`Ignoring --${name}: not valid JSON`);
+ return null;
+ }
+ };
+
+ const cards = json("cards");
+ const brand = json("brand");
+ const topic = opts.topic
+ ? {
+ label: opts.topic,
+ position: opts["topic-position"] || "top-left",
+ ...(opts["topic-color"] ? { color: opts["topic-color"] } : {}),
+ ...(opts["topic-background"] ? { background: opts["topic-background"] } : {}),
+ }
+ : null;
+ const progress = opts.progress
+ ? { ...(opts["progress-color"] ? { color: opts["progress-color"] } : {}) }
+ : null;
+
const inputProps = {
videoSrc,
words,
@@ -196,6 +233,11 @@ async function main() {
captionFontScale: clampCaptionFontScale(opts["caption-font-scale"]),
logoPosition: opts["logo-position"] || "top-left",
logoScale: clampLogoScale(opts["logo-scale"]),
+ topic,
+ progress,
+ cards: Array.isArray(cards) ? cards : null,
+ brand: brand && typeof brand === "object" ? brand : null,
+ fontFamily: opts["font-family"] || null,
};
console.log(
diff --git a/remotion/src/CaptionedClip.tsx b/remotion/src/CaptionedClip.tsx
index 40f84d6..3e72717 100644
--- a/remotion/src/CaptionedClip.tsx
+++ b/remotion/src/CaptionedClip.tsx
@@ -1,5 +1,5 @@
import React from "react";
-import { AbsoluteFill, useVideoConfig } from "remotion";
+import { AbsoluteFill, useCurrentFrame, useVideoConfig } from "remotion";
import { HormoziCaptions } from "./components/HormoziCaptions";
import { KaraokeCaptions } from "./components/KaraokeCaptions";
import { SubtleCaptions } from "./components/SubtleCaptions";
@@ -7,6 +7,14 @@ import { BrandedCaptions } from "./components/BrandedCaptions";
import { NameCard } from "./components/NameCard";
import type { NameCardProps } from "./components/NameCard";
import { Watermark } from "./components/Watermark";
+import { TopicChip } from "./components/TopicChip";
+import type { TopicChipProps } from "./components/TopicChip";
+import { ProgressBar } from "./components/ProgressBar";
+import type { ProgressBarProps } from "./components/ProgressBar";
+import { Cards, CARD_CAPTION_MARGIN } from "./components/Cards";
+import { cardAt } from "./cards";
+import type { Card } from "./cards";
+import type { Brand } from "./components/Cards";
import { MOTION } from "./motion";
import type { Motion } from "./motion";
import type { Word, CaptionStyle, CaptionPosition, LogoPosition } from "./types";
@@ -17,29 +25,78 @@ export interface CaptionedClipProps {
style: CaptionStyle;
logoSrc?: string;
faceY?: number | null;
- /** Who is speaking, shown for the first few seconds. */
- nameCard?: NameCardProps | null;
+ /** Face height as a fraction of the frame, when one was measured. */
+ faceH?: number | null;
captionPosition?: CaptionPosition;
+ captionScale?: number;
logoPosition?: LogoPosition;
logoScale?: number;
singleLine?: boolean;
+ /** Who is speaking, shown for the first few seconds. */
+ nameCard?: NameCardProps | null;
+ /** A standing label saying what the clip is about. Null draws nothing. */
+ topic?: TopicChipProps | null;
+ /** How much of the clip is left. Null draws nothing. */
+ progress?: ProgressBarProps | null;
+ /** Cards that take the frame for a window each. Empty draws nothing. */
+ cards?: Card[] | null;
+ /** Where in the source file this composition begins, in frames. */
+ startFrom?: number;
+ /** The show's colours, for anything the renderer draws itself. */
+ brand?: Brand | null;
/** Per-part overrides; each part falls back to its style's own motion. */
motion?: { captions?: Partial<Motion>; nameCard?: Partial<Motion> } | null;
}
export const CaptionedClip: React.FC<CaptionedClipProps> = ({
+ videoSrc,
words,
style,
logoSrc,
faceY,
- nameCard,
+ faceH,
captionPosition = "auto",
+ captionScale: captionSize = 1,
logoPosition = "top-left",
logoScale = 1,
singleLine = false,
+ nameCard,
+ topic,
+ progress,
+ cards,
+ startFrom = 0,
+ brand,
motion,
}) => {
- const { height } = useVideoConfig();
+ const { fps, height } = useVideoConfig();
+ const frame = useCurrentFrame();
+
+ /*
+ * Captions drop toward the bottom edge while a card holds the frame.
+ *
+ * Their usual margin keeps them clear of a speaker's chin and hands. There
+ * is no chin down there when a card is up, so the margin is only empty
+ * surface, and it was the single biggest thing pushing the speaker's band
+ * short enough to cut a face in half.
+ */
+ const cardUp = Boolean(cards?.length) && Boolean(cardAt(cards ?? [], frame / fps));
+ const cardPlanned = Boolean(cards?.length);
+ const captionShrink = cardUp ? 0.6 : cardPlanned ? 0.75 : 1;
+ const baseCaptionStyle: CaptionStyle = cardUp
+ ? { ...style, marginBottom: Math.min(style.marginBottom, CARD_CAPTION_MARGIN) }
+ : style;
+ // Keep a simple four-stop placement model. It is easier to reason about
+ // than pixels, and stays proportional across every output shape.
+ const placementMargin = captionPosition === "upper" ? 760
+ : captionPosition === "center" ? 480
+ : captionPosition === "lower" ? 220
+ : baseCaptionStyle.marginBottom;
+ const captionStyle: CaptionStyle = {
+ ...baseCaptionStyle,
+ marginBottom: placementMargin,
+ fontSize: baseCaptionStyle.fontSize * captionSize * captionShrink,
+ };
+
const captionMotion: Motion = {
...(MOTION[style.name] ?? MOTION.subtle), ...(motion?.captions ?? {}),
};
@@ -53,14 +110,30 @@ export const CaptionedClip: React.FC<CaptionedClipProps> = ({
return (
<AbsoluteFill style={{ backgroundColor: "transparent" }}>
+ {/* First, so everything below stays up while a card holds the frame. */}
+ {cards && cards.length > 0 && (
+ <Cards
+ cards={cards}
+ videoSrc={videoSrc}
+ startFrom={startFrom}
+ style={captionStyle}
+ faceY={faceY}
+ faceH={faceH}
+ brand={brand}
+ />
+ )}
<Watermark src={logoSrc} height={height} position={logoPosition} scale={logoScale} />
{style.name === "branded" ? (
- <BrandedCaptions words={words} style={style} logoSrc={logoSrc} faceY={faceY}
- captionPosition={captionPosition} logoPosition={logoPosition} logoScale={logoScale} singleLine={singleLine} />
+ <BrandedCaptions words={words} style={captionStyle} faceY={faceY}
+ captionPosition={captionPosition} hasLogo={Boolean(logoSrc)}
+ logoPosition={logoPosition} singleLine={singleLine} />
) : (
- <CaptionComponent words={words} style={style} singleLine={singleLine} motion={captionMotion} />
+ <CaptionComponent words={words} style={captionStyle} motion={captionMotion}
+ singleLine={singleLine} />
)}
{nameCard?.title && <NameCard {...nameCard} motion={cardMotion} />}
+ {topic?.label && <TopicChip {...topic} />}
+ {progress && <ProgressBar {...progress} />}
</AbsoluteFill>
);
};
diff --git a/remotion/src/Root.tsx b/remotion/src/Root.tsx
index 31a028e..12c442c 100644
--- a/remotion/src/Root.tsx
+++ b/remotion/src/Root.tsx
@@ -3,9 +3,13 @@ import { Composition, continueRender, delayRender, getInputProps } from "remotio
import { CaptionedClip } from "./CaptionedClip";
import { Bookend } from "./Bookend";
import { Audiogram } from "./Audiogram";
-import { STYLES } from "./types";
+import { fontStack, STYLES } from "./types";
import type { Word } from "./types";
import type { CaptionPosition, LogoPosition } from "./types";
+import type { TopicChipProps } from "./components/TopicChip";
+import type { ProgressBarProps } from "./components/ProgressBar";
+import type { Brand } from "./components/Cards";
+import type { Card } from "./cards";
import dmSans400 from "@fontsource/dm-sans/files/dm-sans-latin-400-normal.woff2";
import dmSans700 from "@fontsource/dm-sans/files/dm-sans-latin-700-normal.woff2";
@@ -65,6 +69,19 @@ const inputProps = getInputProps() as {
captions?: Record<string, unknown>;
nameCard?: Record<string, unknown>;
} | null;
+ /**
+ * The parts a show's template switches on, and the colours it draws them in.
+ *
+ * Every one is optional and absent means "draw nothing", so a render that
+ * sends none of them produces exactly the clip it produced before these
+ * existed.
+ */
+ topic?: TopicChipProps | null;
+ progress?: ProgressBarProps | null;
+ cards?: Card[] | null;
+ brand?: Brand | null;
+ /** The show's own face, ahead of the stack that covers what it cannot draw. */
+ fontFamily?: string | null;
};
export const RemotionRoot: React.FC = () => {
@@ -82,6 +99,7 @@ export const RemotionRoot: React.FC = () => {
...baseStyle,
fontSize: baseStyle.fontSize * fontScale,
marginBottom: positionMargins[captionPosition] ?? baseStyle.marginBottom,
+ fontFamily: fontStack(inputProps.fontFamily),
};
return (
@@ -105,6 +123,10 @@ export const RemotionRoot: React.FC = () => {
logoScale: Math.max(0.5, Math.min(1.5, inputProps.logoScale || 1)),
singleLine: inputProps.singleLine === true,
motion: inputProps.motion ?? null,
+ topic: inputProps.topic ?? null,
+ progress: inputProps.progress ?? null,
+ cards: inputProps.cards ?? null,
+ brand: inputProps.brand ?? null,
}}
/>
<Composition
diff --git a/remotion/src/cards.ts b/remotion/src/cards.ts
new file mode 100644
index 0000000..c91c492
--- /dev/null
+++ b/remotion/src/cards.ts
@@ -0,0 +1,118 @@
+import type { Motion } from "./motion";
+
+interface CardBase {
+ /** Seconds on the clip's own clock. */
+ start: number;
+ end: number;
+ accent?: string;
+ background?: string;
+ motion?: Motion;
+ /**
+ * Whether the speaker stays on screen above the card.
+ *
+ * Drawn unless a card says null. A podcast card that drops the person is the
+ * news-explainer reflex this format is not: the moment is somebody saying
+ * something, and cutting their face out mid-sentence throws away the only
+ * thing the clip has.
+ *
+ * Null is for the card that earns the whole frame, like a screenshot nobody
+ * could read at half the height.
+ */
+ speaker?: null;
+}
+
+/**
+ * What a card can say.
+ *
+ * Four kinds rather than a free-form layout, because a card is only worth
+ * taking the frame for when it says something the talking head cannot: a
+ * number, a claim, a list, or the sentence itself set large enough to read
+ * at arm's length. Anything past that is a slide deck.
+ */
+export type Card =
+ | (CardBase & {
+ kind: "stat";
+ /** The number, and only the number. */
+ value: string;
+ eyebrow?: string;
+ caption?: string;
+ })
+ | (CardBase & {
+ kind: "headline";
+ eyebrow?: string;
+ lead: string;
+ /** The payload word, set apart from the lead. */
+ emphasis?: string;
+ sub?: string;
+ })
+ | (CardBase & { kind: "bullets"; eyebrow?: string; items: string[] })
+ /**
+ * Two or three things measured against each other.
+ *
+ * Emphasis rather than a colour per bar: the story is that one of them is
+ * the point, and giving every bar its own hue buries the one that is. The
+ * subject wears the accent, the rest are context.
+ */
+ | (CardBase & {
+ kind: "compare";
+ eyebrow?: string;
+ rows: { label: string; value: number; display?: string; subject?: boolean }[];
+ })
+ /** One thing, before and after. A dumbbell, in two steps of one hue. */
+ | (CardBase & {
+ kind: "change";
+ eyebrow?: string;
+ label?: string;
+ from: { value: string; note?: string };
+ to: { value: string; note?: string };
+ })
+ /** One ratio against its whole. A meter, never a two-slice pie. */
+ | (CardBase & {
+ kind: "share";
+ eyebrow?: string;
+ /** 0 to 1. */
+ value: number;
+ display?: string;
+ caption?: string;
+ })
+ /** A name nobody in the audience necessarily knows, with its mark. */
+ | (CardBase & {
+ kind: "entity";
+ eyebrow?: string;
+ name: string;
+ note?: string;
+ /** Logo or photograph. A URL the renderer can reach, or a bundle path. */
+ src?: string;
+ })
+ | (CardBase & { kind: "quote"; text: string; attribution?: string })
+ | (CardBase & {
+ kind: "image";
+ /** A URL the renderer can reach, or a path inside the bundle. */
+ src: string;
+ /**
+ * "fit" shows the whole picture, which is what a screenshot needs: a
+ * cropped headline is not evidence of anything. "fill" covers the frame
+ * and is for a photograph, where the edges carry nothing.
+ */
+ fit?: "fit" | "fill";
+ caption?: string;
+ });
+
+/**
+ * The card in front at this moment, or none.
+ *
+ * A later card wins an overlap rather than the array order deciding it,
+ * because the planner writes cards in the order they were found and two
+ * windows that touch would otherwise flicker between them frame by frame.
+ * The window is half-open so a card ending where the next begins is a cut,
+ * not a frame showing both.
+ */
+export const cardAt = (cards: Card[], seconds: number): Card | null => {
+ let found: Card | null = null;
+ for (const card of cards) {
+ if (seconds >= card.start && seconds < card.end) {
+ if (!found || card.start >= found.start) found = card;
+ }
+ }
+ return found;
+};
diff --git a/remotion/src/components/BrandedCaptions.tsx b/remotion/src/components/BrandedCaptions.tsx
index 8cd70c1..966d61b 100644
--- a/remotion/src/components/BrandedCaptions.tsx
+++ b/remotion/src/components/BrandedCaptions.tsx
@@ -5,20 +5,24 @@ import {
spring,
} from "remotion";
import type { Word, CaptionStyle, CaptionPosition, LogoPosition } from "../types";
-import { captionScale } from "../types";
+import {
+ captionScale, LOGO_CAPTION_GAP, LOGO_HEIGHT, LOGO_INSET,
+} from "../types";
import { buildChunks, activeChunkAt, splitCaptionLines } from "../chunks";
-import { LOGO_CAPTION_GAP, LOGO_HEIGHT, LOGO_INSET } from "./Watermark";
interface Props {
words: Word[];
style: CaptionStyle;
- // The logo is drawn by Watermark now, but the caption margin still has to
- // know it is there.
- logoSrc?: string;
faceY?: number | null; // normalized 0-1 (0=top, 1=bottom)
captionPosition?: CaptionPosition;
+ /**
+ * Whether a logo is on the frame, and where. The mark itself is drawn by
+ * Watermark one level up so all four styles carry it; this component still
+ * has to know, because a bottom-anchored logo and a low caption want the
+ * same band of pixels.
+ */
+ hasLogo?: boolean;
logoPosition?: LogoPosition;
- logoScale?: number;
singleLine?: boolean;
}
@@ -33,7 +37,8 @@ const WordWithPill: React.FC<{
isActive: boolean;
frame: number;
fps: number;
-}> = ({ word, isActive, frame, fps }) => {
+ emphasisColor?: string;
+}> = ({ word, isActive, frame, fps, emphasisColor }) => {
const { height } = useVideoConfig();
const s = captionScale(height);
const wordEntryFrame = Math.round(word.start * fps);
@@ -64,7 +69,15 @@ const WordWithPill: React.FC<{
}}
/>
{/* Word text — always inline, never shifts */}
- <span style={{ position: "relative", zIndex: 1 }}>{word.word}</span>
+ <span
+ style={{
+ position: "relative",
+ zIndex: 1,
+ ...(word.emphasis && emphasisColor ? { color: emphasisColor } : {}),
+ }}
+ >
+ {word.word}
+ </span>
</span>
);
};
@@ -106,6 +119,7 @@ const CaptionLine: React.FC<{
isActive={isActive}
frame={frame}
fps={fps}
+ emphasisColor={style.emphasisColor}
/>
</React.Fragment>
);
@@ -117,11 +131,10 @@ const CaptionLine: React.FC<{
export const BrandedCaptions: React.FC<Props> = ({
words,
style,
- logoSrc,
faceY,
captionPosition = "auto",
+ hasLogo = false,
logoPosition = "top-left",
- logoScale = 1,
singleLine = false,
}) => {
const frame = useCurrentFrame();
@@ -152,8 +165,8 @@ export const BrandedCaptions: React.FC<Props> = ({
}
// A bottom-anchored logo spans 180-306 scaled units. Captions sitting inside
// that band (captionPosition "lower" starts at 220) would render over it.
- if (logoSrc && logoPosition.startsWith("bottom-")) {
- dynamicMargin = Math.max(dynamicMargin, (LOGO_INSET + LOGO_HEIGHT * logoScale + LOGO_CAPTION_GAP) * s);
+ if (hasLogo && logoPosition.startsWith("bottom-")) {
+ dynamicMargin = Math.max(dynamicMargin, (LOGO_INSET + LOGO_HEIGHT + LOGO_CAPTION_GAP) * s);
}
return (
diff --git a/remotion/src/components/Cards.tsx b/remotion/src/components/Cards.tsx
new file mode 100644
index 0000000..ca94716
--- /dev/null
+++ b/remotion/src/components/Cards.tsx
@@ -0,0 +1,642 @@
+import React from "react";
+import {
+ getRemotionEnvironment, Img, OffthreadVideo, Video, staticFile,
+ useCurrentFrame, useVideoConfig,
+} from "remotion";
+import { captionScale, FONT } from "../types";
+import type { CaptionStyle } from "../types";
+import { MOTION, motionAt } from "../motion";
+import { cardAt } from "../cards";
+import type { Card } from "../cards";
+
+/**
+ * A card keeps the person on screen.
+ *
+ * The formats this borrows from are news explainers: they cut away from the
+ * presenter constantly, because what they are narrating is an announcement and
+ * the presenter is only reading it out. A podcast is the other way round. The
+ * moment is somebody saying something, and cutting their face out mid-sentence
+ * throws away the only thing the clip has.
+ *
+ * So a card takes the band directly above the captions and the speaker holds
+ * everything above that. The eye travels from face to point to words without
+ * ever leaving the frame, and a card that arrives is an addition rather than a
+ * cutaway to a different video.
+ */
+
+/**
+ * The show's colours, or ours when it has not set any.
+ *
+ * Three values rather than a palette: the one colour that means "this is the
+ * thing", what text is set in, and what it is set on. Everything else on a
+ * card is one of those three at a lower opacity, which is what keeps a card
+ * looking like the show rather than like a theme.
+ */
+export type Brand = { accent: string; ink: string; surface: string };
+
+export const DEFAULT_BRAND: Brand = {
+ accent: "#4C9DF5",
+ ink: "#FFFFFF",
+ surface: "#0A0D14",
+};
+
+/** Text that is not the point, and marks that are not the subject. */
+const muted = (ink: string) => `color-mix(in oklab, ${ink} 62%, transparent)`;
+const context = (ink: string) => `color-mix(in oklab, ${ink} 22%, transparent)`;
+
+/**
+ * A three-step rhythm, so grouping reads from the gaps rather than from rules.
+ * The first pass used 22, 24, 26, 28 and 32, which is one gap five times.
+ */
+const GAP = { tight: 14, group: 36, section: 76 };
+
+/**
+ * Marks, thin and unfussy.
+ *
+ * `cap` rounds the data end of a bar only. `gap` is the surface showing between
+ * adjacent marks, which is what keeps two bars from reading as one shape.
+ */
+const MARK = { bar: 26, cap: 8, gap: 30, rule: 5, dot: 26 };
+
+/** A meter's unfilled remainder: the fill's own hue, several steps lighter. */
+const track = (fill: string) =>
+ `color-mix(in oklab, ${fill} 22%, transparent)`;
+
+/** Authored for the 1920-tall canvas, like every other measurement here. */
+const TYPE = { label: 34, body: 46, item: 58, quote: 68, lead: 84, figure: 168 };
+
+/**
+ * The least of the frame the speaker keeps.
+ *
+ * The band is whatever the card does not need rather than a fixed height: a
+ * two-line quote and a bare figure want different amounts, and pinning both
+ * ends meant a tall card overflowed upward across the speaker's chin. This
+ * floor stops a very long card from squeezing the face out altogether.
+ */
+const SPEAKER_MIN = 820;
+
+/**
+ * How much room a head needs, given how big the face is.
+ *
+ * A detected face box is the face, not the head: it stops at the hairline and
+ * at the chin, and a band cut to it lands exactly on both. Two and a half
+ * times leaves the skull above and the jaw and some shoulder below, which is
+ * the framing anyone would choose by hand.
+ *
+ * Without a measurement this falls back to the flat floor above, which is a
+ * guess that happens to suit a mid-shot and is wrong on a close-up. That is
+ * the honest state of it: the detector has the number, an older engine does
+ * not send it, and a clip rendered by one should not look broken.
+ */
+const HEAD_TO_FACE = 2.5;
+
+/**
+ * Where captions sit while a card is up.
+ *
+ * Their usual margin exists to clear a speaker's chin and hands, and there is
+ * no chin down there behind a card. Dropping them toward the bottom edge is
+ * what buys the speaker a band tall enough to hold a whole head.
+ */
+export const CARD_CAPTION_MARGIN = 180;
+
+/**
+ * The room the captions need, measured rather than assumed.
+ *
+ * A fixed number worked until a two-line Georgian caption grew taller than it
+ * and the card's last line rendered behind the pill. The caption's own style
+ * knows where it sits and how big it is, so the reserved band is read off that:
+ * its margin, two lines of it, and a gap.
+ */
+const captionZone = (style: CaptionStyle) =>
+ style.marginBottom + style.fontSize * CAPTION_LINES * 1.2 + GAP.group;
+
+/**
+ * How many lines of caption a card gets out of the way of.
+ *
+ * Two was the common case and wrong at the worst one: a chunk that wrapped to
+ * three lines covered the card's last row, which is the row a comparison keeps
+ * its second bar in. Reserving for the tallest caption costs a card some
+ * height on every clip and costs it nothing on the clip where it matters.
+ */
+const CAPTION_LINES = 3;
+
+/*
+ * The panel runs to the bottom edge, and that is not negotiable.
+ *
+ * It was ended under the caption for a while, to close the empty strip a
+ * caption's own margin leaves below it. What that actually did was put a band
+ * of the speaker back under the card: head above, panel across, chin below,
+ * so one person appeared twice in a frame with a slab through the middle of
+ * their face. Empty surface under a caption reads as a floor. A face cut in
+ * half reads as a mistake, and it is the more expensive of the two by far.
+ */
+
+/**
+ * The line above the payload, when there is something worth saying there.
+ *
+ * Set in the same white as everything else rather than the accent. An accent
+ * on the label and on the figure is the same swatch twice on one card, which
+ * is how a colour stops meaning anything.
+ */
+const Label: React.FC<{ text: string; scale: number; tone: string }> = ({
+ text, scale: s, tone,
+}) => (
+ <div
+ style={{
+ fontFamily: FONT,
+ fontSize: TYPE.label * s,
+ fontWeight: 600,
+ letterSpacing: 1.5 * s,
+ color: tone,
+ marginBottom: GAP.tight * s,
+ }}
+ >
+ {text}
+ </div>
+);
+
+/** One end of a change, as a value with its note under it. */
+const Endpoint: React.FC<{
+ value: string; note?: string; tone: string; scale: number; brand: Brand;
+}> = ({ value, note, tone, scale: s, brand }) => (
+ <div style={{ textAlign: "center" }}>
+ <div
+ style={{
+ width: MARK.dot * s, height: MARK.dot * s, borderRadius: "50%",
+ backgroundColor: tone, margin: "0 auto",
+ }}
+ />
+ <div
+ style={{
+ fontFamily: FONT, fontSize: TYPE.item * s, fontWeight: 700,
+ color: brand.ink, marginTop: 12 * s, lineHeight: 1,
+ }}
+ >
+ {value}
+ </div>
+ {note && (
+ <div
+ style={{
+ fontFamily: FONT, fontSize: TYPE.label * s, color: muted(brand.ink),
+ marginTop: 6 * s,
+ }}
+ >
+ {note}
+ </div>
+ )}
+ </div>
+);
+
+const CardBody: React.FC<{ card: Card; scale: number; brand: Brand }> = ({
+ card, scale: s, brand,
+}) => {
+ const accent = card.accent ?? brand.accent;
+ const INK = brand.ink;
+ const MUTED = muted(brand.ink);
+ const CONTEXT = context(brand.ink);
+
+ if (card.kind === "stat") {
+ return (
+ <>
+ {card.eyebrow && <Label text={card.eyebrow} scale={s} tone={MUTED} />}
+ <div
+ style={{
+ fontFamily: FONT,
+ fontSize: TYPE.figure * s,
+ fontWeight: 700,
+ lineHeight: 0.95,
+ letterSpacing: -4 * s,
+ color: accent,
+ }}
+ >
+ {card.value}
+ </div>
+ {card.caption && (
+ <div
+ style={{
+ fontFamily: FONT,
+ fontSize: TYPE.body * s,
+ fontWeight: 400,
+ lineHeight: 1.3,
+ color: INK,
+ marginTop: GAP.tight * s,
+ maxWidth: "80%",
+ }}
+ >
+ {card.caption}
+ </div>
+ )}
+ </>
+ );
+ }
+
+ if (card.kind === "headline") {
+ return (
+ <>
+ {card.eyebrow && <Label text={card.eyebrow} scale={s} tone={MUTED} />}
+ <div
+ style={{
+ fontFamily: FONT,
+ fontSize: TYPE.lead * s,
+ fontWeight: 600,
+ lineHeight: 1.12,
+ letterSpacing: -1 * s,
+ color: INK,
+ }}
+ >
+ {card.lead}
+ {card.emphasis && (
+ // The payload word carries the card's one accent. Italic as well
+ // would be two ways of saying the same thing.
+ <span style={{ color: accent }}> {card.emphasis}</span>
+ )}
+ </div>
+ {card.sub && (
+ <div
+ style={{
+ fontFamily: FONT,
+ fontSize: TYPE.body * s,
+ fontWeight: 400,
+ lineHeight: 1.3,
+ color: MUTED,
+ marginTop: GAP.tight * s,
+ maxWidth: "80%",
+ }}
+ >
+ {card.sub}
+ </div>
+ )}
+ </>
+ );
+ }
+
+ if (card.kind === "bullets") {
+ return (
+ <>
+ {card.eyebrow && <Label text={card.eyebrow} scale={s} tone={MUTED} />}
+ {card.items.map((item, i) => (
+ <div
+ key={i}
+ style={{
+ display: "flex",
+ alignItems: "center",
+ gap: 20 * s,
+ marginTop: i === 0 ? 0 : GAP.tight * s,
+ }}
+ >
+ {/* A rule rather than a bullet glyph or an icon: it is a list
+ marker, and a dot in a coloured circle is chrome. */}
+ <div
+ style={{
+ width: 26 * s,
+ height: 3 * s,
+ backgroundColor: i === 0 ? accent : MUTED,
+ flexShrink: 0,
+ }}
+ />
+ <div
+ style={{
+ fontFamily: FONT,
+ fontSize: TYPE.item * s,
+ fontWeight: 500,
+ lineHeight: 1.25,
+ color: INK,
+ }}
+ >
+ {item}
+ </div>
+ </div>
+ ))}
+ </>
+ );
+ }
+
+ if (card.kind === "compare") {
+ const top = Math.max(...card.rows.map((r) => r.value)) || 1;
+ return (
+ <>
+ {card.eyebrow && <Label text={card.eyebrow} scale={s} tone={MUTED} />}
+ {card.rows.slice(0, 3).map((row, i) => (
+ <div key={i} style={{ marginTop: i === 0 ? 0 : MARK.gap * s }}>
+ <div
+ style={{
+ display: "flex",
+ justifyContent: "space-between",
+ alignItems: "baseline",
+ marginBottom: 8 * s,
+ }}
+ >
+ {/* Ink, not the bar's colour: the mark beside it carries identity. */}
+ <span style={{ fontFamily: FONT, fontSize: TYPE.label * s, color: MUTED }}>
+ {row.label}
+ </span>
+ <span
+ style={{
+ fontFamily: FONT, fontSize: TYPE.body * s, fontWeight: 700,
+ color: row.subject ? INK : MUTED,
+ }}
+ >
+ {row.display ?? row.value}
+ </span>
+ </div>
+ <div
+ style={{
+ width: `${Math.max(4, (row.value / top) * 100)}%`,
+ height: MARK.bar * s,
+ backgroundColor: row.subject ? accent : CONTEXT,
+ // Rounded at the data end only. A bar rounded at the baseline
+ // reads as floating away from the axis it is measured from.
+ borderRadius: `0 ${MARK.cap * s}px ${MARK.cap * s}px 0`,
+ }}
+ />
+ </div>
+ ))}
+ </>
+ );
+ }
+
+ if (card.kind === "change") {
+ return (
+ <>
+ {card.eyebrow && <Label text={card.eyebrow} scale={s} tone={MUTED} />}
+ <div style={{ display: "flex", alignItems: "center", gap: 0 }}>
+ <Endpoint value={card.from.value} note={card.from.note} tone={CONTEXT} scale={s} brand={brand} />
+ <div
+ style={{
+ flex: 1,
+ height: MARK.rule * s,
+ // One hue in two steps: the same measure, later.
+ background: `linear-gradient(90deg, ${CONTEXT}, ${accent})`,
+ margin: `0 ${18 * s}px`,
+ transform: `translateY(${-14 * s}px)`,
+ }}
+ />
+ <Endpoint value={card.to.value} note={card.to.note} tone={accent} scale={s} brand={brand} />
+ </div>
+ </>
+ );
+ }
+
+ if (card.kind === "share") {
+ const pct = Math.max(0, Math.min(1, card.value));
+ return (
+ <>
+ {card.eyebrow && <Label text={card.eyebrow} scale={s} tone={MUTED} />}
+ <div
+ style={{
+ fontFamily: FONT, fontSize: TYPE.figure * 0.72 * s, fontWeight: 700,
+ lineHeight: 1, letterSpacing: -3 * s, color: accent,
+ marginBottom: GAP.tight * s,
+ }}
+ >
+ {card.display ?? `${Math.round(pct * 100)}%`}
+ </div>
+ {/* The unfilled track is a lighter step of the fill's own ramp, so the
+ whole bar reads as one measure rather than as bar-on-background. */}
+ <div
+ style={{
+ width: "100%", height: MARK.bar * s,
+ backgroundColor: track(accent), borderRadius: MARK.cap * s,
+ overflow: "hidden",
+ }}
+ >
+ <div style={{ width: `${pct * 100}%`, height: "100%", backgroundColor: accent }} />
+ </div>
+ {card.caption && (
+ <div
+ style={{
+ fontFamily: FONT, fontSize: TYPE.body * s, color: INK,
+ lineHeight: 1.3, marginTop: GAP.tight * s, maxWidth: "85%",
+ }}
+ >
+ {card.caption}
+ </div>
+ )}
+ </>
+ );
+ }
+
+ if (card.kind === "entity") {
+ return (
+ <>
+ {card.eyebrow && <Label text={card.eyebrow} scale={s} tone={MUTED} />}
+ <div style={{ display: "flex", alignItems: "center", gap: 28 * s }}>
+ {card.src && (
+ <Img
+ src={card.src.startsWith("http") ? card.src : staticFile(card.src)}
+ style={{
+ width: 132 * s, height: 132 * s, objectFit: "cover",
+ borderRadius: 20 * s, flexShrink: 0,
+ outline: `${1 * s}px solid rgba(255,255,255,0.1)`,
+ outlineOffset: `${-1 * s}px`,
+ }}
+ />
+ )}
+ <div>
+ <div
+ style={{
+ fontFamily: FONT, fontSize: TYPE.item * s, fontWeight: 700,
+ lineHeight: 1.15, color: INK,
+ }}
+ >
+ {card.name}
+ </div>
+ {card.note && (
+ <div
+ style={{
+ fontFamily: FONT, fontSize: TYPE.body * s, color: MUTED,
+ lineHeight: 1.3, marginTop: 6 * s,
+ }}
+ >
+ {card.note}
+ </div>
+ )}
+ </div>
+ </div>
+ </>
+ );
+ }
+
+ if (card.kind === "image") {
+ return (
+ <>
+ <Img
+ src={card.src.startsWith("http") ? card.src : staticFile(card.src)}
+ style={{
+ width: "100%",
+ maxHeight: 520 * s,
+ objectFit: card.fit === "fill" ? "cover" : "contain",
+ borderRadius: 16 * s,
+ // A screenshot's own edge is often near the surface tone behind it.
+ // Pure white at a tenth, never a tone borrowed from the palette.
+ outline: `${1 * s}px solid rgba(255,255,255,0.1)`,
+ outlineOffset: `${-1 * s}px`,
+ }}
+ />
+ {card.caption && (
+ <div
+ style={{
+ fontFamily: FONT,
+ fontSize: TYPE.label * s,
+ fontWeight: 400,
+ lineHeight: 1.3,
+ color: MUTED,
+ marginTop: GAP.tight * s,
+ }}
+ >
+ {card.caption}
+ </div>
+ )}
+ </>
+ );
+ }
+
+ return (
+ <>
+ <div
+ style={{
+ fontFamily: FONT,
+ fontSize: TYPE.quote * s,
+ fontWeight: 500,
+ lineHeight: 1.25,
+ letterSpacing: -0.5 * s,
+ color: INK,
+ // Hung, so the first letter of the line sits on the same edge as
+ // everything below it rather than a quote mark's worth to the right.
+ textIndent: `${-18 * s}px`,
+ }}
+ >
+ “{card.text}”
+ </div>
+ {card.attribution && (
+ <div
+ style={{
+ fontFamily: FONT,
+ fontSize: TYPE.label * s,
+ fontWeight: 600,
+ letterSpacing: 1.5 * s,
+ color: MUTED,
+ marginTop: GAP.group * s,
+ }}
+ >
+ {card.attribution}
+ </div>
+ )}
+ </>
+ );
+};
+
+/**
+ * The speaker, still on screen, above the card.
+ *
+ * Each environment gets the video component it can actually play. The
+ * in-browser player seeks a <video> element per frame, and OffthreadVideo
+ * hangs there when the file is served without range requests, which left every
+ * preview stuck on the first card. A render is the reverse: it has no seekable
+ * player, and a <video> element it has to drive frame by frame stalls until
+ * the render times out with nothing drawn.
+ */
+const SpeakerBand: React.FC<{ src: string; startFrom: number; faceY?: number | null }> = ({
+ src, startFrom, faceY,
+}) => {
+ const Frame = getRemotionEnvironment().isRendering ? OffthreadVideo : Video;
+ return (
+ <Frame
+ src={src}
+ startFrom={startFrom}
+ muted
+ style={{
+ width: "100%",
+ height: "100%",
+ objectFit: "cover",
+ objectPosition: `50% ${(faceY ?? 0.4) * 100}%`,
+ }}
+ />
+ );
+};
+
+export const Cards: React.FC<{
+ cards: Card[];
+ videoSrc?: string;
+ startFrom?: number;
+ style: CaptionStyle;
+ faceY?: number | null;
+ faceH?: number | null;
+ brand?: Brand | null;
+}> = ({ cards, videoSrc, startFrom = 0, style, faceY, faceH, brand }) => {
+ const colours = { ...DEFAULT_BRAND, ...(brand ?? {}) };
+ const frame = useCurrentFrame();
+ const { fps, height } = useVideoConfig();
+ const s = captionScale(height);
+
+ // A picture whose file went missing is dropped here rather than drawn: the
+ // card is opaque, so rendering it anyway would cover the clip with nothing.
+ const usable = cards.filter((c) => c.kind !== "image" || Boolean(c.src));
+ const card = cardAt(usable, frame / fps);
+ if (!card) return null;
+
+ const { opacity } = motionAt({
+ frame, fps,
+ start: card.start,
+ end: card.end,
+ motion: card.motion ?? MOTION.card,
+ });
+ if (opacity <= 0) return null;
+
+ /*
+ * The speaker stays, unless what is left of the frame would cut them in half.
+ *
+ * A band shorter than this shows a forehead and a mouth, which reads worse
+ * than not showing the person at all: a viewer reads a slice of a face as a
+ * mistake and a full-frame card as a decision. So it is a whole head or
+ * none, never part of one.
+ */
+ const room = height - (captionZone(style) + GAP.section) * s;
+ const headNeeds = faceH ? faceH * HEAD_TO_FACE * height : SPEAKER_MIN * s;
+ const withSpeaker = card.speaker !== null
+ && Boolean(videoSrc)
+ && room >= headNeeds;
+
+ return (
+ <div
+ style={{
+ position: "absolute",
+ inset: 0,
+ backgroundColor: card.background ?? colours.surface,
+ opacity,
+ display: "flex",
+ flexDirection: "column",
+ // The captions are not part of this stack; they are drawn over it.
+ // Reserving their band as padding is what keeps a card's last line
+ // from ending up behind the pill.
+ paddingBottom: captionZone(style) * s,
+ }}
+ >
+ {withSpeaker && videoSrc && (
+ <div style={{ flex: 1, minHeight: SPEAKER_MIN * s, overflow: "hidden" }}>
+ <SpeakerBand src={videoSrc} startFrom={startFrom} faceY={faceY} />
+ </div>
+ )}
+ <div
+ style={{
+ padding: `${GAP.section * s}px ${96 * s}px 0`,
+ display: "flex",
+ flexDirection: "column",
+ /*
+ * Under the speaker when there is one, centred when there is not.
+ *
+ * A card that has the whole frame and puts its content against the
+ * captions leaves two thirds of the frame empty above it, which
+ * reads as a card that failed to load. With a speaker the content
+ * belongs low, because the thing above it is a person and the gap
+ * between them is what makes the pair read as one shot.
+ */
+ marginTop: "auto",
+ marginBottom: withSpeaker ? undefined : "auto",
+ }}
+ >
+ <CardBody card={card} scale={s} brand={colours} />
+ </div>
+ </div>
+ );
+};
diff --git a/remotion/src/components/HormoziCaptions.tsx b/remotion/src/components/HormoziCaptions.tsx
index cb38062..89214ab 100644
--- a/remotion/src/components/HormoziCaptions.tsx
+++ b/remotion/src/components/HormoziCaptions.tsx
@@ -16,7 +16,9 @@ interface Props {
motion?: Motion;
}
-export const HormoziCaptions: React.FC<Props> = ({ words, style, singleLine = false, motion }) => {
+export const HormoziCaptions: React.FC<Props> = ({
+ words, style, singleLine = false, motion,
+}) => {
const frame = useCurrentFrame();
const { fps, height, durationInFrames } = useVideoConfig();
const s = captionScale(height);
@@ -73,13 +75,19 @@ export const HormoziCaptions: React.FC<Props> = ({ words, style, singleLine = fa
const text = style.uppercase
? word.word.toUpperCase()
: word.word;
+ // The word being spoken still wins: the sweep is what this style is.
+ // Emphasis colours it for the rest of the chunk, which is the part
+ // somebody reads with the sound off.
+ const emphasis = word.emphasis
+ ? style.emphasisColor ?? style.activeColor
+ : null;
return (
<React.Fragment key={i}>
{i > 0 ? " " : ""}
<span
style={{
- color: isActive ? style.activeColor : style.color,
+ color: isActive ? style.activeColor : emphasis ?? style.color,
textShadow: isActive
? `0 0 30px ${style.activeColor}60, 0 0 60px ${style.activeColor}30`
: "none",
diff --git a/remotion/src/components/KaraokeCaptions.tsx b/remotion/src/components/KaraokeCaptions.tsx
index c45f274..1f76e9c 100644
--- a/remotion/src/components/KaraokeCaptions.tsx
+++ b/remotion/src/components/KaraokeCaptions.tsx
@@ -40,8 +40,17 @@ const KaraokeLine: React.FC<{
<React.Fragment key={i}>
{i > 0 ? " " : ""}
<span style={{ position: "relative", display: "inline" }}>
- {/* Base text (dim) */}
- <span style={{ color: style.color }}>{word.word}</span>
+ {/* Base text (dim). Emphasis lifts it out of the dim state so a
+ key word is legible before the sweep reaches it. */}
+ <span
+ style={{
+ color: word.emphasis
+ ? style.emphasisColor ?? style.activeColor
+ : style.color,
+ }}
+ >
+ {word.word}
+ </span>
{/* Active overlay (clips left to right) */}
<span
style={{
diff --git a/remotion/src/components/NameCard.tsx b/remotion/src/components/NameCard.tsx
index bee1a10..9dcdfa0 100644
--- a/remotion/src/components/NameCard.tsx
+++ b/remotion/src/components/NameCard.tsx
@@ -1,6 +1,6 @@
import React from "react";
import { useCurrentFrame, useVideoConfig } from "remotion";
-import { captionScale } from "../types";
+import { captionScale, FONT } from "../types";
import { MOTION, motionAt } from "../motion";
import type { Motion } from "../motion";
@@ -40,7 +40,6 @@ export const NameCard: React.FC<NameCardProps> = ({
const s = captionScale(height);
if (!title) return null;
- if (frame >= seconds * fps) return null;
const { opacity, shift } = motionAt({
frame, fps, start: 0, end: seconds,
@@ -67,7 +66,7 @@ export const NameCard: React.FC<NameCardProps> = ({
>
<div
style={{
- fontFamily: "'DM Sans', sans-serif",
+ fontFamily: FONT,
fontSize: 44 * s,
fontWeight: 700,
lineHeight: 1.2,
@@ -79,7 +78,7 @@ export const NameCard: React.FC<NameCardProps> = ({
{subtitle && (
<div
style={{
- fontFamily: "'DM Sans', sans-serif",
+ fontFamily: FONT,
fontSize: 38 * s,
fontWeight: 400,
lineHeight: 1.25,
diff --git a/remotion/src/components/ProgressBar.tsx b/remotion/src/components/ProgressBar.tsx
new file mode 100644
index 0000000..dcd80d7
--- /dev/null
+++ b/remotion/src/components/ProgressBar.tsx
@@ -0,0 +1,58 @@
+import React from "react";
+import { useCurrentFrame, useVideoConfig } from "remotion";
+import { captionScale } from "../types";
+
+export interface ProgressBarProps {
+ color?: string;
+ /** The unfilled remainder. Transparent leaves the video showing through. */
+ track?: string;
+ /** Bar thickness in unscaled units. */
+ thickness?: number;
+}
+
+/**
+ * How much of the clip is left, as a line across the bottom.
+ *
+ * A viewer deciding whether to keep watching is asking how long this goes on
+ * for, and a clip that answers keeps them past the first seconds. The player's
+ * own scrubber does not: it belongs to the feed, it is not always drawn, and
+ * on a reposted file it is gone.
+ *
+ * Anchored to the very bottom edge rather than inset, because a progress bar
+ * that floats reads as a design element and one on the edge reads as a fact.
+ */
+export const ProgressBar: React.FC<ProgressBarProps> = ({
+ color = "#3B9CFF",
+ track = "rgba(255,255,255,0.15)",
+ thickness = 8,
+}) => {
+ const frame = useCurrentFrame();
+ const { durationInFrames, height } = useVideoConfig();
+ const s = captionScale(height);
+
+ // The last frame should read as full rather than as one frame short.
+ const progress = durationInFrames > 1
+ ? Math.min(1, frame / (durationInFrames - 1))
+ : 1;
+
+ return (
+ <div
+ style={{
+ position: "absolute",
+ left: 0,
+ right: 0,
+ bottom: 0,
+ height: thickness * s,
+ backgroundColor: track,
+ }}
+ >
+ <div
+ style={{
+ width: `${progress * 100}%`,
+ height: "100%",
+ backgroundColor: color,
+ }}
+ />
+ </div>
+ );
+};
diff --git a/remotion/src/components/SubtleCaptions.tsx b/remotion/src/components/SubtleCaptions.tsx
index 9c4b7a4..3997ea9 100644
--- a/remotion/src/components/SubtleCaptions.tsx
+++ b/remotion/src/components/SubtleCaptions.tsx
@@ -13,7 +13,51 @@ interface Props {
motion?: Motion;
}
-export const SubtleCaptions: React.FC<Props> = ({ words, style, singleLine = false, motion }) => {
+/**
+ * One line of the caption, word by word.
+ *
+ * Drawn as spans rather than as a joined string so an emphasised word can be
+ * coloured; the line reads identically when nothing is emphasised.
+ */
+const Line: React.FC<{
+ words: Word[];
+ style: CaptionStyle;
+ scale: number;
+ nowrap?: boolean;
+}> = ({ words, style, scale, nowrap = false }) => (
+ <span
+ style={{
+ fontFamily: style.fontFamily,
+ fontSize: style.fontSize * scale,
+ fontWeight: 400,
+ color: style.color,
+ textShadow:
+ "0 1px 3px rgba(0,0,0,0.95), 0 0 20px rgba(0,0,0,0.6), 0 0 50px rgba(0,0,0,0.3)",
+ textAlign: "center",
+ lineHeight: 1.35,
+ whiteSpace: nowrap ? "nowrap" : undefined,
+ }}
+ >
+ {words.map((word, i) => (
+ <React.Fragment key={i}>
+ {i > 0 ? " " : ""}
+ <span
+ style={
+ word.emphasis
+ ? { color: style.emphasisColor ?? style.activeColor }
+ : undefined
+ }
+ >
+ {word.word}
+ </span>
+ </React.Fragment>
+ ))}
+ </span>
+);
+
+export const SubtleCaptions: React.FC<Props> = ({
+ words, style, singleLine = false, motion,
+}) => {
const frame = useCurrentFrame();
const { fps, height, durationInFrames } = useVideoConfig();
const s = captionScale(height);
@@ -41,9 +85,6 @@ export const SubtleCaptions: React.FC<Props> = ({ words, style, singleLine = fal
Math.ceil(activeChunk.words.length / 2),
singleLine,
);
- const text1 = line1.map((w) => w.word).join(" ");
- const text2 = line2.map((w) => w.word).join(" ");
-
return (
<div
style={{
@@ -59,37 +100,8 @@ export const SubtleCaptions: React.FC<Props> = ({ words, style, singleLine = fal
transform: `translateY(${translateY}px)`,
}}
>
- <span
- style={{
- fontFamily: style.fontFamily,
- fontSize: style.fontSize * s,
- fontWeight: 400,
- color: style.color,
- textShadow:
- "0 1px 3px rgba(0,0,0,0.95), 0 0 20px rgba(0,0,0,0.6), 0 0 50px rgba(0,0,0,0.3)",
- textAlign: "center",
- lineHeight: 1.35,
- whiteSpace: singleLine ? "nowrap" : undefined,
- }}
- >
- {text1}
- </span>
- {text2 && (
- <span
- style={{
- fontFamily: style.fontFamily,
- fontSize: style.fontSize * s,
- fontWeight: 400,
- color: style.color,
- textShadow:
- "0 1px 3px rgba(0,0,0,0.95), 0 0 20px rgba(0,0,0,0.6), 0 0 50px rgba(0,0,0,0.3)",
- textAlign: "center",
- lineHeight: 1.35,
- }}
- >
- {text2}
- </span>
- )}
+ <Line words={line1} style={style} scale={s} nowrap={singleLine} />
+ {line2.length > 0 && <Line words={line2} style={style} scale={s} />}
</div>
);
};
diff --git a/remotion/src/components/TopicChip.tsx b/remotion/src/components/TopicChip.tsx
new file mode 100644
index 0000000..4446005
--- /dev/null
+++ b/remotion/src/components/TopicChip.tsx
@@ -0,0 +1,67 @@
+import React from "react";
+import { useVideoConfig } from "remotion";
+import { captionScale, FONT, LOGO_EDGE, LOGO_INSET } from "../types";
+import type { LogoPosition } from "../types";
+
+export interface TopicChipProps {
+ /** What the clip is about, in two or three words. */
+ label: string;
+ /** Where it sits. Shares LogoPosition so a template names corners once. */
+ position?: LogoPosition;
+ color?: string;
+ /** Drawn behind the label. Transparent by default, which is the reference look. */
+ background?: string;
+}
+
+/**
+ * A standing label saying what this clip is about.
+ *
+ * Every produced short carries one and no cut of a podcast does, which is most
+ * of why a raw clip reads as a raw clip. It holds still for the whole clip on
+ * purpose: it is furniture, not a caption, and anything that moves up there
+ * competes with the words.
+ *
+ * Small, letterspaced and upper case, so it reads as a label rather than as a
+ * sentence somebody forgot to finish.
+ */
+export const TopicChip: React.FC<TopicChipProps> = ({
+ label,
+ position = "top-left",
+ color = "#FFFFFF",
+ background = "transparent",
+}) => {
+ const { height } = useVideoConfig();
+ const s = captionScale(height);
+
+ if (!label) return null;
+
+ const padded = background !== "transparent";
+
+ return (
+ <div
+ style={{
+ position: "absolute",
+ ...(position.startsWith("top-")
+ ? { top: LOGO_INSET * s }
+ : { bottom: LOGO_INSET * s }),
+ ...(position.endsWith("-left")
+ ? { left: LOGO_EDGE * s }
+ : position.endsWith("-right")
+ ? { right: LOGO_EDGE * s }
+ : { left: "50%", transform: "translateX(-50%)" }),
+ fontFamily: FONT,
+ fontSize: 30 * s,
+ fontWeight: 700,
+ letterSpacing: 3 * s,
+ textTransform: "uppercase",
+ color,
+ background,
+ ...(padded
+ ? { padding: `${10 * s}px ${20 * s}px`, borderRadius: 10 * s }
+ : { textShadow: "0 2px 12px rgba(0,0,0,0.8)" }),
+ }}
+ >
+ {label}
+ </div>
+ );
+};
diff --git a/remotion/src/components/Watermark.tsx b/remotion/src/components/Watermark.tsx
index c4c9ba4..7ea5caa 100644
--- a/remotion/src/components/Watermark.tsx
+++ b/remotion/src/components/Watermark.tsx
@@ -1,13 +1,7 @@
import React from "react";
import { Img, staticFile } from "remotion";
+import { captionScale, LOGO_EDGE, LOGO_HEIGHT, LOGO_INSET, LOGO_WIDTH } from "../types";
import type { LogoPosition } from "../types";
-import { captionScale } from "../types";
-
-// Unscaled logo box, shared with BrandedCaptions' caption-margin guard so the
-// mark and the gap left for it cannot drift apart.
-export const LOGO_INSET = 180;
-export const LOGO_HEIGHT = 126;
-export const LOGO_CAPTION_GAP = 24;
/**
* The show's logo, on every clip.
@@ -22,7 +16,6 @@ export const Watermark: React.FC<{
src?: string;
height: number;
position?: LogoPosition;
- /** Multiplier supplied by a template. 1 preserves the original mark. */
scale?: number;
}> = ({ src, height, position = "top-left", scale = 1 }) => {
if (!src) return null;
@@ -33,13 +26,15 @@ export const Watermark: React.FC<{
src={src.startsWith("http") ? src : staticFile(src)}
style={{
position: "absolute",
- ...(position.startsWith("top-") ? { top: LOGO_INSET * s } : { bottom: LOGO_INSET * s }),
+ ...(position.startsWith("top-")
+ ? { top: LOGO_INSET * s }
+ : { bottom: LOGO_INSET * s }),
...(position.endsWith("-left")
- ? { left: 108 * s }
+ ? { left: LOGO_EDGE * s }
: position.endsWith("-right")
- ? { right: 108 * s }
+ ? { right: LOGO_EDGE * s }
: { left: "50%", transform: "translateX(-50%)" }),
- width: 255 * s * scale,
+ width: LOGO_WIDTH * s * scale,
height: LOGO_HEIGHT * s * scale,
objectFit: "contain",
}}
diff --git a/remotion/src/motion.ts b/remotion/src/motion.ts
index 2e627d2..cd63815 100644
--- a/remotion/src/motion.ts
+++ b/remotion/src/motion.ts
@@ -37,6 +37,11 @@ export const MOTION: Record<string, Motion> = {
branded: { enter: "none", exit: "none", duration: 0, feel: "linear" },
/** Names arrive, hold, and get out of the way. */
nameCard: { enter: "rise", exit: "fade", duration: 8, feel: "soft" },
+ /**
+ * A card takes the frame, so it has to arrive quickly enough not to read as
+ * a slow wipe and leave without a gap where neither it nor the video is up.
+ */
+ card: { enter: "fade", exit: "fade", duration: 6, feel: "soft" },
/** Always there, so it neither arrives nor leaves. */
watermark: { enter: "none", exit: "none", duration: 0, feel: "linear" },
};
diff --git a/remotion/src/types.ts b/remotion/src/types.ts
index 629e380..4ca70b1 100644
--- a/remotion/src/types.ts
+++ b/remotion/src/types.ts
@@ -4,6 +4,15 @@ export interface Word {
end: number;
confidence?: number;
speaker?: string;
+ /**
+ * Worth reading even by somebody scrolling past with the sound off: a
+ * number, a name, the word the sentence was built to land on.
+ *
+ * It rides on the word rather than arriving as a list of indices, because
+ * every caption style chunks and splits the array before drawing it and an
+ * index into the original would be wrong by then.
+ */
+ emphasis?: boolean;
}
export interface CaptionStyle {
@@ -12,6 +21,11 @@ export interface CaptionStyle {
fontFamily: string;
color: string;
activeColor: string;
+ /**
+ * What an emphasised word is coloured. Falls back to activeColor, so a
+ * style that never sets one still marks emphasis rather than dropping it.
+ */
+ emphasisColor?: string;
uppercase: boolean;
wordsPerChunk: number;
marginBottom: number;
@@ -26,6 +40,19 @@ export type LogoPosition =
| "bottom-center"
| "bottom-right";
+/**
+ * The logo's box, in unscaled units.
+ *
+ * Watermark draws it and the branded captions keep clear of it, and those are
+ * two files. Shared here so a logo that moves cannot leave the caption margin
+ * guarding the place it used to be.
+ */
+export const LOGO_INSET = 180;
+export const LOGO_EDGE = 108;
+export const LOGO_WIDTH = 255;
+export const LOGO_HEIGHT = 126;
+export const LOGO_CAPTION_GAP = 24;
+
export interface CaptionProps {
words: Word[];
style: CaptionStyle;
@@ -36,7 +63,18 @@ export interface CaptionProps {
faceY?: number | null; // normalized 0-1 (0=top, 1=bottom)
}
-const FONT = "'DM Sans', sans-serif";
+/**
+ * The caption stack, in falling-back order.
+ *
+ * DM Sans draws Latin and nothing else, so the Noto families behind it are
+ * what a Georgian or Russian show is actually rendered in. The browser picks
+ * per glyph, so a Latin clip never leaves DM Sans.
+ */
+export const FONT = "'DM Sans', 'Noto Sans', 'Noto Sans Georgian', sans-serif";
+
+/** A show's own font, ahead of the stack that covers what it cannot draw. */
+export const fontStack = (family?: string | null): string =>
+ family ? `'${family.replace(/'/g, "")}', ${FONT}` : FONT;
// Caption geometry (font sizes, margins, insets) is authored for a 1920-tall
// vertical canvas. Multiply pixel values by this factor so a shorter canvas
@@ -52,6 +90,7 @@ export const STYLES: Record<string, CaptionStyle> = {
fontFamily: FONT,
color: "#FFFFFF",
activeColor: "#FFFF00",
+ emphasisColor: "#3B9CFF",
uppercase: true,
wordsPerChunk: 3,
marginBottom: 400,
@@ -62,6 +101,7 @@ export const STYLES: Record<string, CaptionStyle> = {
fontFamily: FONT,
color: "rgba(255,255,255,0.4)",
activeColor: "#FFFFFF",
+ emphasisColor: "#3B9CFF",
uppercase: false,
wordsPerChunk: 5,
marginBottom: 400,
@@ -72,6 +112,7 @@ export const STYLES: Record<string, CaptionStyle> = {
fontFamily: FONT,
color: "#FFFFFF",
activeColor: "#FFFFFF",
+ emphasisColor: "#7FD1FF",
uppercase: false,
wordsPerChunk: 6,
marginBottom: 200,
@@ -82,6 +123,7 @@ export const STYLES: Record<string, CaptionStyle> = {
fontFamily: FONT,
color: "#FFFFFF",
activeColor: "#FFFFFF",
+ emphasisColor: "#3B9CFF",
uppercase: false,
wordsPerChunk: 3,
marginBottom: 420,