Skip to content

🎥 Make videos programmatically with React

`@remotion/jonnys-videos`: Improve animated caption effects and layout

Jonny Burgere3925b60bdff
diff --git a/bun.lock b/bun.lock
index e8bc03ee74..ff20f322cb 100644
--- a/bun.lock
+++ b/bun.lock
@@ -1031,6 +1031,7 @@
"@remotion/captions": "workspace:*",
"@remotion/cli": "workspace:*",
"@remotion/effects": "workspace:*",
+ "@remotion/layout-utils": "workspace:*",
"@remotion/media": "workspace:*",
"@remotion/noise": "workspace:*",
"@remotion/shapes": "workspace:*",
diff --git a/packages/effects/src/fisheye/fisheye-shaders.ts b/packages/effects/src/fisheye/fisheye-shaders.ts
index 2b2fb3fdc9..64658c5903 100644
--- a/packages/effects/src/fisheye/fisheye-shaders.ts
+++ b/packages/effects/src/fisheye/fisheye-shaders.ts
@@ -28,7 +28,7 @@ void main() {
float r = dist / max(uRadius, 0.0001);
if (r > 1.0 || uFieldOfView <= 0.0001) {
- fragColor = vec4(0.0);
+ fragColor = texture(uSource, vUv);
return;
}
diff --git a/packages/effects/src/visual-test/effects-visual.test.ts b/packages/effects/src/visual-test/effects-visual.test.ts
index 8ddf5bb008..62efdab099 100644
--- a/packages/effects/src/visual-test/effects-visual.test.ts
+++ b/packages/effects/src/visual-test/effects-visual.test.ts
@@ -4,6 +4,7 @@ import {colorCorrection} from '../color-correction.js';
import {contrast} from '../contrast.js';
import {evolve} from '../evolve.js';
import {exposure} from '../exposure.js';
+import {fisheye} from '../fisheye.js';
import {levels} from '../levels.js';
import {noise} from '../noise.js';
import {outline} from '../outline.js';
@@ -37,6 +38,56 @@ test('stacks repeated WebGL effects without blanking or flipping the image', asy
});
});
+test('fisheye() preserves pixels outside the lens radius and at zero field of view', async () => {
+ const width = 64;
+ const height = 64;
+ const source = document.createElement('canvas');
+ source.width = width;
+ source.height = height;
+ const sourceContext = source.getContext('2d');
+ if (!sourceContext) {
+ throw new Error('Could not get source context');
+ }
+
+ sourceContext.fillStyle = 'rgb(12, 34, 56)';
+ sourceContext.fillRect(0, 0, width, height);
+
+ const canvas = await renderEffectChainToCanvas({
+ source,
+ width,
+ height,
+ effects: descriptorsToMemoizedEffects([
+ fisheye({fieldOfView: 1, radius: 0.25}),
+ ]),
+ });
+ const context = canvas.getContext('2d');
+ if (!context) {
+ throw new Error('Could not get output context');
+ }
+
+ const pixelOutsideLens = context.getImageData(2, 2, 1, 1).data;
+ expect([...pixelOutsideLens]).toEqual([12, 34, 56, 255]);
+
+ const zeroFieldOfViewCanvas = await renderEffectChainToCanvas({
+ source,
+ width,
+ height,
+ effects: descriptorsToMemoizedEffects([fisheye({fieldOfView: 0})]),
+ });
+ const zeroFieldOfViewContext = zeroFieldOfViewCanvas.getContext('2d');
+ if (!zeroFieldOfViewContext) {
+ throw new Error('Could not get zero field of view output context');
+ }
+
+ const zeroFieldOfViewPixel = zeroFieldOfViewContext.getImageData(
+ 32,
+ 32,
+ 1,
+ 1,
+ ).data;
+ expect([...zeroFieldOfViewPixel]).toEqual([12, 34, 56, 255]);
+});
+
test('outline() draws around alpha while preserving the source', async () => {
const width = 64;
const height = 64;
diff --git a/packages/jonnys-videos/package.json b/packages/jonnys-videos/package.json
index ae8ee93e8a..cb078dd5dd 100644
--- a/packages/jonnys-videos/package.json
+++ b/packages/jonnys-videos/package.json
@@ -19,6 +19,7 @@
"@remotion/captions": "workspace:*",
"@remotion/cli": "workspace:*",
"@remotion/effects": "workspace:*",
+ "@remotion/layout-utils": "workspace:*",
"@remotion/media": "workspace:*",
"@remotion/noise": "workspace:*",
"@remotion/shapes": "workspace:*",
diff --git a/packages/jonnys-videos/src/components/AnimatedCaptions.tsx b/packages/jonnys-videos/src/components/AnimatedCaptions.tsx
index a37b2ddfad..f204b28b4a 100644
--- a/packages/jonnys-videos/src/components/AnimatedCaptions.tsx
+++ b/packages/jonnys-videos/src/components/AnimatedCaptions.tsx
@@ -1,32 +1,138 @@
import type {Caption, TikTokPage} from '@remotion/captions';
+import {fisheye, type FisheyeParams} from '@remotion/effects/fisheye';
+import {glow} from '@remotion/effects/glow';
+import {radialProgressiveBlur} from '@remotion/effects/radial-progressive-blur';
import {Audio} from '@remotion/media';
-import React, {useCallback, useEffect, useMemo, useState} from 'react';
+import React, {
+ forwardRef,
+ useCallback,
+ useEffect,
+ useImperativeHandle,
+ useLayoutEffect,
+ useMemo,
+ useRef,
+ useState,
+} from 'react';
import {
AbsoluteFill,
+ Easing,
+ HtmlInCanvas,
+ Interactive,
+ interpolate,
+ interpolateColors,
Sequence,
+ spring,
useCurrentFrame,
useDelayRender,
useVideoConfig,
+ type InteractiveBaseProps,
+ type InteractivitySchema,
+ type SequenceControls,
} from 'remotion';
-import {createSentenceAwareCaptionPages} from './paginate-captions';
+import {
+ type CaptionPageLayout,
+ createSentenceAwareCaptionPages,
+} from './paginate-captions';
export const CAPTIONS_HEIGHT = 360;
-type AnimatedCaptionsProps = {
- captionsSrc: string;
- voiceoverSrc: string | null;
+type AnimatedCaptionsProps = InteractiveBaseProps & {
+ readonly captions: Caption[] | null;
+ readonly captionsSrc: string | null;
+ readonly voiceoverSrc: string | null;
};
+const animatedCaptionsSchema = {
+ ...Interactive.baseSchema,
+ ...Interactive.captionsSchema,
+} as const satisfies InteractivitySchema;
+
const SWITCH_CAPTIONS_EVERY_MS = 1100;
-const HIGHLIGHT_COLOR = '#ff3b1f';
+const FISHEYE_CENTER_MOVE_MAX_DURATION_IN_SECONDS = 0.2;
+const RADIAL_BLUR_START = 0.5;
+const RADIAL_BLUR_FOCUS_PADDING_IN_PIXELS = 8;
+const CAPTION_PAGE_LAYOUT = {
+ fontFamily: 'Arial Black, Arial, sans-serif',
+ fontSize: 76,
+ fontWeight: 900,
+ letterSpacing: -3.5,
+ maxLineWidth: 952,
+ maxLines: 2,
+ wordGap: 26,
+} as const satisfies CaptionPageLayout;
+type FisheyeCenter = NonNullable<FisheyeParams['center']>;
+type WordFocusRegion = {
+ center: FisheyeCenter;
+ width: number;
+ height: number;
+};
-const CaptionPage: React.FC<{page: TikTokPage}> = ({page}) => {
- const frame = useCurrentFrame();
- const {fps} = useVideoConfig();
- const absoluteTimeMs = page.startMs + (frame / fps) * 1000;
+const DEFAULT_WORD_FOCUS_REGION = {
+ center: [0.5, 0.5],
+ width: 0.16,
+ height: 0.3,
+} as const satisfies WordFocusRegion;
+
+type CaptionPageProps = {
+ focusProgress: number;
+ focusedTokenIndex: number;
+ page: TikTokPage;
+ pageKey: string;
+ onWordFocusRegions: (
+ pageKey: string,
+ regions: readonly WordFocusRegion[],
+ ) => void;
+};
+
+const CaptionPage: React.FC<CaptionPageProps> = ({
+ focusProgress,
+ focusedTokenIndex,
+ page,
+ pageKey,
+ onWordFocusRegions,
+}) => {
+ const containerRef = useRef<HTMLDivElement>(null);
+ const wordRefs = useRef<Array<HTMLSpanElement | null>>([]);
+
+ useLayoutEffect(() => {
+ const container = containerRef.current;
+ if (!container) {
+ return;
+ }
+
+ const containerBounds = container.getBoundingClientRect();
+ if (containerBounds.width === 0 || containerBounds.height === 0) {
+ return;
+ }
+
+ const regions = wordRefs.current.map((word): WordFocusRegion => {
+ if (!word) {
+ return DEFAULT_WORD_FOCUS_REGION;
+ }
+
+ const wordBounds = word.getBoundingClientRect();
+ return {
+ center: [
+ (wordBounds.left + wordBounds.width / 2 - containerBounds.left) /
+ containerBounds.width,
+ (wordBounds.top + wordBounds.height / 2 - containerBounds.top) /
+ containerBounds.height,
+ ],
+ width:
+ (wordBounds.width + RADIAL_BLUR_FOCUS_PADDING_IN_PIXELS * 2) /
+ containerBounds.width,
+ height:
+ (wordBounds.height + RADIAL_BLUR_FOCUS_PADDING_IN_PIXELS * 2) /
+ containerBounds.height,
+ };
+ });
+
+ onWordFocusRegions(pageKey, regions);
+ }, [onWordFocusRegions, page.tokens, pageKey]);
return (
<AbsoluteFill
+ ref={containerRef}
style={{
alignItems: 'center',
justifyContent: 'center',
@@ -37,30 +143,39 @@ const CaptionPage: React.FC<{page: TikTokPage}> = ({page}) => {
<div
style={{
textAlign: 'center',
- fontFamily: 'Arial Black, Arial, sans-serif',
- fontSize: 76,
- fontWeight: 900,
- letterSpacing: -3.5,
+ fontFamily: CAPTION_PAGE_LAYOUT.fontFamily,
+ fontSize: CAPTION_PAGE_LAYOUT.fontSize,
+ fontWeight: CAPTION_PAGE_LAYOUT.fontWeight,
+ letterSpacing: CAPTION_PAGE_LAYOUT.letterSpacing,
lineHeight: 1.05,
textWrap: 'balance',
whiteSpace: 'pre-wrap',
- filter:
- 'drop-shadow(0 8px 0 rgba(0, 0, 0, 0.82)) drop-shadow(0 16px 24px rgba(0, 0, 0, 0.55))',
}}
>
{page.tokens.map((token, tokenIndex) => {
- const isActive =
- token.fromMs <= absoluteTimeMs && token.toMs > absoluteTimeMs;
return (
<span
+ ref={(element) => {
+ wordRefs.current[tokenIndex] = element;
+ }}
key={`${token.fromMs}-${tokenIndex}`}
style={{
- color: isActive ? HIGHLIGHT_COLOR : '#ffffff',
+ color:
+ tokenIndex === focusedTokenIndex
+ ? interpolateColors(
+ focusProgress,
+ [0, 1],
+ ['#d9d9d9', '#ffffff'],
+ )
+ : tokenIndex === focusedTokenIndex - 1
+ ? interpolateColors(
+ focusProgress,
+ [0, 1],
+ ['#ffffff', '#d9d9d9'],
+ )
+ : '#d9d9d9',
display: 'inline-block',
marginLeft: tokenIndex === 0 ? 0 : 26,
- WebkitTextStroke: isActive
- ? '3px rgba(38, 4, 0, 0.95)'
- : '2px rgba(0, 0, 0, 0.85)',
}}
>
{token.text.trimStart()}
@@ -72,79 +187,302 @@ const CaptionPage: React.FC<{page: TikTokPage}> = ({page}) => {
);
};
-export const AnimatedCaptions: React.FC<AnimatedCaptionsProps> = ({
- captionsSrc,
- voiceoverSrc,
-}) => {
- const [captions, setCaptions] = useState<Caption[] | null>(null);
- const {delayRender, continueRender, cancelRender} = useDelayRender();
- const [handle] = useState(() => delayRender('Loading ElevenLabs captions'));
- const {fps} = useVideoConfig();
-
- const loadCaptions = useCallback(async () => {
- try {
- const response = await fetch(captionsSrc);
- if (!response.ok) {
- throw new Error(`Could not load captions (${response.status})`);
- }
+const AnimatedCaptionsContent: React.FC<{
+ readonly captions: Caption[];
+ readonly voiceoverSrc: string | null;
+}> = ({captions, voiceoverSrc}) => {
+ const {fps, height, width} = useVideoConfig();
+ const frame = useCurrentFrame();
+ const [wordFocusRegionsByPage, setWordFocusRegionsByPage] = useState<
+ Record<string, readonly WordFocusRegion[]>
+ >({});
- setCaptions((await response.json()) as Caption[]);
- continueRender(handle);
- } catch (error) {
- cancelRender(error);
- }
- }, [cancelRender, captionsSrc, continueRender, handle]);
+ const onWordFocusRegions = useCallback(
+ (pageKey: string, regions: readonly WordFocusRegion[]) => {
+ setWordFocusRegionsByPage((currentRegions) => {
+ const existingRegions = currentRegions[pageKey];
+ if (
+ existingRegions?.length === regions.length &&
+ existingRegions.every(
+ (region, index) =>
+ region.center[0] === regions[index].center[0] &&
+ region.center[1] === regions[index].center[1] &&
+ region.width === regions[index].width &&
+ region.height === regions[index].height,
+ )
+ ) {
+ return currentRegions;
+ }
- useEffect(() => {
- loadCaptions();
- }, [loadCaptions]);
+ return {...currentRegions, [pageKey]: regions};
+ });
+ },
+ [],
+ );
- const pages = useMemo(() => {
- if (!captions) {
- return [];
- }
+ const pages = useMemo(
+ () =>
+ createSentenceAwareCaptionPages({
+ captions,
+ combineTokensWithinMilliseconds: SWITCH_CAPTIONS_EVERY_MS,
+ layout: CAPTION_PAGE_LAYOUT,
+ }),
+ [captions],
+ );
- return createSentenceAwareCaptionPages({
- captions,
- combineTokensWithinMilliseconds: SWITCH_CAPTIONS_EVERY_MS,
- });
- }, [captions]);
+ const currentPageIndex = pages.findIndex((page, index) => {
+ const nextPage = pages[index + 1];
+ const startFrame = Math.round((page.startMs / 1000) * fps);
+ const naturalEndFrame = Math.ceil(
+ ((page.startMs + page.durationMs) / 1000) * fps,
+ );
+ const endFrame = nextPage
+ ? Math.min(Math.round((nextPage.startMs / 1000) * fps), naturalEndFrame)
+ : naturalEndFrame;
- if (!captions) {
- return null;
+ return frame >= startFrame && frame < endFrame;
+ });
+ const currentPage = pages[currentPageIndex] ?? null;
+ const currentPageKey = currentPage
+ ? `${currentPage.startMs}-${currentPageIndex}`
+ : null;
+ const absoluteTimeMs = (frame / fps) * 1000;
+ let focusedTokenIndex = 0;
+
+ if (currentPage) {
+ for (let index = 0; index < currentPage.tokens.length; index++) {
+ if (currentPage.tokens[index].fromMs <= absoluteTimeMs) {
+ focusedTokenIndex = index;
+ }
+ }
}
+ const currentPageWordFocusRegions = currentPageKey
+ ? wordFocusRegionsByPage[currentPageKey]
+ : null;
+ const targetRegion =
+ currentPageWordFocusRegions?.[focusedTokenIndex] ??
+ DEFAULT_WORD_FOCUS_REGION;
+ const previousRegion = currentPageWordFocusRegions?.[
+ focusedTokenIndex - 1
+ ] ?? {
+ ...DEFAULT_WORD_FOCUS_REGION,
+ width: targetRegion.width,
+ height: targetRegion.height,
+ };
+ const focusedToken = currentPage?.tokens[focusedTokenIndex] ?? null;
+ const focusedTokenStartFrame = focusedToken
+ ? Math.round((focusedToken.fromMs / 1000) * fps)
+ : frame;
+ const focusedTokenDurationInFrames = focusedToken
+ ? Math.max(
+ 2,
+ Math.round(((focusedToken.toMs - focusedToken.fromMs) / 1000) * fps),
+ )
+ : 2;
+ const focusedTokenFrame = frame - focusedTokenStartFrame;
+ const centerProgress = !focusedToken
+ ? 1
+ : spring({
+ frame: focusedTokenFrame,
+ fps,
+ durationInFrames: Math.max(
+ 1,
+ Math.min(
+ focusedTokenDurationInFrames,
+ Math.round(FISHEYE_CENTER_MOVE_MAX_DURATION_IN_SECONDS * fps),
+ ),
+ ),
+ config: {
+ damping: 200,
+ overshootClamping: true,
+ },
+ });
+ const focusProgress = interpolate(centerProgress, [0, 1], [0, 1], {
+ easing: Easing.spring({damping: 200}),
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ });
+ const fisheyeCenter = [
+ interpolate(
+ focusProgress,
+ [0, 1],
+ [previousRegion.center[0], targetRegion.center[0]],
+ ),
+ interpolate(
+ focusProgress,
+ [0, 1],
+ [previousRegion.center[1], targetRegion.center[1]],
+ ),
+ ] as const satisfies FisheyeCenter;
+ const radialBlurWidth =
+ (interpolate(
+ centerProgress,
+ [0, 1],
+ [previousRegion.width, targetRegion.width],
+ ) *
+ Math.SQRT2) /
+ RADIAL_BLUR_START;
+ const radialBlurHeight =
+ (interpolate(
+ centerProgress,
+ [0, 1],
+ [previousRegion.height, targetRegion.height],
+ ) *
+ Math.SQRT2) /
+ RADIAL_BLUR_START;
+
return (
- <AbsoluteFill>
+ <>
{voiceoverSrc ? (
<Audio src={voiceoverSrc} hidden showInTimeline={false} />
) : null}
- {pages.map((page, index) => {
- const nextPage = pages[index + 1];
- const startFrame = Math.round((page.startMs / 1000) * fps);
- const naturalEndFrame = Math.ceil(
- ((page.startMs + page.durationMs) / 1000) * fps,
- );
- const endFrame = nextPage
- ? Math.min(
- Math.round((nextPage.startMs / 1000) * fps),
- naturalEndFrame,
- )
- : naturalEndFrame;
- const durationInFrames = Math.max(1, endFrame - startFrame);
-
- return (
- <Sequence
- key={`${page.startMs}-${index}`}
- from={startFrame}
- durationInFrames={durationInFrames}
- premountFor={fps}
- showInTimeline={false}
- >
- <CaptionPage page={page} />
- </Sequence>
- );
- })}
- </AbsoluteFill>
+ <HtmlInCanvas
+ name="Animated captions canvas"
+ width={width}
+ height={height}
+ effects={[
+ glow({
+ intensity: 0.6,
+ color: 'gray',
+ radius: 100,
+ }),
+ fisheye({
+ fieldOfView: 1.5,
+ radius: 3,
+ center: fisheyeCenter,
+ zoom: 0.8,
+ }),
+ radialProgressiveBlur({
+ center: fisheyeCenter,
+ width: radialBlurWidth,
+ height: radialBlurHeight,
+ start: RADIAL_BLUR_START,
+ startBlur: 0,
+ endBlur: 5,
+ }),
+ ]}
+ >
+ <AbsoluteFill>
+ {pages.map((page, index) => {
+ const pageKey = `${page.startMs}-${index}`;
+ const nextPage = pages[index + 1];
+ const startFrame = Math.round((page.startMs / 1000) * fps);
+ const naturalEndFrame = Math.ceil(
+ ((page.startMs + page.durationMs) / 1000) * fps,
+ );
+ const endFrame = nextPage
+ ? Math.min(
+ Math.round((nextPage.startMs / 1000) * fps),
+ naturalEndFrame,
+ )
+ : naturalEndFrame;
+ const durationInFrames = Math.max(1, endFrame - startFrame);
+
+ return (
+ <Sequence
+ key={pageKey}
+ from={startFrame}
+ durationInFrames={durationInFrames}
+ premountFor={fps}
+ showInTimeline={false}
+ >
+ <CaptionPage
+ focusProgress={focusProgress}
+ focusedTokenIndex={focusedTokenIndex}
+ page={page}
+ pageKey={pageKey}
+ onWordFocusRegions={onWordFocusRegions}
+ />
+ </Sequence>
+ );
+ })}
+ </AbsoluteFill>
+ </HtmlInCanvas>
+ </>
+ );
+};
+
+const FetchedAnimatedCaptions: React.FC<{
+ readonly captionsSrc: string;
+ readonly voiceoverSrc: string | null;
+}> = ({captionsSrc, voiceoverSrc}) => {
+ const [captions, setCaptions] = useState<Caption[] | null>(null);
+ const {delayRender, continueRender, cancelRender} = useDelayRender();
+ const [handle] = useState(() => delayRender('Loading captions'));
+
+ useEffect(() => {
+ fetch(captionsSrc)
+ .then((response) => {
+ if (!response.ok) {
+ throw new Error(`Could not load captions (${response.status})`);
+ }
+
+ return response.json() as Promise<Caption[]>;
+ })
+ .then((loadedCaptions) => {
+ setCaptions(loadedCaptions);
+ continueRender(handle);
+ })
+ .catch((error) => {
+ cancelRender(error);
+ });
+ }, [cancelRender, captionsSrc, continueRender, handle]);
+
+ if (!captions) {
+ return null;
+ }
+
+ return (
+ <AnimatedCaptionsContent captions={captions} voiceoverSrc={voiceoverSrc} />
);
};
+
+const AnimatedCaptionsInner = forwardRef<
+ HTMLDivElement,
+ AnimatedCaptionsProps & {readonly controls: SequenceControls | undefined}
+>((props, ref) => {
+ const {
+ captions,
+ captionsSrc,
+ controls,
+ name,
+ voiceoverSrc,
+ ...interactiveProps
+ } = props;
+ const outlineRef = useRef<HTMLDivElement>(null);
+
+ useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);
+
+ return (
+ <Sequence
+ layout="none"
+ {...interactiveProps}
+ controls={controls}
+ name={name ?? '<AnimatedCaptions>'}
+ outlineRef={outlineRef}
+ >
+ <AbsoluteFill ref={outlineRef}>
+ {captions ? (
+ <AnimatedCaptionsContent
+ captions={captions}
+ voiceoverSrc={voiceoverSrc}
+ />
+ ) : captionsSrc ? (
+ <FetchedAnimatedCaptions
+ captionsSrc={captionsSrc}
+ voiceoverSrc={voiceoverSrc}
+ />
+ ) : null}
+ </AbsoluteFill>
+ </Sequence>
+ );
+});
+
+export const AnimatedCaptions = Interactive.withSchema({
+ Component: AnimatedCaptionsInner,
+ componentName: '<AnimatedCaptions>',
+ componentIdentity: null,
+ schema: animatedCaptionsSchema,
+ supportsEffects: false,
+}) as React.FC<AnimatedCaptionsProps>;
diff --git a/packages/jonnys-videos/src/components/paginate-captions.ts b/packages/jonnys-videos/src/components/paginate-captions.ts
index 1e02164a24..3489a115e7 100644
--- a/packages/jonnys-videos/src/components/paginate-captions.ts
+++ b/packages/jonnys-videos/src/components/paginate-captions.ts
@@ -1,7 +1,177 @@
import type {Caption, TikTokPage, TikTokToken} from '@remotion/captions';
import {createTikTokStyleCaptions} from '@remotion/captions';
+import {measureText} from '@remotion/layout-utils';
const SENTENCE_END = /[.!?…]["'”’)\]]*$/u;
+const PREFERRED_BREAK = /[,;:—–-]["'”’)\]]*$/u;
+const MAX_LAYOUT_PAGE_DURATION_IN_MS = 2500;
+const TARGET_WIDTH_PER_TWO_LINE_PAGE = 1.6;
+const WORDS_THAT_MAKE_AN_AWKWARD_PAGE_END = new Set([
+ 'a',
+ 'an',
+ 'and',
+ 'are',
+ 'as',
+ 'at',
+ 'be',
+ 'been',
+ 'being',
+ 'but',
+ 'by',
+ 'can',
+ 'could',
+ 'did',
+ 'do',
+ 'does',
+ 'for',
+ 'from',
+ 'gonna',
+ 'gotta',
+ 'had',
+ 'has',
+ 'have',
+ 'he',
+ 'her',
+ 'his',
+ 'i',
+ 'if',
+ 'in',
+ 'is',
+ 'it',
+ 'its',
+ 'may',
+ 'might',
+ 'must',
+ 'my',
+ 'of',
+ 'on',
+ 'or',
+ 'our',
+ 'should',
+ 'she',
+ 'than',
+ 'that',
+ 'the',
+ 'their',
+ 'they',
+ 'to',
+ 'was',
+ 'wanna',
+ 'were',
+ 'we',
+ 'will',
+ 'with',
+ 'without',
+ 'would',
+ 'your',
+]);
+const WORDS_THAT_MAKE_AN_AWKWARD_PAGE_START = new Set([
+ 'a',
+ 'an',
+ 'and',
+ 'are',
+ 'as',
+ 'at',
+ 'be',
+ 'been',
+ 'being',
+ 'but',
+ 'by',
+ 'can',
+ 'could',
+ 'did',
+ 'do',
+ 'does',
+ 'for',
+ 'from',
+ 'had',
+ 'has',
+ 'have',
+ 'in',
+ 'is',
+ 'may',
+ 'might',
+ 'must',
+ 'of',
+ 'on',
+ 'or',
+ 'should',
+ 'so',
+ 'than',
+ 'that',
+ 'the',
+ 'to',
+ 'was',
+ 'were',
+ 'which',
+ 'who',
+ 'will',
+ 'with',
+ 'without',
+ 'would',
+ 'you',
+]);
+const WORDS_THAT_MAKE_YOU_A_SUBJECT = new Set([
+ 'are',
+ 'buy',
+ 'can',
+ 'could',
+ 'did',
+ 'do',
+ 'get',
+ 'had',
+ 'have',
+ 'need',
+ 'pay',
+ 'should',
+ 'want',
+ 'will',
+ 'would',
+]);
+
+export type CaptionPageLayout = {
+ fontFamily: string;
+ fontSize: number;
+ fontWeight: number | string;
+ letterSpacing: number;
+ maxLineWidth: number;
+ maxLines: 2;
+ wordGap: number;
+};
+
+const normalizeWord = (text: string) =>
+ text
+ .trim()
+ .toLocaleLowerCase()
+ .replace(/^["'“‘([{]+|[.,!?…:;—–\-"'”’)\]}]+$/gu, '');
+
+const countAwkwardPageBreaks = (pages: TikTokPage[]) => {
+ let awkwardBreaks = 0;
+
+ for (let pageIndex = 0; pageIndex < pages.length - 1; pageIndex++) {
+ const lastToken = pages[pageIndex].tokens.at(-1)!;
+ const firstTokenOnNextPage = pages[pageIndex + 1].tokens[0];
+
+ if (PREFERRED_BREAK.test(lastToken.text.trim())) {
+ continue;
+ }
+
+ if (
+ WORDS_THAT_MAKE_AN_AWKWARD_PAGE_END.has(normalizeWord(lastToken.text)) ||
+ WORDS_THAT_MAKE_AN_AWKWARD_PAGE_START.has(
+ normalizeWord(firstTokenOnNextPage.text),
+ ) ||
+ (normalizeWord(lastToken.text) === 'you' &&
+ WORDS_THAT_MAKE_YOU_A_SUBJECT.has(
+ normalizeWord(firstTokenOnNextPage.text),
+ ))
+ ) {
+ awkwardBreaks++;
+ }
+ }
+
+ return awkwardBreaks;
+};
const splitIntoSentences = (captions: Caption[]): Caption[][] => {
const sentences: Caption[][] = [];
@@ -32,10 +202,202 @@ const toToken = (caption: Caption, isFirst: boolean): TikTokToken => ({
const rebalanceSentence = ({
captions,
pageCount,
+ layout,
}: {
captions: Caption[];
pageCount: number;
+ layout: CaptionPageLayout | null;
}): TikTokPage[] => {
+ if (layout) {
+ const wordWidths = captions.map(
+ (caption) =>
+ measureText({
+ text: caption.text.trim(),
+ fontFamily: layout.fontFamily,
+ fontSize: layout.fontSize,
+ fontWeight: layout.fontWeight,
+ letterSpacing: `${layout.letterSpacing}px`,
+ }).width,
+ );
+ const widthPrefixSums = [0];
+
+ for (const width of wordWidths) {
+ widthPrefixSums.push(widthPrefixSums[widthPrefixSums.length - 1] + width);
+ }
+
+ const getLineWidth = ({
+ from,
+ to,
+ isFirstLine,
+ }: {
+ from: number;
+ to: number;
+ isFirstLine: boolean;
+ }) => {
+ const wordCount = to - from;
+ const gaps = isFirstLine ? wordCount - 1 : wordCount;
+ return (
+ widthPrefixSums[to] -
+ widthPrefixSums[from] +
+ Math.max(0, gaps) * layout.wordGap
+ );
+ };
+
+ const sentenceStartMs = captions[0].startMs;
+ const sentenceEndMs = captions[captions.length - 1].endMs;
+ const targetPageDurationMs = (sentenceEndMs - sentenceStartMs) / pageCount;
+ const costs = new Array(pageCount + 1)
+ .fill(null)
+ .map(() => new Array(captions.length + 1).fill(Number.POSITIVE_INFINITY));
+ const previousBreaks = new Array(pageCount + 1)
+ .fill(null)
+ .map(() => new Array<number | null>(captions.length + 1).fill(null));
+ costs[0][0] = 0;
+
+ for (let pagesUsed = 0; pagesUsed < pageCount; pagesUsed++) {
+ for (let from = pagesUsed; from < captions.length; from++) {
+ if (!Number.isFinite(costs[pagesUsed][from])) {
+ continue;
+ }
+
+ const pagesRemaining = pageCount - pagesUsed - 1;
+ const latestBreak = captions.length - pagesRemaining;
+
+ for (let to = from + 1; to <= latestBreak; to++) {
+ const singleLineWidth = getLineWidth({
+ from,
+ to,
+ isFirstLine: true,
+ });
+ let layoutCost: number;
+
+ if (singleLineWidth <= layout.maxLineWidth) {
+ const fill = singleLineWidth / layout.maxLineWidth;
+ const shortfall = Math.max(0, 0.58 - fill);
+ const overfill = Math.max(0, fill - 0.94);
+ layoutCost = shortfall ** 2 * 11 + overfill ** 2 * 4;
+ } else {
+ let bestTwoLineCost = Number.POSITIVE_INFINITY;
+
+ for (let lineBreak = from + 1; lineBreak < to; lineBreak++) {
+ const firstLineWidth = getLineWidth({
+ from,
+ to: lineBreak,
+ isFirstLine: true,
+ });
+ const secondLineWidth = getLineWidth({
+ from: lineBreak,
+ to,
+ isFirstLine: false,
+ });
+
+ if (
+ firstLineWidth > layout.maxLineWidth ||
+ secondLineWidth > layout.maxLineWidth
+ ) {
+ continue;
+ }
+
+ const imbalance =
+ Math.abs(firstLineWidth - secondLineWidth) /
+ layout.maxLineWidth;
+ const shortestLine =
+ Math.min(firstLineWidth, secondLineWidth) / layout.maxLineWidth;
+ const shortLinePenalty = Math.max(0, 0.4 - shortestLine);
+ const twoLineCost =
+ imbalance ** 2 * 9 + shortLinePenalty ** 2 * 12;
+
+ bestTwoLineCost = Math.min(bestTwoLineCost, twoLineCost);
+ }
+
+ if (!Number.isFinite(bestTwoLineCost)) {
+ continue;
+ }
+
+ layoutCost = bestTwoLineCost;
+ }
+
+ const pageEndMs = captions[to]?.startMs ?? captions[to - 1].endMs;
+ const pageDurationMs = pageEndMs - captions[from].startMs;
+ const durationDifference =
+ (pageDurationMs - targetPageDurationMs) / targetPageDurationMs;
+ let breakCost = durationDifference ** 2 * 1.25;
+
+ if (to < captions.length) {
+ const wordBeforeBreak = normalizeWord(captions[to - 1].text);
+ const wordAfterBreak = normalizeWord(captions[to].text);
+
+ if (WORDS_THAT_MAKE_AN_AWKWARD_PAGE_END.has(wordBeforeBreak)) {
+ breakCost += 3.5;
+ }
+
+ if (WORDS_THAT_MAKE_AN_AWKWARD_PAGE_START.has(wordAfterBreak)) {
+ breakCost += 2;
+ }
+
+ if (
+ wordBeforeBreak === 'you' &&
+ WORDS_THAT_MAKE_YOU_A_SUBJECT.has(wordAfterBreak)
+ ) {
+ breakCost += 3.5;
+ }
+
+ if (PREFERRED_BREAK.test(captions[to - 1].text.trim())) {
+ breakCost -= 4;
+ }
+ }
+
+ const cost = costs[pagesUsed][from] + layoutCost + breakCost;
+
+ if (cost < costs[pagesUsed + 1][to]) {
+ costs[pagesUsed + 1][to] = cost;
+ previousBreaks[pagesUsed + 1][to] = from;
+ }
+ }
+ }
+ }
+
+ if (Number.isFinite(costs[pageCount][captions.length])) {
+ const breaks = [captions.length];
+ let cursor = captions.length;
+
+ for (let pagesUsed = pageCount; pagesUsed > 0; pagesUsed--) {
+ const previousBreak = previousBreaks[pagesUsed][cursor];
+
+ if (previousBreak === null) {
+ break;
+ }
+
+ breaks.push(previousBreak);
+ cursor = previousBreak;
+ }
+
+ breaks.reverse();
+
+ if (breaks.length === pageCount + 1) {
+ return breaks.slice(0, -1).map((from, pageIndex) => {
+ const to = breaks[pageIndex + 1];
+ const pageCaptions = captions.slice(from, to);
+ const tokens = pageCaptions.map((caption, tokenIndex) =>
+ toToken(caption, tokenIndex === 0),
+ );
+ const startMs = pageCaptions[0].startMs;
+ const endMs = captions[to]?.startMs ?? pageCaptions.at(-1)!.endMs;
+
+ return {
+ text: tokens
+ .map((token) => token.text)
+ .join('')
+ .trimStart(),
+ startMs,
+ tokens,
+ durationMs: endMs - startMs,
+ };
+ });
+ }
+ }
+ }
+
const wordsPerPage = Math.floor(captions.length / pageCount);
const pagesWithExtraWord = captions.length % pageCount;
const pages: TikTokPage[] = [];
@@ -70,16 +432,20 @@ const rebalanceSentence = ({
};
/**
- * Keeps the library's time-based page cadence, but never crosses a sentence
- * boundary. Once a sentence is complete, its words are spread evenly across
- * the number of pages the default paginator would have produced.
+ * Never crosses a sentence boundary. When layout information is supplied, the
+ * page count is derived from rendered width and a duration ceiling. Dynamic
+ * programming then chooses boundaries based on line balance, timing and
+ * natural phrase boundaries. Without layout information, the library's
+ * time-based cadence is retained.
*/
export const createSentenceAwareCaptionPages = ({
captions,
combineTokensWithinMilliseconds,
+ layout,
}: {
captions: Caption[];
combineTokensWithinMilliseconds: number;
+ layout: CaptionPageLayout | null;
}): TikTokPage[] => {
return splitIntoSentences(captions).flatMap((sentence) => {
const visibleCaptions = sentence.filter(
@@ -90,14 +456,62 @@ export const createSentenceAwareCaptionPages = ({
return [];
}
- const defaultPageCount = createTikTokStyleCaptions({
+ const pageCount = layout
+ ? Math.min(
+ visibleCaptions.length,
+ Math.max(
+ 1,
+ Math.ceil(
+ visibleCaptions.reduce(
+ (totalWidth, caption, index) =>
+ totalWidth +
+ measureText({
+ text: caption.text.trim(),
+ fontFamily: layout.fontFamily,
+ fontSize: layout.fontSize,
+ fontWeight: layout.fontWeight,
+ letterSpacing: `${layout.letterSpacing}px`,
+ }).width +
+ (index === 0 ? 0 : layout.wordGap),
+ 0,
+ ) /
+ (layout.maxLineWidth * TARGET_WIDTH_PER_TWO_LINE_PAGE),
+ ),
+ Math.ceil(
+ (visibleCaptions.at(-1)!.endMs - visibleCaptions[0].startMs) /
+ MAX_LAYOUT_PAGE_DURATION_IN_MS,
+ ),
+ ),
+ )
+ : createTikTokStyleCaptions({
+ captions: visibleCaptions,
+ combineTokensWithinMilliseconds,
+ }).pages.length;
+
+ const pages = rebalanceSentence({
captions: visibleCaptions,
- combineTokensWithinMilliseconds,
- }).pages.length;
+ pageCount,
+ layout,
+ });
- return rebalanceSentence({
+ if (!layout || pageCount === visibleCaptions.length) {
+ return pages;
+ }
+
+ const awkwardBreakCount = countAwkwardPageBreaks(pages);
+
+ if (awkwardBreakCount === 0) {
+ return pages;
+ }
+
+ const pagesWithOneMoreBreak = rebalanceSentence({
captions: visibleCaptions,
- pageCount: defaultPageCount,
+ pageCount: pageCount + 1,
+ layout,
});
+
+ return countAwkwardPageBreaks(pagesWithOneMoreBreak) < awkwardBreakCount
+ ? pagesWithOneMoreBreak
+ : pages;
});
};
diff --git a/packages/jonnys-videos/src/disco-light-show/AnimatedCaptions.tsx b/packages/jonnys-videos/src/disco-light-show/AnimatedCaptions.tsx
index ea90f2d43b..fca36865fe 100644
--- a/packages/jonnys-videos/src/disco-light-show/AnimatedCaptions.tsx
+++ b/packages/jonnys-videos/src/disco-light-show/AnimatedCaptions.tsx
@@ -5,14 +5,1170 @@ import {
import {asset} from './assets';
export const VOICEOVER_FILE = 'text-behind-video-2.wav';
-export const CAPTIONS_FILE = 'voiceover-captions.json';
export const CAPTIONS_DURATION_IN_FRAMES = 1816;
export {CAPTIONS_HEIGHT};
export const AnimatedCaptions: React.FC = () => {
return (
<SharedAnimatedCaptions
- captionsSrc={asset(CAPTIONS_FILE)}
+ captions={[
+ {
+ confidence: null,
+ startMs: 119,
+ endMs: 299,
+ text: 'This',
+ timestampMs: 209,
+ },
+ {
+ confidence: null,
+ startMs: 299,
+ endMs: 680,
+ text: ' DJ',
+ timestampMs: 489.5,
+ },
+ {
+ confidence: null,
+ startMs: 680,
+ endMs: 979,
+ text: ' set',
+ timestampMs: 829.5,
+ },
+ {
+ confidence: null,
+ startMs: 979,
+ endMs: 1259,
+ text: ' is',
+ timestampMs: 1119,
+ },
+ {
+ confidence: null,
+ startMs: 1259,
+ endMs: 1480,
+ text: ' run',
+ timestampMs: 1369.5,
+ },
+ {
+ confidence: null,
+ startMs: 1480,
+ endMs: 1799,
+ text: ' by',
+ timestampMs: 1639.5,
+ },
+ {
+ confidence: null,
+ startMs: 1799,
+ endMs: 2419,
+ text: ' agents.',
+ timestampMs: 2109,
+ },
+ {
+ confidence: null,
+ startMs: 2419,
+ endMs: 2980,
+ text: ' Claude',
+ timestampMs: 2699.5,
+ },
+ {
+ confidence: null,
+ startMs: 2980,
+ endMs: 3099,
+ text: ' is',
+ timestampMs: 3039.5,
+ },
+ {
+ confidence: null,
+ startMs: 3099,
+ endMs: 3199,
+ text: ' the',
+ timestampMs: 3149,
+ },
+ {
+ confidence: null,
+ startMs: 3199,
+ endMs: 3500,
+ text: ' lighting',
+ timestampMs: 3349.5,
+ },
+ {
+ confidence: null,
+ startMs: 3500,
+ endMs: 4078.9999999999995,
+ text: ' operator,',
+ timestampMs: 3789.5,
+ },
+ {
+ confidence: null,
+ startMs: 4078.9999999999995,
+ endMs: 4319,
+ text: ' while',
+ timestampMs: 4199,
+ },
+ {
+ confidence: null,
+ startMs: 4319,
+ endMs: 5019,
+ text: ' Remotion',
+ timestampMs: 4669,
+ },
+ {
+ confidence: null,
+ startMs: 5019,
+ endMs: 5199,
+ text: ' is',
+ timestampMs: 5109,
+ },
+ {
+ confidence: null,
+ startMs: 5199,
+ endMs: 5440,
+ text: ' doing',
+ timestampMs: 5319.5,
+ },
+ {
+ confidence: null,
+ startMs: 5440,
+ endMs: 5539,
+ text: ' the',
+ timestampMs: 5489.5,
+ },
+ {
+ confidence: null,
+ startMs: 5539,
+ endMs: 6079,
+ text: ' visuals.',
+ timestampMs: 5809,
+ },
+ {
+ confidence: null,
+ startMs: 6079,
+ endMs: 6420,
+ text: ' For',
+ timestampMs: 6249.5,
+ },
+ {
+ confidence: null,
+ startMs: 6420,
+ endMs: 6579,
+ text: ' my',
+ timestampMs: 6499.5,
+ },
+ {
+ confidence: null,
+ startMs: 6579,
+ endMs: 6940,
+ text: ' birthday',
+ timestampMs: 6759.5,
+ },
+ {
+ confidence: null,
+ startMs: 6940,
+ endMs: 7359,
+ text: ' party,',
+ timestampMs: 7149.5,
+ },
+ {
+ confidence: null,
+ startMs: 7359,
+ endMs: 7619,
+ text: ' I',
+ timestampMs: 7489,
+ },
+ {
+ confidence: null,
+ startMs: 7619,
+ endMs: 8300,
+ text: ' vibe-coded',
+ timestampMs: 7959.5,
+ },
+ {
+ confidence: null,
+ startMs: 8300,
+ endMs: 8500,
+ text: ' my',
+ timestampMs: 8400,
+ },
+ {
+ confidence: null,
+ startMs: 8500,
+ endMs: 8720,
+ text: ' own',
+ timestampMs: 8610,
+ },
+ {
+ confidence: null,
+ startMs: 8720,
+ endMs: 9099,
+ text: ' DJ',
+ timestampMs: 8909.5,
+ },
+ {
+ confidence: null,
+ startMs: 9099,
+ endMs: 9399,
+ text: ' show,',
+ timestampMs: 9249,
+ },
+ {
+ confidence: null,
+ startMs: 9399,
+ endMs: 9619,
+ text: ' and',
+ timestampMs: 9509,
+ },
+ {
+ confidence: null,
+ startMs: 9619,
+ endMs: 9719,
+ text: ' I',
+ timestampMs: 9669,
+ },
+ {
+ confidence: null,
+ startMs: 9719,
+ endMs: 10019,
+ text: ' wanna',
+ timestampMs: 9869,
+ },
+ {
+ confidence: null,
+ startMs: 10019,
+ endMs: 10179,
+ text: ' show',
+ timestampMs: 10099,
+ },
+ {
+ confidence: null,
+ startMs: 10179,
+ endMs: 10399,
+ text: ' you',
+ timestampMs: 10289,
+ },
+ {
+ confidence: null,
+ startMs: 10399,
+ endMs: 10639,
+ text: ' some',
+ timestampMs: 10519,
+ },
+ {
+ confidence: null,
+ startMs: 10639,
+ endMs: 10780,
+ text: ' of',
+ timestampMs: 10709.5,
+ },
+ {
+ confidence: null,
+ startMs: 10780,
+ endMs: 10880,
+ text: ' the',
+ timestampMs: 10830,
+ },
+ {
+ confidence: null,
+ startMs: 10880,
+ endMs: 11199,
+ text: ' coolest',
+ timestampMs: 11039.5,
+ },
+ {
+ confidence: null,
+ startMs: 11199,
+ endMs: 11539,
+ text: ' parts.',
+ timestampMs: 11369,
+ },
+ {
+ confidence: null,
+ startMs: 11539,
+ endMs: 11739,
+ text: ' For',
+ timestampMs: 11639,
+ },
+ {
+ confidence: null,
+ startMs: 11739,
+ endMs: 11960,
+ text: ' this',
+ timestampMs: 11849.5,
+ },
+ {
+ confidence: null,
+ startMs: 11960,
+ endMs: 12339,
+ text: ' track,',
+ timestampMs: 12149.5,
+ },
+ {
+ confidence: null,
+ startMs: 12339,
+ endMs: 12439,
+ text: ' I',
+ timestampMs: 12389,
+ },
+ {
+ confidence: null,
+ startMs: 12439,
+ endMs: 12659,
+ text: ' took',
+ timestampMs: 12549,
+ },
+ {
+ confidence: null,
+ startMs: 12659,
+ endMs: 12739,
+ text: ' the',
+ timestampMs: 12699,
+ },
+ {
+ confidence: null,
+ startMs: 12739,
+ endMs: 13059,
+ text: ' music',
+ timestampMs: 12899,
+ },
+ {
+ confidence: null,
+ startMs: 13059,
+ endMs: 13420,
+ text: ' video',
+ timestampMs: 13239.5,
+ },
+ {
+ confidence: null,
+ startMs: 13420,
+ endMs: 13679,
+ text: ' and',
+ timestampMs: 13549.5,
+ },
+ {
+ confidence: null,
+ startMs: 13679,
+ endMs: 14279,
+ text: ' inserted',
+ timestampMs: 13979,
+ },
+ {
+ confidence: null,
+ startMs: 14279,
+ endMs: 14759,
+ text: ' animated',
+ timestampMs: 14519,
+ },
+ {
+ confidence: null,
+ startMs: 14759,
+ endMs: 15339,
+ text: ' captions',
+ timestampMs: 15049,
+ },
+ {
+ confidence: null,
+ startMs: 15339,
+ endMs: 15460,
+ text: ' in',
+ timestampMs: 15399.5,
+ },
+ {
+ confidence: null,
+ startMs: 15460,
+ endMs: 15779,
+ text: ' between',
+ timestampMs: 15619.5,
+ },
+ {
+ confidence: null,
+ startMs: 15779,
+ endMs: 15899,
+ text: ' the',
+ timestampMs: 15839,
+ },
+ {
+ confidence: null,
+ startMs: 15899,
+ endMs: 16439,
+ text: ' foreground',
+ timestampMs: 16169,
+ },
+ {
+ confidence: null,
+ startMs: 16439,
+ endMs: 16579,
+ text: ' and',
+ timestampMs: 16509,
+ },
+ {
+ confidence: null,
+ startMs: 16579,
+ endMs: 16720,
+ text: ' the',
+ timestampMs: 16649.5,
+ },
+ {
+ confidence: null,
+ startMs: 16720,
+ endMs: 17399,
+ text: ' background.',
+ timestampMs: 17059.5,
+ },
+ {
+ confidence: null,
+ startMs: 17399,
+ endMs: 17979,
+ text: ' How',
+ timestampMs: 17689,
+ },
+ {
+ confidence: null,
+ startMs: 17979,
+ endMs: 18139,
+ text: ' did',
+ timestampMs: 18059,
+ },
+ {
+ confidence: null,
+ startMs: 18139,
+ endMs: 18239,
+ text: ' I',
+ timestampMs: 18189,
+ },
+ {
+ confidence: null,
+ startMs: 18239,
+ endMs: 18440,
+ text: ' do',
+ timestampMs: 18339.5,
+ },
+ {
+ confidence: null,
+ startMs: 18440,
+ endMs: 18840,
+ text: ' this?',
+ timestampMs: 18640,
+ },
+ {
+ confidence: null,
+ startMs: 18840,
+ endMs: 19239,
+ text: ' I',
+ timestampMs: 19039.5,
+ },
+ {
+ confidence: null,
+ startMs: 19239,
+ endMs: 19520,
+ text: ' found',
+ timestampMs: 19379.5,
+ },
+ {
+ confidence: null,
+ startMs: 19520,
+ endMs: 19719,
+ text: ' this',
+ timestampMs: 19619.5,
+ },
+ {
+ confidence: null,
+ startMs: 19719,
+ endMs: 20699,
+ text: ' Text-behind-video',
+ timestampMs: 20209,
+ },
+ {
+ confidence: null,
+ startMs: 20699,
+ endMs: 20979,
+ text: ' demo',
+ timestampMs: 20839,
+ },
+ {
+ confidence: null,
+ startMs: 20979,
+ endMs: 21180,
+ text: ' from',
+ timestampMs: 21079.5,
+ },
+ {
+ confidence: null,
+ startMs: 21180,
+ endMs: 21539,
+ text: ' Hugging',
+ timestampMs: 21359.5,
+ },
+ {
+ confidence: null,
+ startMs: 21539,
+ endMs: 21879,
+ text: ' Face,',
+ timestampMs: 21709,
+ },
+ {
+ confidence: null,
+ startMs: 21879,
+ endMs: 22079,
+ text: ' which',
+ timestampMs: 21979,
+ },
+ {
+ confidence: null,
+ startMs: 22079,
+ endMs: 22459,
+ text: ' works',
+ timestampMs: 22269,
+ },
+ {
+ confidence: null,
+ startMs: 22459,
+ endMs: 23020,
+ text: ' completely',
+ timestampMs: 22739.5,
+ },
+ {
+ confidence: null,
+ startMs: 23020,
+ endMs: 23519,
+ text: ' locally',
+ timestampMs: 23269.5,
+ },
+ {
+ confidence: null,
+ startMs: 23519,
+ endMs: 23719,
+ text: ' and',
+ timestampMs: 23619,
+ },
+ {
+ confidence: null,
+ startMs: 23719,
+ endMs: 24199,
+ text: ' stacks',
+ timestampMs: 23959,
+ },
+ {
+ confidence: null,
+ startMs: 24199,
+ endMs: 24339,
+ text: ' a',
+ timestampMs: 24269,
+ },
+ {
+ confidence: null,
+ startMs: 24339,
+ endMs: 24699,
+ text: ' bunch',
+ timestampMs: 24519,
+ },
+ {
+ confidence: null,
+ startMs: 24699,
+ endMs: 24840,
+ text: ' of',
+ timestampMs: 24769.5,
+ },
+ {
+ confidence: null,
+ startMs: 24840,
+ endMs: 25379,
+ text: ' goated',
+ timestampMs: 25109.5,
+ },
+ {
+ confidence: null,
+ startMs: 25379,
+ endMs: 25920,
+ text: ' technologies',
+ timestampMs: 25649.5,
+ },
+ {
+ confidence: null,
+ startMs: 25920,
+ endMs: 26459,
+ text: ' together.',
+ timestampMs: 26189.5,
+ },
+ {
+ confidence: null,
+ startMs: 26459,
+ endMs: 26699,
+ text: ' The',
+ timestampMs: 26579,
+ },
+ {
+ confidence: null,
+ startMs: 26699,
+ endMs: 26979,
+ text: ' demo',
+ timestampMs: 26839,
+ },
+ {
+ confidence: null,
+ startMs: 26979,
+ endMs: 27399,
+ text: ' itself',
+ timestampMs: 27189,
+ },
+ {
+ confidence: null,
+ startMs: 27399,
+ endMs: 27539,
+ text: ' is',
+ timestampMs: 27469,
+ },
+ {
+ confidence: null,
+ startMs: 27539,
+ endMs: 27819,
+ text: ' quite',
+ timestampMs: 27679,
+ },
+ {
+ confidence: null,
+ startMs: 27819,
+ endMs: 28299,
+ text: ' limited,',
+ timestampMs: 28059,
+ },
+ {
+ confidence: null,
+ startMs: 28299,
+ endMs: 28500,
+ text: ' and',
+ timestampMs: 28399.5,
+ },
+ {
+ confidence: null,
+ startMs: 28500,
+ endMs: 28659,
+ text: ' we',
+ timestampMs: 28579.5,
+ },
+ {
+ confidence: null,
+ startMs: 28659,
+ endMs: 28939,
+ text: ' cannot',
+ timestampMs: 28799,
+ },
+ {
+ confidence: null,
+ startMs: 28939,
+ endMs: 29379,
+ text: ' insert',
+ timestampMs: 29159,
+ },
+ {
+ confidence: null,
+ startMs: 29379,
+ endMs: 29519,
+ text: ' an',
+ timestampMs: 29449,
+ },
+ {
+ confidence: null,
+ startMs: 29519,
+ endMs: 30039,
+ text: ' animated',
+ timestampMs: 29779,
+ },
+ {
+ confidence: null,
+ startMs: 30039,
+ endMs: 30319,
+ text: ' video',
+ timestampMs: 30179,
+ },
+ {
+ confidence: null,
+ startMs: 30319,
+ endMs: 30639,
+ text: ' layer.',
+ timestampMs: 30479,
+ },
+ {
+ confidence: null,
+ startMs: 30639,
+ endMs: 30920,
+ text: ' But',
+ timestampMs: 30779.5,
+ },
+ {
+ confidence: null,
+ startMs: 30920,
+ endMs: 31199,
+ text: ' since',
+ timestampMs: 31059.5,
+ },
+ {
+ confidence: null,
+ startMs: 31199,
+ endMs: 31359,
+ text: ' this',
+ timestampMs: 31279,
+ },
+ {
+ confidence: null,
+ startMs: 31359,
+ endMs: 31739,
+ text: ' beauty',
+ timestampMs: 31549,
+ },
+ {
+ confidence: null,
+ startMs: 31739,
+ endMs: 31919,
+ text: ' is',
+ timestampMs: 31829,
+ },
+ {
+ confidence: null,
+ startMs: 31919,
+ endMs: 32299,
+ text: ' open',
+ timestampMs: 32109,
+ },
+ {
+ confidence: null,
+ startMs: 32299,
+ endMs: 32659,
+ text: ' source,',
+ timestampMs: 32479,
+ },
+ {
+ confidence: null,
+ startMs: 32659,
+ endMs: 32880,
+ text: ' that',
+ timestampMs: 32769.5,
+ },
+ {
+ confidence: null,
+ startMs: 32880,
+ endMs: 33040,
+ text: ' is',
+ timestampMs: 32960,
+ },
+ {
+ confidence: null,
+ startMs: 33040,
+ endMs: 33239,
+ text: ' no',
+ timestampMs: 33139.5,
+ },
+ {
+ confidence: null,
+ startMs: 33239,
+ endMs: 33559,
+ text: ' problem',
+ timestampMs: 33399,
+ },
+ {
+ confidence: null,
+ startMs: 33559,
+ endMs: 33759,
+ text: ' for',
+ timestampMs: 33659,
+ },
+ {
+ confidence: null,
+ startMs: 33759,
+ endMs: 33939,
+ text: ' my',
+ timestampMs: 33849,
+ },
+ {
+ confidence: null,
+ startMs: 33939,
+ endMs: 34380,
+ text: ' agents,',
+ timestampMs: 34159.5,
+ },
+ {
+ confidence: null,
+ startMs: 34380,
+ endMs: 34599,
+ text: ' which',
+ timestampMs: 34489.5,
+ },
+ {
+ confidence: null,
+ startMs: 34599,
+ endMs: 35020,
+ text: ' forked',
+ timestampMs: 34809.5,
+ },
+ {
+ confidence: null,
+ startMs: 35020,
+ endMs: 35139,
+ text: ' the',
+ timestampMs: 35079.5,
+ },
+ {
+ confidence: null,
+ startMs: 35139,
+ endMs: 35639,
+ text: ' project',
+ timestampMs: 35389,
+ },
+ {
+ confidence: null,
+ startMs: 35639,
+ endMs: 35880,
+ text: ' and',
+ timestampMs: 35759.5,
+ },
+ {
+ confidence: null,
+ startMs: 35880,
+ endMs: 36079,
+ text: ' made',
+ timestampMs: 35979.5,
+ },
+ {
+ confidence: null,
+ startMs: 36079,
+ endMs: 36219,
+ text: ' a',
+ timestampMs: 36149,
+ },
+ {
+ confidence: null,
+ startMs: 36219,
+ endMs: 36540,
+ text: ' custom',
+ timestampMs: 36379.5,
+ },
+ {
+ confidence: null,
+ startMs: 36540,
+ endMs: 36939,
+ text: ' version',
+ timestampMs: 36739.5,
+ },
+ {
+ confidence: null,
+ startMs: 36939,
+ endMs: 37439,
+ text: ' that',
+ timestampMs: 37189,
+ },
+ {
+ confidence: null,
+ startMs: 37439,
+ endMs: 37979,
+ text: ' exports',
+ timestampMs: 37709,
+ },
+ {
+ confidence: null,
+ startMs: 37979,
+ endMs: 38540,
+ text: ' foreground',
+ timestampMs: 38259.5,
+ },
+ {
+ confidence: null,
+ startMs: 38540,
+ endMs: 38739,
+ text: ' and',
+ timestampMs: 38639.5,
+ },
+ {
+ confidence: null,
+ startMs: 38739,
+ endMs: 39559,
+ text: ' background',
+ timestampMs: 39149,
+ },
+ {
+ confidence: null,
+ startMs: 39559,
+ endMs: 39739,
+ text: ' as',
+ timestampMs: 39649,
+ },
+ {
+ confidence: null,
+ startMs: 39739,
+ endMs: 40299,
+ text: ' transparent',
+ timestampMs: 40019,
+ },
+ {
+ confidence: null,
+ startMs: 40299,
+ endMs: 40739,
+ text: ' layers',
+ timestampMs: 40519,
+ },
+ {
+ confidence: null,
+ startMs: 40739,
+ endMs: 41060,
+ text: ' using',
+ timestampMs: 40899.5,
+ },
+ {
+ confidence: null,
+ startMs: 41060,
+ endMs: 41799,
+ text: ' Mediabunny.',
+ timestampMs: 41429.5,
+ },
+ {
+ confidence: null,
+ startMs: 41799,
+ endMs: 42040,
+ text: ' Now',
+ timestampMs: 41919.5,
+ },
+ {
+ confidence: null,
+ startMs: 42040,
+ endMs: 42200,
+ text: ' I',
+ timestampMs: 42120,
+ },
+ {
+ confidence: null,
+ startMs: 42200,
+ endMs: 42340,
+ text: ' can',
+ timestampMs: 42270,
+ },
+ {
+ confidence: null,
+ startMs: 42340,
+ endMs: 42619,
+ text: ' drag',
+ timestampMs: 42479.5,
+ },
+ {
+ confidence: null,
+ startMs: 42619,
+ endMs: 42919,
+ text: ' both',
+ timestampMs: 42769,
+ },
+ {
+ confidence: null,
+ startMs: 42919,
+ endMs: 43319,
+ text: ' videos',
+ timestampMs: 43119,
+ },
+ {
+ confidence: null,
+ startMs: 43319,
+ endMs: 43540,
+ text: ' into',
+ timestampMs: 43429.5,
+ },
+ {
+ confidence: null,
+ startMs: 43540,
+ endMs: 44099,
+ text: ' Remotion',
+ timestampMs: 43819.5,
+ },
+ {
+ confidence: null,
+ startMs: 44099,
+ endMs: 44239,
+ text: ' and',
+ timestampMs: 44169,
+ },
+ {
+ confidence: null,
+ startMs: 44239,
+ endMs: 44439,
+ text: ' put',
+ timestampMs: 44339,
+ },
+ {
+ confidence: null,
+ startMs: 44439,
+ endMs: 44619,
+ text: ' an',
+ timestampMs: 44529,
+ },
+ {
+ confidence: null,
+ startMs: 44619,
+ endMs: 45139,
+ text: ' HTML',
+ timestampMs: 44879,
+ },
+ {
+ confidence: null,
+ startMs: 45139,
+ endMs: 45419,
+ text: ' layer',
+ timestampMs: 45279,
+ },
+ {
+ confidence: null,
+ startMs: 45419,
+ endMs: 45579,
+ text: ' in',
+ timestampMs: 45499,
+ },
+ {
+ confidence: null,
+ startMs: 45579,
+ endMs: 45919,
+ text: ' between',
+ timestampMs: 45749,
+ },
+ {
+ confidence: null,
+ startMs: 45919,
+ endMs: 46200,
+ text: ' using',
+ timestampMs: 46059.5,
+ },
+ {
+ confidence: null,
+ startMs: 46200,
+ endMs: 46539,
+ text: ' another',
+ timestampMs: 46369.5,
+ },
+ {
+ confidence: null,
+ startMs: 46539,
+ endMs: 47199,
+ text: ' agent',
+ timestampMs: 46869,
+ },
+ {
+ confidence: null,
+ startMs: 47199,
+ endMs: 47439,
+ text: ' or',
+ timestampMs: 47319,
+ },
+ {
+ confidence: null,
+ startMs: 47439,
+ endMs: 47579,
+ text: ' do',
+ timestampMs: 47509,
+ },
+ {
+ confidence: null,
+ startMs: 47579,
+ endMs: 47739,
+ text: ' it',
+ timestampMs: 47659,
+ },
+ {
+ confidence: null,
+ startMs: 47739,
+ endMs: 47959,
+ text: ' old',
+ timestampMs: 47849,
+ },
+ {
+ confidence: null,
+ startMs: 47959,
+ endMs: 48239,
+ text: ' school',
+ timestampMs: 48099,
+ },
+ {
+ confidence: null,
+ startMs: 48239,
+ endMs: 48439,
+ text: ' by',
+ timestampMs: 48339,
+ },
+ {
+ confidence: null,
+ startMs: 48439,
+ endMs: 48739,
+ text: ' going',
+ timestampMs: 48589,
+ },
+ {
+ confidence: null,
+ startMs: 48739,
+ endMs: 48959,
+ text: ' into',
+ timestampMs: 48849,
+ },
+ {
+ confidence: null,
+ startMs: 48959,
+ endMs: 49059,
+ text: ' the',
+ timestampMs: 49009,
+ },
+ {
+ confidence: null,
+ startMs: 49059,
+ endMs: 49459,
+ text: ' code.',
+ timestampMs: 49259,
+ },
+ {
+ confidence: null,
+ startMs: 49459,
+ endMs: 49899,
+ text: ' The',
+ timestampMs: 49679,
+ },
+ {
+ confidence: null,
+ startMs: 49899,
+ endMs: 50299,
+ text: ' result,',
+ timestampMs: 50099,
+ },
+ {
+ confidence: null,
+ startMs: 50299,
+ endMs: 50419,
+ text: ' in',
+ timestampMs: 50359,
+ },
+ {
+ confidence: null,
+ startMs: 50419,
+ endMs: 50539,
+ text: ' my',
+ timestampMs: 50479,
+ },
+ {
+ confidence: null,
+ startMs: 50539,
+ endMs: 51139,
+ text: ' opinion,',
+ timestampMs: 50839,
+ },
+ {
+ confidence: null,
+ startMs: 51139,
+ endMs: 51299,
+ text: ' is',
+ timestampMs: 51219,
+ },
+ {
+ confidence: null,
+ startMs: 51299,
+ endMs: 51599,
+ text: ' super',
+ timestampMs: 51449,
+ },
+ {
+ confidence: null,
+ startMs: 51599,
+ endMs: 51860,
+ text: ' fresh.',
+ timestampMs: 51729.5,
+ },
+ ]}
+ captionsSrc={null}
voiceoverSrc={asset(VOICEOVER_FILE)}
/>
);
diff --git a/packages/jonnys-videos/src/disco-light-show/AnimatedCaptionsBigWords.tsx b/packages/jonnys-videos/src/disco-light-show/AnimatedCaptionsBigWords.tsx
index c707cfec03..29fb3955b3 100644
--- a/packages/jonnys-videos/src/disco-light-show/AnimatedCaptionsBigWords.tsx
+++ b/packages/jonnys-videos/src/disco-light-show/AnimatedCaptionsBigWords.tsx
@@ -144,6 +144,7 @@ export const AnimatedCaptionsBigWords: React.FC = () => {
return createSentenceAwareCaptionPages({
captions,
combineTokensWithinMilliseconds: SWITCH_CAPTIONS_EVERY_MS,
+ layout: null,
});
}, [captions]);
diff --git a/packages/jonnys-videos/src/how-can-remotion-be-free/HowCanRemotionBeFree.tsx b/packages/jonnys-videos/src/how-can-remotion-be-free/HowCanRemotionBeFree.tsx
index ae6b0c056e..ded74de504 100644
--- a/packages/jonnys-videos/src/how-can-remotion-be-free/HowCanRemotionBeFree.tsx
+++ b/packages/jonnys-videos/src/how-can-remotion-be-free/HowCanRemotionBeFree.tsx
@@ -21,7 +21,6 @@ import {
import {ZURICH_PHOTO_DURATION_IN_FRAMES, ZurichPhoto} from './ZurichPhoto';
const HOW_CAN_REMOTION_BE_FREE_AUDIO_FILE = 'voiceover-2.mp3';
-const HOW_CAN_REMOTION_BE_FREE_CAPTIONS_FILE = 'captions-2.json';
const PREMIUM_VERSION_START_FRAME = 99;
const UNRULY_OUTCOME_START_FRAME = 134;
const FIRST_CUSTOMER_CHART_START_FRAME = 649;
@@ -84,7 +83,1402 @@ export const HowCanRemotionBeFree: React.FC = () => {
}}
>
<AnimatedCaptions
- captionsSrc={asset(HOW_CAN_REMOTION_BE_FREE_CAPTIONS_FILE)}
+ captions={[
+ {
+ text: 'How',
+ startMs: 30,
+ endMs: 190,
+ timestampMs: 180,
+ confidence: 0.880476,
+ },
+ {
+ text: ' is',
+ startMs: 190,
+ endMs: 360,
+ timestampMs: 380,
+ confidence: 0.988433,
+ },
+ {
+ text: ' it',
+ startMs: 360,
+ endMs: 430,
+ timestampMs: 520,
+ confidence: 0.996489,
+ },
+ {
+ text: ' possible',
+ startMs: 430,
+ endMs: 940,
+ timestampMs: 900,
+ confidence: 0.999329,
+ },
+ {
+ text: ' that',
+ startMs: 940,
+ endMs: 1190,
+ timestampMs: 1220,
+ confidence: 0.986024,
+ },
+ {
+ text: ' Remotion',
+ startMs: 1190,
+ endMs: 1700,
+ timestampMs: 1400,
+ confidence: 0.452537,
+ },
+ {
+ text: ' is',
+ startMs: 1700,
+ endMs: 1810,
+ timestampMs: 1840,
+ confidence: 0.9972,
+ },
+ {
+ text: ' free?',
+ startMs: 1810,
+ endMs: 2320,
+ timestampMs: 2100,
+ confidence: 0.946539,
+ },
+ {
+ text: ' Will',
+ startMs: 2320,
+ endMs: 2560,
+ timestampMs: 2460,
+ confidence: 0.99412,
+ },
+ {
+ text: ' there',
+ startMs: 2560,
+ endMs: 2860,
+ timestampMs: 2600,
+ confidence: 0.993002,
+ },
+ {
+ text: ' be',
+ startMs: 2860,
+ endMs: 2980,
+ timestampMs: 2840,
+ confidence: 0.986816,
+ },
+ {
+ text: ' ads,',
+ startMs: 2980,
+ endMs: 3310,
+ timestampMs: 3120,
+ confidence: 0.7704,
+ },
+ {
+ text: ' a',
+ startMs: 3310,
+ endMs: 3370,
+ timestampMs: 3540,
+ confidence: 0.975348,
+ },
+ {
+ text: ' premium',
+ startMs: 3370,
+ endMs: 3920,
+ timestampMs: 3760,
+ confidence: 0.984281,
+ },
+ {
+ text: ' version,',
+ startMs: 3920,
+ endMs: 4480,
+ timestampMs: 4180,
+ confidence: 0.581978,
+ },
+ {
+ text: ' or',
+ startMs: 4480,
+ endMs: 4590,
+ timestampMs: 4620,
+ confidence: 0.998814,
+ },
+ {
+ text: ' are',
+ startMs: 4590,
+ endMs: 4760,
+ timestampMs: 4860,
+ confidence: 0.998144,
+ },
+ {
+ text: ' we',
+ startMs: 4760,
+ endMs: 4870,
+ timestampMs: 5000,
+ confidence: 0.996786,
+ },
+ {
+ text: ' steering',
+ startMs: 4870,
+ endMs: 5350,
+ timestampMs: 5240,
+ confidence: 0.980984,
+ },
+ {
+ text: ' towards',
+ startMs: 5350,
+ endMs: 5730,
+ timestampMs: 5560,
+ confidence: 0.992877,
+ },
+ {
+ text: ' an',
+ startMs: 5730,
+ endMs: 5840,
+ timestampMs: 5780,
+ confidence: 0.994514,
+ },
+ {
+ text: ' unruly',
+ startMs: 5840,
+ endMs: 6180,
+ timestampMs: 5980,
+ confidence: 0.993566,
+ },
+ {
+ text: ' outcome?',
+ startMs: 6180,
+ endMs: 6800,
+ timestampMs: 6580,
+ confidence: 0.986248,
+ },
+ {
+ text: ' Well,',
+ startMs: 6800,
+ endMs: 7120,
+ timestampMs: 6980,
+ confidence: 0.76367,
+ },
+ {
+ text: ' actually,',
+ startMs: 7120,
+ endMs: 7680,
+ timestampMs: 7440,
+ confidence: 0.774864,
+ },
+ {
+ text: ' Remotion',
+ startMs: 7680,
+ endMs: 8220,
+ timestampMs: 8000,
+ confidence: 0.900556,
+ },
+ {
+ text: ' is',
+ startMs: 8220,
+ endMs: 8380,
+ timestampMs: 8420,
+ confidence: 0.998753,
+ },
+ {
+ text: ' not',
+ startMs: 8380,
+ endMs: 8550,
+ timestampMs: 8620,
+ confidence: 0.998738,
+ },
+ {
+ text: ' always',
+ startMs: 8550,
+ endMs: 8960,
+ timestampMs: 9000,
+ confidence: 0.9996,
+ },
+ {
+ text: ' free.',
+ startMs: 8960,
+ endMs: 9480,
+ timestampMs: 9340,
+ confidence: 0.985237,
+ },
+ {
+ text: ' If',
+ startMs: 9480,
+ endMs: 9640,
+ timestampMs: 9620,
+ confidence: 0.997014,
+ },
+ {
+ text: ' you',
+ startMs: 9640,
+ endMs: 9810,
+ timestampMs: 9760,
+ confidence: 0.999436,
+ },
+ {
+ text: ' work',
+ startMs: 9810,
+ endMs: 10070,
+ timestampMs: 9980,
+ confidence: 0.996957,
+ },
+ {
+ text: ' at',
+ startMs: 10070,
+ endMs: 10200,
+ timestampMs: 10160,
+ confidence: 0.99571,
+ },
+ {
+ text: ' a',
+ startMs: 10200,
+ endMs: 10260,
+ timestampMs: 10340,
+ confidence: 0.991242,
+ },
+ {
+ text: ' company',
+ startMs: 10260,
+ endMs: 10760,
+ timestampMs: 10680,
+ confidence: 0.999542,
+ },
+ {
+ text: ' where',
+ startMs: 10760,
+ endMs: 10920,
+ timestampMs: 10900,
+ confidence: 0.475685,
+ },
+ {
+ text: ' at',
+ startMs: 10920,
+ endMs: 11040,
+ timestampMs: 11080,
+ confidence: 0.86534,
+ },
+ {
+ text: ' least',
+ startMs: 11040,
+ endMs: 11440,
+ timestampMs: 11240,
+ confidence: 0.998388,
+ },
+ {
+ text: ' three',
+ startMs: 11440,
+ endMs: 11600,
+ timestampMs: 11560,
+ confidence: 0.539614,
+ },
+ {
+ text: ' other',
+ startMs: 11600,
+ endMs: 11900,
+ timestampMs: 11820,
+ confidence: 0.773454,
+ },
+ {
+ text: ' people',
+ startMs: 11900,
+ endMs: 12180,
+ timestampMs: 12100,
+ confidence: 0.871072,
+ },
+ {
+ text: ' work,',
+ startMs: 12180,
+ endMs: 12580,
+ timestampMs: 12420,
+ confidence: 0.90639,
+ },
+ {
+ text: ' you',
+ startMs: 12580,
+ endMs: 12780,
+ timestampMs: 12700,
+ confidence: 0.996333,
+ },
+ {
+ text: ' need',
+ startMs: 12780,
+ endMs: 13070,
+ timestampMs: 12880,
+ confidence: 0.988704,
+ },
+ {
+ text: ' a',
+ startMs: 13070,
+ endMs: 13120,
+ timestampMs: 13140,
+ confidence: 0.996675,
+ },
+ {
+ text: ' company',
+ startMs: 13120,
+ endMs: 13600,
+ timestampMs: 13440,
+ confidence: 0.99843,
+ },
+ {
+ text: ' license',
+ startMs: 13600,
+ endMs: 14080,
+ timestampMs: 13800,
+ confidence: 0.985306,
+ },
+ {
+ text: ' to',
+ startMs: 14080,
+ endMs: 14210,
+ timestampMs: 14120,
+ confidence: 0.995232,
+ },
+ {
+ text: ' use',
+ startMs: 14210,
+ endMs: 14410,
+ timestampMs: 14320,
+ confidence: 0.999192,
+ },
+ {
+ text: ' Remotion.',
+ startMs: 14410,
+ endMs: 15240,
+ timestampMs: 14620,
+ confidence: 0.918254,
+ },
+ {
+ text: ' Since',
+ startMs: 15240,
+ endMs: 15570,
+ timestampMs: 15520,
+ confidence: 0.999039,
+ },
+ {
+ text: ' day',
+ startMs: 15570,
+ endMs: 15720,
+ timestampMs: 15700,
+ confidence: 0.972233,
+ },
+ {
+ text: ' one,',
+ startMs: 15720,
+ endMs: 16020,
+ timestampMs: 15920,
+ confidence: 0.916864,
+ },
+ {
+ text: ' this',
+ startMs: 16020,
+ endMs: 16260,
+ timestampMs: 16120,
+ confidence: 0.993085,
+ },
+ {
+ text: ' is',
+ startMs: 16260,
+ endMs: 16380,
+ timestampMs: 16240,
+ confidence: 0.99768,
+ },
+ {
+ text: ' our',
+ startMs: 16380,
+ endMs: 16580,
+ timestampMs: 16520,
+ confidence: 0.999253,
+ },
+ {
+ text: ' business',
+ startMs: 16580,
+ endMs: 17040,
+ timestampMs: 16840,
+ confidence: 0.999207,
+ },
+ {
+ text: ' model,',
+ startMs: 17040,
+ endMs: 17360,
+ timestampMs: 17240,
+ confidence: 0.835903,
+ },
+ {
+ text: ' but',
+ startMs: 17360,
+ endMs: 17550,
+ timestampMs: 17500,
+ confidence: 0.99971,
+ },
+ {
+ text: ' it',
+ startMs: 17550,
+ endMs: 17670,
+ timestampMs: 17640,
+ confidence: 0.999363,
+ },
+ {
+ text: " wasn't",
+ startMs: 17670,
+ endMs: 18040,
+ timestampMs: 17880,
+ confidence: 0.999085,
+ },
+ {
+ text: ' a',
+ startMs: 18040,
+ endMs: 18120,
+ timestampMs: 18100,
+ confidence: 0.998662,
+ },
+ {
+ text: ' success',
+ startMs: 18120,
+ endMs: 18570,
+ timestampMs: 18440,
+ confidence: 0.999622,
+ },
+ {
+ text: ' from',
+ startMs: 18570,
+ endMs: 18800,
+ timestampMs: 18700,
+ confidence: 0.998083,
+ },
+ {
+ text: ' the',
+ startMs: 18800,
+ endMs: 18990,
+ timestampMs: 18880,
+ confidence: 0.99942,
+ },
+ {
+ text: ' start.',
+ startMs: 18990,
+ endMs: 19560,
+ timestampMs: 19260,
+ confidence: 0.995592,
+ },
+ {
+ text: ' After',
+ startMs: 19560,
+ endMs: 19870,
+ timestampMs: 19880,
+ confidence: 0.999306,
+ },
+ {
+ text: ' a',
+ startMs: 19870,
+ endMs: 19930,
+ timestampMs: 20120,
+ confidence: 0.99459,
+ },
+ {
+ text: ' viral',
+ startMs: 19930,
+ endMs: 20240,
+ timestampMs: 20380,
+ confidence: 0.996575,
+ },
+ {
+ text: ' launch',
+ startMs: 20240,
+ endMs: 20610,
+ timestampMs: 20700,
+ confidence: 0.997067,
+ },
+ {
+ text: ' in',
+ startMs: 20610,
+ endMs: 20730,
+ timestampMs: 20880,
+ confidence: 0.996854,
+ },
+ {
+ text: ' 2021,',
+ startMs: 20730,
+ endMs: 21640,
+ timestampMs: 21520,
+ confidence: 0.963512,
+ },
+ {
+ text: ' it',
+ startMs: 21640,
+ endMs: 21770,
+ timestampMs: 21780,
+ confidence: 0.521922,
+ },
+ {
+ text: ' took',
+ startMs: 21770,
+ endMs: 21980,
+ timestampMs: 21900,
+ confidence: 0.999512,
+ },
+ {
+ text: ' us',
+ startMs: 21980,
+ endMs: 22180,
+ timestampMs: 22120,
+ confidence: 0.997299,
+ },
+ {
+ text: ' four',
+ startMs: 22180,
+ endMs: 22320,
+ timestampMs: 22360,
+ confidence: 0.983967,
+ },
+ {
+ text: ' months',
+ startMs: 22320,
+ endMs: 22680,
+ timestampMs: 22600,
+ confidence: 0.998677,
+ },
+ {
+ text: ' to',
+ startMs: 22680,
+ endMs: 22850,
+ timestampMs: 22840,
+ confidence: 0.999878,
+ },
+ {
+ text: ' find',
+ startMs: 22850,
+ endMs: 23120,
+ timestampMs: 23000,
+ confidence: 0.984583,
+ },
+ {
+ text: ' the',
+ startMs: 23120,
+ endMs: 23260,
+ timestampMs: 23240,
+ confidence: 0.995828,
+ },
+ {
+ text: ' first',
+ startMs: 23260,
+ endMs: 23620,
+ timestampMs: 23520,
+ confidence: 0.999192,
+ },
+ {
+ text: ' customer',
+ startMs: 23620,
+ endMs: 24150,
+ timestampMs: 23980,
+ confidence: 0.997919,
+ },
+ {
+ text: ' for,',
+ startMs: 24150,
+ endMs: 24840,
+ timestampMs: 24420,
+ confidence: 0.957788,
+ },
+ {
+ text: ' I',
+ startMs: 24840,
+ endMs: 24920,
+ timestampMs: 25000,
+ confidence: 0.999638,
+ },
+ {
+ text: ' kid',
+ startMs: 24920,
+ endMs: 25170,
+ timestampMs: 25200,
+ confidence: 0.99682,
+ },
+ {
+ text: ' you',
+ startMs: 25170,
+ endMs: 25420,
+ timestampMs: 25360,
+ confidence: 0.997577,
+ },
+ {
+ text: ' not,',
+ startMs: 25420,
+ endMs: 25920,
+ timestampMs: 25640,
+ confidence: 0.978566,
+ },
+ {
+ text: ' $15',
+ startMs: 25920,
+ endMs: 26450,
+ timestampMs: 26240,
+ confidence: 0.982326,
+ },
+ {
+ text: ' per',
+ startMs: 26450,
+ endMs: 26700,
+ timestampMs: 26800,
+ confidence: 0.989987,
+ },
+ {
+ text: ' month.',
+ startMs: 26700,
+ endMs: 27440,
+ timestampMs: 27120,
+ confidence: 0.993347,
+ },
+ {
+ text: ' That',
+ startMs: 27440,
+ endMs: 27640,
+ timestampMs: 27620,
+ confidence: 0.993669,
+ },
+ {
+ text: ' is',
+ startMs: 27640,
+ endMs: 27770,
+ timestampMs: 27760,
+ confidence: 0.998228,
+ },
+ {
+ text: ' not',
+ startMs: 27770,
+ endMs: 27890,
+ timestampMs: 27900,
+ confidence: 0.998612,
+ },
+ {
+ text: ' enough',
+ startMs: 27890,
+ endMs: 28190,
+ timestampMs: 28100,
+ confidence: 0.999611,
+ },
+ {
+ text: ' to',
+ startMs: 28190,
+ endMs: 28290,
+ timestampMs: 28260,
+ confidence: 0.999241,
+ },
+ {
+ text: ' make',
+ startMs: 28290,
+ endMs: 28490,
+ timestampMs: 28400,
+ confidence: 0.999603,
+ },
+ {
+ text: ' a',
+ startMs: 28490,
+ endMs: 28540,
+ timestampMs: 28580,
+ confidence: 0.998658,
+ },
+ {
+ text: ' living',
+ startMs: 28540,
+ endMs: 28860,
+ timestampMs: 28800,
+ confidence: 0.999924,
+ },
+ {
+ text: ' in',
+ startMs: 28860,
+ endMs: 29000,
+ timestampMs: 29000,
+ confidence: 0.986327,
+ },
+ {
+ text: ' Switzerland,',
+ startMs: 29000,
+ endMs: 29520,
+ timestampMs: 29340,
+ confidence: 0.713177,
+ },
+ {
+ text: ' but',
+ startMs: 29540,
+ endMs: 29740,
+ timestampMs: 29660,
+ confidence: 0.999626,
+ },
+ {
+ text: " didn't",
+ startMs: 29740,
+ endMs: 30000,
+ timestampMs: 29900,
+ confidence: 0.848825,
+ },
+ {
+ text: ' stop',
+ startMs: 30000,
+ endMs: 30170,
+ timestampMs: 30140,
+ confidence: 0.996816,
+ },
+ {
+ text: ' us',
+ startMs: 30170,
+ endMs: 30350,
+ timestampMs: 30320,
+ confidence: 0.999157,
+ },
+ {
+ text: ' from',
+ startMs: 30350,
+ endMs: 30470,
+ timestampMs: 30500,
+ confidence: 0.993252,
+ },
+ {
+ text: ' spending',
+ startMs: 30470,
+ endMs: 30880,
+ timestampMs: 30820,
+ confidence: 0.997834,
+ },
+ {
+ text: ' the',
+ startMs: 30880,
+ endMs: 31050,
+ timestampMs: 31060,
+ confidence: 0.919181,
+ },
+ {
+ text: ' next',
+ startMs: 31050,
+ endMs: 31340,
+ timestampMs: 31280,
+ confidence: 0.999028,
+ },
+ {
+ text: ' four',
+ startMs: 31340,
+ endMs: 31510,
+ timestampMs: 31520,
+ confidence: 0.992447,
+ },
+ {
+ text: ' years',
+ startMs: 31510,
+ endMs: 31820,
+ timestampMs: 31800,
+ confidence: 0.997343,
+ },
+ {
+ text: ' continuing',
+ startMs: 31820,
+ endMs: 32370,
+ timestampMs: 32320,
+ confidence: 0.999619,
+ },
+ {
+ text: ' and',
+ startMs: 32370,
+ endMs: 32530,
+ timestampMs: 32600,
+ confidence: 0.995163,
+ },
+ {
+ text: ' making',
+ startMs: 32530,
+ endMs: 32860,
+ timestampMs: 32840,
+ confidence: 0.999573,
+ },
+ {
+ text: ' every',
+ startMs: 32860,
+ endMs: 33190,
+ timestampMs: 33160,
+ confidence: 0.998772,
+ },
+ {
+ text: ' possible',
+ startMs: 33190,
+ endMs: 33570,
+ timestampMs: 33500,
+ confidence: 0.999741,
+ },
+ {
+ text: ' mistake',
+ startMs: 33570,
+ endMs: 34000,
+ timestampMs: 33900,
+ confidence: 0.998418,
+ },
+ {
+ text: ' along',
+ startMs: 34000,
+ endMs: 34390,
+ timestampMs: 34180,
+ confidence: 0.914915,
+ },
+ {
+ text: ' the',
+ startMs: 34390,
+ endMs: 34820,
+ timestampMs: 34360,
+ confidence: 0.998963,
+ },
+ {
+ text: ' way,',
+ startMs: 34820,
+ endMs: 34880,
+ timestampMs: 34820,
+ confidence: 0.899858,
+ },
+ {
+ text: ' but',
+ startMs: 34880,
+ endMs: 35040,
+ timestampMs: 35040,
+ confidence: 0.999474,
+ },
+ {
+ text: ' also',
+ startMs: 35040,
+ endMs: 35270,
+ timestampMs: 35320,
+ confidence: 0.996706,
+ },
+ {
+ text: ' really',
+ startMs: 35270,
+ endMs: 35570,
+ timestampMs: 35600,
+ confidence: 0.983449,
+ },
+ {
+ text: ' having',
+ startMs: 35570,
+ endMs: 35920,
+ timestampMs: 35840,
+ confidence: 0.998635,
+ },
+ {
+ text: ' the',
+ startMs: 35920,
+ endMs: 36120,
+ timestampMs: 36120,
+ confidence: 0.984587,
+ },
+ {
+ text: ' best',
+ startMs: 36120,
+ endMs: 36380,
+ timestampMs: 36340,
+ confidence: 0.999703,
+ },
+ {
+ text: ' time',
+ startMs: 36380,
+ endMs: 36660,
+ timestampMs: 36600,
+ confidence: 0.996576,
+ },
+ {
+ text: ' figuring',
+ startMs: 36660,
+ endMs: 37350,
+ timestampMs: 36980,
+ confidence: 0.999584,
+ },
+ {
+ text: ' out',
+ startMs: 37350,
+ endMs: 37500,
+ timestampMs: 37280,
+ confidence: 0.998982,
+ },
+ {
+ text: ' who',
+ startMs: 37500,
+ endMs: 37720,
+ timestampMs: 37440,
+ confidence: 0.999325,
+ },
+ {
+ text: ' we',
+ startMs: 37720,
+ endMs: 38060,
+ timestampMs: 37620,
+ confidence: 0.999577,
+ },
+ {
+ text: ' are.',
+ startMs: 38060,
+ endMs: 38120,
+ timestampMs: 38060,
+ confidence: 0.349426,
+ },
+ {
+ text: ' Until',
+ startMs: 38120,
+ endMs: 38510,
+ timestampMs: 38400,
+ confidence: 0.998449,
+ },
+ {
+ text: ' finally,',
+ startMs: 38510,
+ endMs: 39210,
+ timestampMs: 38860,
+ confidence: 0.735326,
+ },
+ {
+ text: ' we',
+ startMs: 39210,
+ endMs: 39360,
+ timestampMs: 39320,
+ confidence: 0.996227,
+ },
+ {
+ text: ' became',
+ startMs: 39360,
+ endMs: 39830,
+ timestampMs: 39660,
+ confidence: 0.993851,
+ },
+ {
+ text: ' profitable',
+ startMs: 39830,
+ endMs: 40620,
+ timestampMs: 40160,
+ confidence: 0.99963,
+ },
+ {
+ text: ' in',
+ startMs: 40620,
+ endMs: 40770,
+ timestampMs: 40480,
+ confidence: 0.999077,
+ },
+ {
+ text: ' 2025.',
+ startMs: 40770,
+ endMs: 41760,
+ timestampMs: 41260,
+ confidence: 0.62037,
+ },
+ {
+ text: ' Which',
+ startMs: 41760,
+ endMs: 42070,
+ timestampMs: 41940,
+ confidence: 0.993191,
+ },
+ {
+ text: ' leads',
+ startMs: 42070,
+ endMs: 42450,
+ timestampMs: 42200,
+ confidence: 0.999001,
+ },
+ {
+ text: ' us',
+ startMs: 42450,
+ endMs: 42500,
+ timestampMs: 42380,
+ confidence: 0.997889,
+ },
+ {
+ text: ' to',
+ startMs: 42500,
+ endMs: 42620,
+ timestampMs: 42540,
+ confidence: 0.998868,
+ },
+ {
+ text: ' today,',
+ startMs: 42620,
+ endMs: 43010,
+ timestampMs: 42880,
+ confidence: 0.542888,
+ },
+ {
+ text: ' where',
+ startMs: 43010,
+ endMs: 43200,
+ timestampMs: 43120,
+ confidence: 0.715989,
+ },
+ {
+ text: ' we',
+ startMs: 43200,
+ endMs: 43270,
+ timestampMs: 43260,
+ confidence: 0.997642,
+ },
+ {
+ text: ' have',
+ startMs: 43270,
+ endMs: 43440,
+ timestampMs: 43400,
+ confidence: 0.99862,
+ },
+ {
+ text: ' an',
+ startMs: 43440,
+ endMs: 43550,
+ timestampMs: 43560,
+ confidence: 0.964369,
+ },
+ {
+ text: ' office',
+ startMs: 43550,
+ endMs: 43880,
+ timestampMs: 43780,
+ confidence: 0.999535,
+ },
+ {
+ text: ' in',
+ startMs: 43880,
+ endMs: 44000,
+ timestampMs: 44020,
+ confidence: 0.998159,
+ },
+ {
+ text: ' this',
+ startMs: 44000,
+ endMs: 44210,
+ timestampMs: 44180,
+ confidence: 0.996778,
+ },
+ {
+ text: ' tower',
+ startMs: 44210,
+ endMs: 44490,
+ timestampMs: 44420,
+ confidence: 0.977051,
+ },
+ {
+ text: ' in',
+ startMs: 44490,
+ endMs: 44680,
+ timestampMs: 44660,
+ confidence: 0.989659,
+ },
+ {
+ text: ' Zurich',
+ startMs: 44680,
+ endMs: 44960,
+ timestampMs: 44860,
+ confidence: 0.998786,
+ },
+ {
+ text: ' and',
+ startMs: 44960,
+ endMs: 45150,
+ timestampMs: 45100,
+ confidence: 0.409552,
+ },
+ {
+ text: ' over',
+ startMs: 45150,
+ endMs: 45450,
+ timestampMs: 45360,
+ confidence: 0.990694,
+ },
+ {
+ text: ' 400',
+ startMs: 45450,
+ endMs: 45970,
+ timestampMs: 45940,
+ confidence: 0.99612,
+ },
+ {
+ text: ' companies',
+ startMs: 45970,
+ endMs: 46560,
+ timestampMs: 46480,
+ confidence: 0.998342,
+ },
+ {
+ text: ' pay',
+ startMs: 46560,
+ endMs: 46800,
+ timestampMs: 46700,
+ confidence: 0.996379,
+ },
+ {
+ text: ' for',
+ startMs: 46800,
+ endMs: 47000,
+ timestampMs: 46960,
+ confidence: 0.99984,
+ },
+ {
+ text: ' Remotion,',
+ startMs: 47000,
+ endMs: 47760,
+ timestampMs: 47160,
+ confidence: 0.954749,
+ },
+ {
+ text: ' eliminating',
+ startMs: 47760,
+ endMs: 48500,
+ timestampMs: 48140,
+ confidence: 0.933346,
+ },
+ {
+ text: ' any',
+ startMs: 48500,
+ endMs: 48700,
+ timestampMs: 48720,
+ confidence: 0.997935,
+ },
+ {
+ text: ' doubt',
+ startMs: 48700,
+ endMs: 49040,
+ timestampMs: 48960,
+ confidence: 0.995133,
+ },
+ {
+ text: ' about',
+ startMs: 49040,
+ endMs: 49380,
+ timestampMs: 49280,
+ confidence: 0.9678,
+ },
+ {
+ text: ' our',
+ startMs: 49380,
+ endMs: 49670,
+ timestampMs: 49600,
+ confidence: 0.999237,
+ },
+ {
+ text: ' future.',
+ startMs: 49670,
+ endMs: 50200,
+ timestampMs: 49980,
+ confidence: 0.98055,
+ },
+ {
+ text: ' Still',
+ startMs: 50200,
+ endMs: 50520,
+ timestampMs: 50440,
+ confidence: 0.997957,
+ },
+ {
+ text: " can't",
+ startMs: 50520,
+ endMs: 50700,
+ timestampMs: 50620,
+ confidence: 0.944386,
+ },
+ {
+ text: ' believe',
+ startMs: 50700,
+ endMs: 51160,
+ timestampMs: 50960,
+ confidence: 0.999295,
+ },
+ {
+ text: ' that',
+ startMs: 51160,
+ endMs: 51250,
+ timestampMs: 51300,
+ confidence: 0.990539,
+ },
+ {
+ text: ' actually',
+ startMs: 51250,
+ endMs: 51650,
+ timestampMs: 51700,
+ confidence: 0.988987,
+ },
+ {
+ text: ' worked.',
+ startMs: 51650,
+ endMs: 52120,
+ timestampMs: 52000,
+ confidence: 0.80905,
+ },
+ {
+ text: ' So',
+ startMs: 52120,
+ endMs: 52240,
+ timestampMs: 52320,
+ confidence: 0.999176,
+ },
+ {
+ text: " it's",
+ startMs: 52240,
+ endMs: 52520,
+ timestampMs: 52500,
+ confidence: 0.831385,
+ },
+ {
+ text: ' as',
+ startMs: 52520,
+ endMs: 52600,
+ timestampMs: 52700,
+ confidence: 0.978827,
+ },
+ {
+ text: ' simple',
+ startMs: 52600,
+ endMs: 52980,
+ timestampMs: 52960,
+ confidence: 0.999817,
+ },
+ {
+ text: ' as',
+ startMs: 52980,
+ endMs: 53200,
+ timestampMs: 53160,
+ confidence: 0.999131,
+ },
+ {
+ text: ' that.',
+ startMs: 53200,
+ endMs: 53600,
+ timestampMs: 53460,
+ confidence: 0.933953,
+ },
+ {
+ text: ' We',
+ startMs: 53600,
+ endMs: 53740,
+ timestampMs: 53780,
+ confidence: 0.999317,
+ },
+ {
+ text: ' get',
+ startMs: 53740,
+ endMs: 54030,
+ timestampMs: 54000,
+ confidence: 0.98824,
+ },
+ {
+ text: ' money',
+ startMs: 54030,
+ endMs: 54310,
+ timestampMs: 54220,
+ confidence: 0.999192,
+ },
+ {
+ text: ' from',
+ startMs: 54310,
+ endMs: 54600,
+ timestampMs: 54460,
+ confidence: 0.99971,
+ },
+ {
+ text: ' companies,',
+ startMs: 54600,
+ endMs: 55280,
+ timestampMs: 55000,
+ confidence: 0.936601,
+ },
+ {
+ text: ' but',
+ startMs: 55280,
+ endMs: 55540,
+ timestampMs: 55440,
+ confidence: 0.999737,
+ },
+ {
+ text: ' for',
+ startMs: 55540,
+ endMs: 55760,
+ timestampMs: 55680,
+ confidence: 0.995524,
+ },
+ {
+ text: ' the',
+ startMs: 55760,
+ endMs: 56090,
+ timestampMs: 55840,
+ confidence: 0.999367,
+ },
+ {
+ text: ' vast',
+ startMs: 56090,
+ endMs: 56310,
+ timestampMs: 56060,
+ confidence: 0.99843,
+ },
+ {
+ text: ' majority',
+ startMs: 56310,
+ endMs: 56940,
+ timestampMs: 56500,
+ confidence: 0.997919,
+ },
+ {
+ text: ' of',
+ startMs: 56940,
+ endMs: 57040,
+ timestampMs: 56800,
+ confidence: 0.99931,
+ },
+ {
+ text: ' you,',
+ startMs: 57040,
+ endMs: 57360,
+ timestampMs: 57040,
+ confidence: 0.969215,
+ },
+ {
+ text: " it's",
+ startMs: 57360,
+ endMs: 57620,
+ timestampMs: 57540,
+ confidence: 0.750421,
+ },
+ {
+ text: ' one',
+ startMs: 57620,
+ endMs: 57820,
+ timestampMs: 57880,
+ confidence: 0.999401,
+ },
+ {
+ text: ' of',
+ startMs: 57820,
+ endMs: 58050,
+ timestampMs: 58020,
+ confidence: 0.999485,
+ },
+ {
+ text: ' those',
+ startMs: 58050,
+ endMs: 58350,
+ timestampMs: 58300,
+ confidence: 0.991128,
+ },
+ {
+ text: ' best',
+ startMs: 58350,
+ endMs: 58580,
+ timestampMs: 58520,
+ confidence: 0.997029,
+ },
+ {
+ text: ' things',
+ startMs: 58580,
+ endMs: 58930,
+ timestampMs: 58760,
+ confidence: 0.999112,
+ },
+ {
+ text: ' in',
+ startMs: 58930,
+ endMs: 59060,
+ timestampMs: 58960,
+ confidence: 0.994351,
+ },
+ {
+ text: ' life',
+ startMs: 59060,
+ endMs: 59360,
+ timestampMs: 59200,
+ confidence: 0.999455,
+ },
+ ]}
+ captionsSrc={null}
voiceoverSrc={null}
/>
</Sequence>