🎥 Make videos programmatically with React
Offload Jonny's videos without local media
JonnyBurger840d1c7116e2
diff --git a/.agents/skills/offload-r2/SKILL.md b/.agents/skills/offload-r2/SKILL.mdindex 48ee75f7be..c8cb3bb459 100644--- a/.agents/skills/offload-r2/SKILL.md+++ b/.agents/skills/offload-r2/SKILL.md@@ -1,18 +1,18 @@---name: offload-r2-description: Upload Remotion repository media assets to the Cloudflare R2 bucket behind remotion.media, switch source code to hosted URLs, and retain ignored local working copies. Use when binaries should remain available locally for editing or previewing but must not be committed to Git.+description: Upload Remotion repository media assets to the Cloudflare R2 bucket behind remotion.media, switch source code to hosted URLs, verify the public objects, and remove repository-local copies.---# Offload R2 Asset-Host media on `https://remotion.media/` while preserving the original file in the worktree as an ignored local copy.+Host media on `https://remotion.media/`, update every in-scope source reference to the public object, and remove the repository-local copy after verification.## Workflow1. Find the main worktree with `git worktree list --porcelain`. Prefer the worktree on `refs/heads/main`, normally `/Users/jonathanburger/remotion`.-2. Choose a stable, descriptive object key. Use a feature-specific directory prefix when it prevents collisions, for example `studio-close-ups/demo.mp4`.+2. Choose a stable, descriptive object key. Use a feature-specific directory prefix when it prevents collisions, for example `studio-close-ups/demo.mp4`. When replacing an asset, prefer a new versioned key so browser and Studio caches cannot serve the previous bytes.3. Load credentials from the main worktree without printing them:@@ -22,27 +22,28 @@ Host media on `https://remotion.media/` while preserving the original file in thThe required variables are `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.-4. Upload to the `parser-media` bucket with Bun's S3-compatible client. Preserve an existing object when its size matches the local file:+4. Upload to the `parser-media` bucket with Bun's S3-compatible client:```bash- bun --env-file=/Users/jonathanburger/remotion/packages/remotion-media/.env -e "import {S3Client} from 'bun'; const filePath='<local-file>'; const key='<object-key>'; const client=new S3Client({accessKeyId:Bun.env.AWS_ACCESS_KEY_ID,secretAccessKey:Bun.env.AWS_SECRET_ACCESS_KEY,endpoint:'https://2fe488b3b0f4deee223aef7464784c46.r2.cloudflarestorage.com',bucket:'parser-media'}); const file=Bun.file(filePath); if (await client.exists(key)) { const stat=await client.stat(key); if (stat.size===file.size) { console.log('exists-same-size',key,file.size); process.exit(0); } } await client.write(key,file); const stat=await client.stat(key); if (stat.size!==file.size) throw new Error('Size mismatch'); console.log('uploaded',key,stat.size);"+ bun --env-file=/Users/jonathanburger/remotion/packages/remotion-media/.env -e "import {S3Client} from 'bun'; const filePath='<local-file>'; const key='<object-key>'; const client=new S3Client({accessKeyId:Bun.env.AWS_ACCESS_KEY_ID,secretAccessKey:Bun.env.AWS_SECRET_ACCESS_KEY,endpoint:'https://2fe488b3b0f4deee223aef7464784c46.r2.cloudflarestorage.com',bucket:'parser-media'}); const bytes=new Uint8Array(await Bun.file(filePath).arrayBuffer()); await client.write(key,bytes); const remote=await client.file(key).arrayBuffer(); if (remote.byteLength!==bytes.byteLength) throw new Error('Size mismatch'); console.log('uploaded',key,remote.byteLength);"```-5. Verify the public object:+5. Verify the public object and compare its SHA-256 hash with the local file before removing anything:```bashcurl -I --fail https://remotion.media/<object-key>+ test "$(shasum -a 256 <local-file> | cut -d' ' -f1)" = "$(curl --fail --silent https://remotion.media/<object-key> | shasum -a 256 | cut -d' ' -f1)"```-6. Replace source usage with the public URL. Do not wrap remote URLs in `staticFile()` because it rejects `http://` and `https://` URLs.+6. Replace every in-scope source usage with the public URL. Do not wrap remote URLs in `staticFile()` because it rejects `http://` and `https://` URLs.-7. Keep the local binary in place and add its exact repository-relative path to the nearest applicable `.gitignore`, following existing entries such as those in `packages/brand/.gitignore`. Do not delete the local file. If it was already tracked, remove it only from the Git index with `git rm --cached -- <local-file>`.+7. After the public hash matches and source references are remote, remove the local copy. Use `git rm -- <local-file>` for a tracked file or remove the exact untracked/ignored file directly. Remove obsolete asset-specific `.gitignore` entries and empty asset directories. Do not use recursive deletion or broad globs.-8. Verify both sides of the offload:+8. Verify the local copy is gone and search the affected package for remaining local references:```bash- test -f <local-file>- git check-ignore -v <local-file>+ test ! -e <local-file>+ rg -n '<local-filename>|staticFile\(' <affected-package>```9. Run focused lint or style checks for touched packages. Commit or push only when requested.diff --git a/packages/jonnys-videos/.gitignore b/packages/jonnys-videos/.gitignoredeleted file mode 100644index 51f41e8574..0000000000--- a/packages/jonnys-videos/.gitignore+++ /dev/null@@ -1,4 +0,0 @@-public/image.png-public/image-1.png-public/image-2.png-public/image-3.pngdiff --git a/packages/jonnys-videos/src/Root.tsx b/packages/jonnys-videos/src/Root.tsxindex 1a3a3e2431..218048deb6 100644--- a/packages/jonnys-videos/src/Root.tsx+++ b/packages/jonnys-videos/src/Root.tsx@@ -277,7 +277,7 @@ export const RemotionRoot: React.FC = () => {<Compositionid="HowCanRemotionBeFree"component={HowCanRemotionBeFree}- durationInFrames={1800}+ durationInFrames={1802}fps={30}width={1080}height={1920}diff --git a/packages/jonnys-videos/src/how-can-remotion-be-free/FirstCustomerChart.tsx b/packages/jonnys-videos/src/how-can-remotion-be-free/FirstCustomerChart.tsxindex 9db1b75c77..c2d2e06fc2 100644--- a/packages/jonnys-videos/src/how-can-remotion-be-free/FirstCustomerChart.tsx+++ b/packages/jonnys-videos/src/how-can-remotion-be-free/FirstCustomerChart.tsx@@ -7,7 +7,7 @@ import {useCurrentFrame,} from 'remotion';-export const FIRST_CUSTOMER_CHART_DURATION_IN_FRAMES = 174;+export const FIRST_CUSTOMER_CHART_DURATION_IN_FRAMES = 221;const FONT_FAMILY ="Noteworthy, 'Bradley Hand', 'Marker Felt', 'Comic Sans MS', cursive";@@ -64,7 +64,7 @@ export const FirstCustomerChart: React.FC = () => {style={{height: 790,left: 52,- opacity: interpolate(frame, [0, 7, 164, 173], [0, 1, 1, 0], {+ opacity: interpolate(frame, [0, 7, 211, 220], [0, 1, 1, 0], {extrapolateLeft: 'clamp',extrapolateRight: 'clamp',}),@@ -108,7 +108,7 @@ export const FirstCustomerChart: React.FC = () => {fontWeight: 700,letterSpacing: -1.8,lineHeight: 1,- opacity: interpolate(frame, [33, 42], [0, 1], {+ opacity: interpolate(frame, [42, 51], [0, 1], {extrapolateLeft: 'clamp',extrapolateRight: 'clamp',}),@@ -136,13 +136,13 @@ export const FirstCustomerChart: React.FC = () => {<clipPath id="june-bar-reveal"><rectx={760}- y={interpolate(frame, [69, 91], [410, 40], {+ y={interpolate(frame, [107, 129], [410, 40], {easing: Easing.bezier(0.16, 1, 0.3, 1),extrapolateLeft: 'clamp',extrapolateRight: 'clamp',})}width={210}- height={interpolate(frame, [69, 91], [0, 370], {+ height={interpolate(frame, [107, 129], [0, 370], {easing: Easing.bezier(0.16, 1, 0.3, 1),extrapolateLeft: 'clamp',extrapolateRight: 'clamp',@@ -212,7 +212,7 @@ export const FirstCustomerChart: React.FC = () => {pathLength={1}stroke="#ff674f"strokeDasharray={1}- strokeDashoffset={interpolate(frame, [91, 105], [1, 0], {+ strokeDashoffset={interpolate(frame, [129, 143], [1, 0], {extrapolateLeft: 'clamp',extrapolateRight: 'clamp',})}@@ -226,7 +226,7 @@ export const FirstCustomerChart: React.FC = () => {pathLength={1}stroke="rgba(255, 103, 79, 0.46)"strokeDasharray={1}- strokeDashoffset={interpolate(frame, [96, 108], [1, 0], {+ strokeDashoffset={interpolate(frame, [134, 146], [1, 0], {extrapolateLeft: 'clamp',extrapolateRight: 'clamp',})}@@ -239,7 +239,7 @@ export const FirstCustomerChart: React.FC = () => {pathLength={1}stroke="#ff674f"strokeDasharray={1}- strokeDashoffset={interpolate(frame, [99, 112], [1, 0], {+ strokeDashoffset={interpolate(frame, [137, 150], [1, 0], {extrapolateLeft: 'clamp',extrapolateRight: 'clamp',})}@@ -315,7 +315,7 @@ export const FirstCustomerChart: React.FC = () => {fontSize: 49,fontWeight: 700,left: 770,- opacity: interpolate(frame, [85, 94], [0, 1], {+ opacity: interpolate(frame, [123, 132], [0, 1], {extrapolateLeft: 'clamp',extrapolateRight: 'clamp',}),@@ -336,7 +336,7 @@ export const FirstCustomerChart: React.FC = () => {fontSize: 38,fontWeight: 700,left: 788,- opacity: interpolate(frame, [73, 82], [0, 1], {+ opacity: interpolate(frame, [111, 120], [0, 1], {extrapolateLeft: 'clamp',extrapolateRight: 'clamp',}),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.tsxindex 19ed06fc22..ae6b0c056e 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@@ -20,19 +20,19 @@ import {} from './UnrulyOutcome';import {ZURICH_PHOTO_DURATION_IN_FRAMES, ZurichPhoto} from './ZurichPhoto';-const HOW_CAN_REMOTION_BE_FREE_AUDIO_FILE = 'voiceover.mp3';-const HOW_CAN_REMOTION_BE_FREE_CAPTIONS_FILE = 'captions.json';-const PREMIUM_VERSION_START_FRAME = 100;-const UNRULY_OUTCOME_START_FRAME = 148;-const FIRST_CUSTOMER_CHART_START_FRAME = 645;-const SWITZERLAND_SCENE_START_FRAME = 816;+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;+const SWITZERLAND_SCENE_START_FRAME = 866;export const HowCanRemotionBeFree: React.FC = () => {return (<><Audiosrc={asset(HOW_CAN_REMOTION_BE_FREE_AUDIO_FILE)}- durationInFrames={1674.71}+ durationInFrames={1801.67}/><Solidwidth={1080}@@ -80,7 +80,7 @@ export const HowCanRemotionBeFree: React.FC = () => {height={CAPTIONS_HEIGHT}style={{position: 'absolute',- translate: '0px 1132.3px',+ translate: '0px 780px',}}><AnimatedCaptionsdiff --git a/packages/jonnys-videos/src/how-can-remotion-be-free/PremiumVersion.tsx b/packages/jonnys-videos/src/how-can-remotion-be-free/PremiumVersion.tsxindex c906e54c53..9c9d820a3f 100644--- a/packages/jonnys-videos/src/how-can-remotion-be-free/PremiumVersion.tsx+++ b/packages/jonnys-videos/src/how-can-remotion-be-free/PremiumVersion.tsx@@ -7,7 +7,7 @@ import {useCurrentFrame,} from 'remotion';-export const PREMIUM_VERSION_DURATION_IN_FRAMES = 48;+export const PREMIUM_VERSION_DURATION_IN_FRAMES = 36;const REMOTION_LOGO_PATH ='M87.6061 0.0346985C79.1878 0.491638 72.4039 1.82733 65.5673 4.42841C62.1578 5.71136 56.569 8.5058 53.4934 10.439C40.6286 18.5059 30.8219 30.6325 25.7076 44.7451C24.6882 47.5395 21.929 56.4499 20.1539 62.5835C8.32607 103.586 1.61249 148.419 0.171355 195.871C-0.0571182 203.428 -0.0571182 221.425 0.171355 228.859C1.13797 260.318 4.14327 288.719 9.59146 317.682C11.8059 329.405 15.356 345.152 17.4123 352.305C21.6126 366.839 30.1892 379.212 42.3861 388.28C50.5584 394.361 59.8379 398.438 70.1192 400.442C75.0753 401.409 81.6131 401.848 86.4286 401.532C93.0895 401.092 106.306 399.317 117.044 397.402C165.445 388.772 210.155 373.324 250.701 351.215C276.377 337.208 298.328 322.041 319.506 303.64C340.613 285.327 358.61 265.626 374.445 243.516C378.118 238.402 379.963 235.414 381.809 231.653C386.554 221.952 388.786 212.304 388.768 201.513C388.768 191.46 386.87 182.532 382.775 173.393C380.807 168.982 378.926 165.818 374.708 159.807C359.172 137.681 341.931 118.401 320.912 99.6664C288.328 70.6328 249.628 46.8189 206.412 29.1913C197.045 25.3776 187.818 22.0208 176.711 18.3828C153.195 10.7026 124.091 4.04178 99.4691 0.720123C95.6027 0.192871 90.3478 -0.105896 87.6061 0.0346985Z';@@ -98,7 +98,7 @@ const TierRow: React.FC<{index: number; label: string; rings: number}> = ({height: 294,opacity: interpolate(frame,- [startFrame, startFrame + 6, 43, 47],+ [startFrame, startFrame + 6, 31, 35],[0, 1, 1, 0],{extrapolateLeft: 'clamp',diff --git a/packages/jonnys-videos/src/how-can-remotion-be-free/UnrulyOutcome.tsx b/packages/jonnys-videos/src/how-can-remotion-be-free/UnrulyOutcome.tsxindex 644271c922..7085d9eff2 100644--- a/packages/jonnys-videos/src/how-can-remotion-be-free/UnrulyOutcome.tsx+++ b/packages/jonnys-videos/src/how-can-remotion-be-free/UnrulyOutcome.tsx@@ -1,7 +1,7 @@import React from 'react';import {AbsoluteFill, Interactive} from 'remotion';-export const UNRULY_OUTCOME_DURATION_IN_FRAMES = 81;+export const UNRULY_OUTCOME_DURATION_IN_FRAMES = 70;const OUTCOMES = ['bait and switch',