Skip to content

🎥 Make videos programmatically with React

make a testbed

Jonny Burgere6a502628dc1
diff --git a/.gitignore b/.gitignore
index 31e9920cd0..837f5dd923 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,4 @@ packages/lambda-python/build
packages/lambda-python/remotion-env
packages/lambda-python/remotion_lambda.egg-info
packages/cloudrun/container/cloudbuild.json
+packages/example/public/offthreadvideoregression
diff --git a/packages/example/src/OffthreadRemoteVideo/OffthreadRemoteVideo.tsx b/packages/example/src/OffthreadRemoteVideo/OffthreadRemoteVideo.tsx
index 1e9ff8b22a..28eb6d2f36 100644
--- a/packages/example/src/OffthreadRemoteVideo/OffthreadRemoteVideo.tsx
+++ b/packages/example/src/OffthreadRemoteVideo/OffthreadRemoteVideo.tsx
@@ -11,13 +11,8 @@ export const OffthreadRemoteVideo: React.FC = () => {
);
};
-export const OffthreadLocalVideo: React.FC = () => {
- return (
- <OffthreadVideo
- volume={(f) =>
- interpolate(f, [0, 500], [1, 0], {extrapolateRight: 'clamp'})
- }
- src={staticFile('variablefps.webm')}
- />
- );
+export const OffthreadLocalVideo: React.FC<{
+ src: string;
+}> = ({src}) => {
+ return <OffthreadVideo src={staticFile(src)} />;
};
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index 75946fa659..9f06b794dc 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -485,15 +485,18 @@ export const Index: React.FC = () => {
width={1080}
height={1920}
fps={30}
- durationInFrames={100}
+ durationInFrames={900}
+ defaultProps={{
+ src: 'variablefps.webm',
+ }}
/>
<Composition
id="OffthreadRemoteVideo"
component={OffthreadRemoteVideo}
- width={1920 * 2}
- height={1080 * 2}
- fps={60}
- durationInFrames={20000}
+ width={1920}
+ height={1080}
+ fps={30}
+ durationInFrames={1000}
/>
<Composition
id="video-testing-webm"
diff --git a/packages/example/testoffthreadvideo.ts b/packages/example/testoffthreadvideo.ts
new file mode 100644
index 0000000000..72bf1d5222
--- /dev/null
+++ b/packages/example/testoffthreadvideo.ts
@@ -0,0 +1,16 @@
+// `bun testoffthreadvideo.ts`
+
+import {execSync} from 'node:child_process';
+import {readdirSync} from 'node:fs';
+
+const files = readdirSync('public/offthreadvideoregression').filter(
+ (f) => !f.startsWith('.'),
+);
+
+for (const file of files) {
+ console.log(`Rendering ${file}`);
+ execSync(
+ `pnpm exec remotion render OffthreadLocalVideo --props='{"src": "offthreadvideoregression/${file}"}' out/regressions/${file}.mp4`,
+ {stdio: 'inherit'},
+ );
+}