Skip to content

🎥 Make videos programmatically with React

inline templates

Jonny Burger9e9464e63407
diff --git a/packages/it-tests/src/templates/publish.ts b/packages/it-tests/src/templates/publish.ts
new file mode 100644
index 0000000000..84128d5b94
--- /dev/null
+++ b/packages/it-tests/src/templates/publish.ts
@@ -0,0 +1,18 @@
+import {$} from 'bun';
+import {tmpdir} from 'node:os';
+import path from 'path';
+
+const folder = path.join(process.cwd(), '..', 'template-blank');
+
+const tmpDir = tmpdir();
+const workingDir = path.join(tmpDir, `template-${Math.random()}`);
+
+const files = await $`git ls-files`.cwd(folder);
+const filesInTemplate = files.stdout.toString('utf-8');
+console.log({filesInTemplate});
+console.log(workingDir);
+
+await $`git clone [email protected]:remotion-dev/template-empty.git ${workingDir}`;
+await $`git checkout -b ${Math.random().toString().replace('0.', '')}`.cwd(
+ workingDir,
+);
diff --git a/packages/it-tests/tsconfig.json b/packages/it-tests/tsconfig.json
index 68fc70a8f1..a5155734a1 100644
--- a/packages/it-tests/tsconfig.json
+++ b/packages/it-tests/tsconfig.json
@@ -3,7 +3,9 @@
"compilerOptions": {
"jsx": "react-jsx",
"noEmit": true,
- "incremental": true
+ "incremental": true,
+ "target": "ES2022",
+ "module": "ESNext"
},
"references": [
{
diff --git a/packages/template-blank/.eslintrc b/packages/template-blank/.eslintrc
new file mode 100644
index 0000000000..644af06a99
--- /dev/null
+++ b/packages/template-blank/.eslintrc
@@ -0,0 +1,3 @@
+{
+ "extends": "@remotion",
+}
diff --git a/packages/template-blank/.gitignore b/packages/template-blank/.gitignore
new file mode 100644
index 0000000000..b62197ba2f
--- /dev/null
+++ b/packages/template-blank/.gitignore
@@ -0,0 +1,7 @@
+node_modules
+dist
+.DS_Store
+.env
+
+# Ignore the output video from Git but not videos you import into src/.
+out
diff --git a/packages/template-blank/README.md b/packages/template-blank/README.md
new file mode 100644
index 0000000000..38c22c2df3
--- /dev/null
+++ b/packages/template-blank/README.md
@@ -0,0 +1,54 @@
+# Remotion video
+
+<p align="center">
+ <a href="https://github.com/remotion-dev/logo">
+ <picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/remotion-dev/logo/raw/main/animated-logo-banner-dark.gif">
+ <img alt="Animated Remotion Logo" src="https://github.com/remotion-dev/logo/raw/main/animated-logo-banner-light.gif">
+ </picture>
+ </a>
+</p>
+
+Welcome to your Remotion project!
+
+## Commands
+
+**Install Dependencies**
+
+```console
+npm install
+```
+
+**Start Preview**
+
+```console
+npm start
+```
+
+**Render video**
+
+```console
+npm run build
+```
+
+**Upgrade Remotion**
+
+```console
+npm run upgrade
+```
+
+## Docs
+
+Get started with Remotion by reading the [fundamentals page](https://www.remotion.dev/docs/the-fundamentals).
+
+## Help
+
+We provide help on our [Discord server](https://discord.gg/6VzzNDwUwV).
+
+## Issues
+
+Found an issue with Remotion? [File an issue here](https://github.com/remotion-dev/remotion/issues/new).
+
+## License
+
+Note that for some entities a company license is needed. [Read the terms here](https://github.com/remotion-dev/remotion/blob/main/LICENSE.md).
diff --git a/packages/template-blank/package.json b/packages/template-blank/package.json
new file mode 100644
index 0000000000..ce2cc66b76
--- /dev/null
+++ b/packages/template-blank/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "template-empty",
+ "version": "1.0.0",
+ "description": "My Remotion video",
+ "scripts": {
+ "start": "remotion studio",
+ "build": "remotion render MyComp out/video.mp4",
+ "upgrade": "remotion upgrade",
+ "test": "eslint src --ext ts,tsx,js,jsx && tsc"
+ },
+ "repository": {},
+ "license": "UNLICENSED",
+ "dependencies": {
+ "@remotion/cli": "workspace:*",
+ "react": "^18.0.0",
+ "react-dom": "^18.0.0",
+ "remotion": "workspace:*"
+ },
+ "devDependencies": {
+ "@remotion/eslint-config": "workspace:*",
+ "@types/react": "^18.0.26",
+ "@types/web": "^0.0.143",
+ "eslint": "^8.43.0",
+ "prettier": "^3.2.5",
+ "typescript": "^5.4.5"
+ },
+ "private": true
+}
diff --git a/packages/template-blank/remotion.config.ts b/packages/template-blank/remotion.config.ts
new file mode 100644
index 0000000000..4449e02586
--- /dev/null
+++ b/packages/template-blank/remotion.config.ts
@@ -0,0 +1,11 @@
+/**
+ * Note: When using the Node.JS APIs, the config file
+ * doesn't apply. Instead, pass options directly to the APIs.
+ *
+ * All configuration options: https://remotion.dev/docs/config
+ */
+
+import {Config} from '@remotion/cli/config';
+
+Config.setVideoImageFormat('jpeg');
+Config.setOverwriteOutput(true);
diff --git a/packages/template-blank/src/Composition.tsx b/packages/template-blank/src/Composition.tsx
new file mode 100644
index 0000000000..b0d1fe1be4
--- /dev/null
+++ b/packages/template-blank/src/Composition.tsx
@@ -0,0 +1,3 @@
+export const MyComposition = () => {
+ return null;
+};
diff --git a/packages/template-blank/src/Root.tsx b/packages/template-blank/src/Root.tsx
new file mode 100644
index 0000000000..6483c979b6
--- /dev/null
+++ b/packages/template-blank/src/Root.tsx
@@ -0,0 +1,17 @@
+import {Composition} from 'remotion';
+import {MyComposition} from './Composition';
+
+export const RemotionRoot: React.FC = () => {
+ return (
+ <>
+ <Composition
+ id="MyComp"
+ component={MyComposition}
+ durationInFrames={60}
+ fps={30}
+ width={1280}
+ height={720}
+ />
+ </>
+ );
+};
diff --git a/packages/template-blank/src/index.ts b/packages/template-blank/src/index.ts
new file mode 100644
index 0000000000..d831f7b0f1
--- /dev/null
+++ b/packages/template-blank/src/index.ts
@@ -0,0 +1,4 @@
+import {registerRoot} from 'remotion';
+import {RemotionRoot} from './Root';
+
+registerRoot(RemotionRoot);
diff --git a/packages/template-blank/tsconfig.json b/packages/template-blank/tsconfig.json
new file mode 100644
index 0000000000..0a292af5f2
--- /dev/null
+++ b/packages/template-blank/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "compilerOptions": {
+ "target": "ES2018",
+ "module": "commonjs",
+ "jsx": "react-jsx",
+ "outDir": "./dist",
+ "strict": true,
+ "noEmit": true,
+ "lib": ["es2015"],
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "noUnusedLocals": true
+ }
+}