π₯ Make videos programmatically with React
Add remotion.media as packages/remotion-media
Jonny Burgerb39b081ee526
diff --git a/bun.lock b/bun.lockindex 9e43e1eade..6e871f271f 100644--- a/bun.lock+++ b/bun.lock@@ -1306,6 +1306,31 @@"react-dom": ">=18.0.0",},},+ "packages/remotion-media": {+ "name": "@remotion/remotion-media",+ "version": "4.0.463",+ "dependencies": {+ "@remotion/cli": "workspace:*",+ "@remotion/media": "workspace:*",+ "@remotion/paths": "workspace:*",+ "@remotion/shapes": "workspace:*",+ "@remotion/studio": "workspace:*",+ "bun-plugin-tailwind": "0.1.2",+ "react": "catalog:",+ "react-dom": "catalog:",+ "remotion": "workspace:*",+ "tailwindcss": "4.2.0",+ },+ "devDependencies": {+ "@remotion/eslint-config-internal": "workspace:*",+ "@types/bun": "catalog:",+ "@types/react": "catalog:",+ "@types/react-dom": "catalog:",+ "@typescript/native-preview": "catalog:",+ "eslint": "catalog:",+ "prettier": "catalog:",+ },+ },"packages/renderer": {"name": "@remotion/renderer","version": "4.0.463",@@ -3989,6 +4014,8 @@"@remotion/react18-tests": ["@remotion/react18-tests@workspace:packages/react18-tests"],+ "@remotion/remotion-media": ["@remotion/remotion-media@workspace:packages/remotion-media"],+"@remotion/renderer": ["@remotion/renderer@workspace:packages/renderer"],"@remotion/rive": ["@remotion/rive@workspace:packages/rive"],@@ -9435,6 +9462,8 @@"@remotion/react18-tests/zod": ["[email protected]", "", {}, "sha512-EjIevzuJRiRPbVH4mGc8nApb/lVLKVpmUhAaR5R5doKGfAnGJ6Gr3CViAVjP+4FWSxCsybeWQdcgCtbX+7oZug=="],+ "@remotion/remotion-media/tailwindcss": ["[email protected]", "", {}, "sha512-yYzTZ4++b7fNYxFfpnberEEKu43w44aqDMNM9MHMmcKuCH7lL8jJ4yJ7LGHv7rSwiqM0nkiobF9I6cLlpS2P7Q=="],+"@remotion/tailwind/tailwindcss": ["[email protected]", "", { "dependencies": { "@alloc/quick-lru": "5.2.0", "arg": "5.0.2", "chokidar": "3.5.3", "didyoumean": "1.2.2", "dlv": "1.1.3", "fast-glob": "3.3.2", "glob-parent": "6.0.2", "is-glob": "4.0.3", "jiti": "1.21.6", "lilconfig": "2.1.0", "micromatch": "4.0.8", "normalize-path": "3.0.0", "object-hash": "3.0.0", "picocolors": "1.1.1", "postcss": "8.5.1", "postcss-import": "15.1.0", "postcss-js": "4.0.1", "postcss-load-config": "4.0.1", "postcss-nested": "6.0.1", "postcss-selector-parser": "6.1.1", "resolve": "1.22.8", "sucrase": "3.32.0" }, "bin": { "tailwind": "lib/cli.js", "tailwindcss": "lib/cli.js" } }, "sha512-KqjHOJKogOUt5Bs752ykCeiwvi0fKVkr5oqsFNt/8px/tA8scFPIlkygsf6jXrfCqGHz7VflA6+yytWuM+XhFw=="],"@remotion/tailwind-v4/tailwindcss": ["[email protected]", "", {}, "sha512-yYzTZ4++b7fNYxFfpnberEEKu43w44aqDMNM9MHMmcKuCH7lL8jJ4yJ7LGHv7rSwiqM0nkiobF9I6cLlpS2P7Q=="],diff --git a/packages/remotion-media/.gitattributes b/packages/remotion-media/.gitattributesnew file mode 100644index 0000000000..dfe0770424--- /dev/null+++ b/packages/remotion-media/.gitattributes@@ -0,0 +1,2 @@+# Auto detect text files and perform LF normalization+* text=autodiff --git a/packages/remotion-media/.gitignore b/packages/remotion-media/.gitignorenew file mode 100644index 0000000000..643a0a0dc8--- /dev/null+++ b/packages/remotion-media/.gitignore@@ -0,0 +1,38 @@+# dependencies (bun install)+node_modules++# output+out+dist+*.tgz++# code coverage+coverage+*.lcov++# logs+logs+_.log+report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json++# dotenv environment variable files+.env+.env.development.local+.env.test.local+.env.production.local+.env.local++# caches+.eslintcache+.cache+*.tsbuildinfo++# IntelliJ based IDEs+.idea++# Finder (MacOS) folder config++.DS_Store++files+tone.wav\ No newline at end of filediff --git a/packages/remotion-media/README.md b/packages/remotion-media/README.mdnew file mode 100644index 0000000000..b5e8b6e1b0--- /dev/null+++ b/packages/remotion-media/README.md@@ -0,0 +1,27 @@+# @remotion/remotion-media++Private package hosting [remotion.media](https://remotion.media): test media fixtures and a catalog UI for `@remotion/media`.++## Development++```bash+bun install+cd packages/remotion-media+bun run dev+```++## Generate test media++Requires `ffmpeg` on your PATH. Renders base compositions from `src/compositions/` and writes variants to `files/` (gitignored), then updates `variants.json`.++```bash+bun run generate+```++## Build and deploy++Bundles the catalog UI and uploads to Cloudflare R2 when `AWS_ACCESS_KEY_ID` and `AWS_ACCESS_SECRET_ACCESS_KEY` are set:++```bash+bun run build+```diff --git a/packages/remotion-media/bruh.wav b/packages/remotion-media/bruh.wavnew file mode 100644index 0000000000..d180a53caaBinary files /dev/null and b/packages/remotion-media/bruh.wav differdiff --git a/packages/remotion-media/build.ts b/packages/remotion-media/build.tsnew file mode 100644index 0000000000..2a8a1095fa--- /dev/null+++ b/packages/remotion-media/build.ts@@ -0,0 +1,223 @@+#!/usr/bin/env bun+import { build, Glob, S3Client, type BuildConfig } from "bun";+import plugin from "bun-plugin-tailwind";+import { cpSync, existsSync, readdirSync } from "fs";+import { rm } from "fs/promises";+import path from "path";++// Print help text if requested+if (process.argv.includes("--help") || process.argv.includes("-h")) {+ console.log(`+ποΈ Bun Build Script++Usage: bun run build.ts [options]++Common Options:+ --outdir <path> Output directory (default: "dist")+ --minify Enable minification (or --minify.whitespace, --minify.syntax, etc)+ --source-map <type> Sourcemap type: none|linked|inline|external+ --target <target> Build target: browser|bun|node+ --format <format> Output format: esm|cjs|iife+ --splitting Enable code splitting+ --packages <type> Package handling: bundle|external+ --public-path <path> Public path for assets+ --env <mode> Environment handling: inline|disable|prefix*+ --conditions <list> Package.json export conditions (comma separated)+ --external <list> External packages (comma separated)+ --banner <text> Add banner text to output+ --footer <text> Add footer text to output+ --define <obj> Define global constants (e.g. --define.VERSION=1.0.0)+ --help, -h Show this help message++Example:+ bun run build.ts --outdir=dist --minify --source-map=linked --external=react,react-dom+`);+ process.exit(0);+}++// Helper function to convert kebab-case to camelCase+const toCamelCase = (str: string): string => {+ return str.replace(/-([a-z])/g, (g) => g[1].toUpperCase());+};++// Helper function to parse a value into appropriate type+const parseValue = (value: string): any => {+ // Handle true/false strings+ if (value === "true") return true;+ if (value === "false") return false;++ // Handle numbers+ if (/^\d+$/.test(value)) return parseInt(value, 10);+ if (/^\d*\.\d+$/.test(value)) return parseFloat(value);++ // Handle arrays (comma-separated)+ if (value.includes(",")) return value.split(",").map((v) => v.trim());++ // Default to string+ return value;+};++// Magical argument parser that converts CLI args to BuildConfig+function parseArgs(): Partial<BuildConfig> {+ const config: Record<string, any> = {};+ const args = process.argv.slice(2);++ for (let i = 0; i < args.length; i++) {+ const arg = args[i];+ if (!arg.startsWith("--")) continue;++ // Handle --no-* flags+ if (arg.startsWith("--no-")) {+ const key = toCamelCase(arg.slice(5));+ config[key] = false;+ continue;+ }++ // Handle --flag (boolean true)+ if (+ !arg.includes("=") &&+ (i === args.length - 1 || args[i + 1].startsWith("--"))+ ) {+ const key = toCamelCase(arg.slice(2));+ config[key] = true;+ continue;+ }++ // Handle --key=value or --key value+ let key: string;+ let value: string;++ if (arg.includes("=")) {+ [key, value] = arg.slice(2).split("=", 2);+ } else {+ key = arg.slice(2);+ value = args[++i];+ }++ // Convert kebab-case key to camelCase+ key = toCamelCase(key);++ // Handle nested properties (e.g. --minify.whitespace)+ if (key.includes(".")) {+ const [parentKey, childKey] = key.split(".");+ config[parentKey] = config[parentKey] || {};+ config[parentKey][childKey] = parseValue(value);+ } else {+ config[key] = parseValue(value);+ }+ }++ return config as Partial<BuildConfig>;+}++// Helper function to format file sizes+const formatFileSize = (bytes: number): string => {+ const units = ["B", "KB", "MB", "GB"];+ let size = bytes;+ let unitIndex = 0;++ while (size >= 1024 && unitIndex < units.length - 1) {+ size /= 1024;+ unitIndex++;+ }++ return `${size.toFixed(2)} ${units[unitIndex]}`;+};++console.log("\nπ Starting build process...\n");++// Parse CLI arguments with our magical parser+const cliConfig = parseArgs();+const outdir = cliConfig.outdir || path.join(process.cwd(), "dist");++if (existsSync(outdir)) {+ console.log(`ποΈ Cleaning previous build at ${outdir}`);+ await rm(outdir, { recursive: true, force: true });+}++const start = performance.now();++// Scan for all HTML files in the project+const entrypoints = [...new Bun.Glob("**.html").scanSync("src")]+ .map((a) => path.resolve("src", a))+ .filter((dir) => !dir.includes("node_modules"));+console.log(+ `π Found ${entrypoints.length} HTML ${+ entrypoints.length === 1 ? "file" : "files"+ } to process\n`+);++// Build all the HTML files+const result = await build({+ entrypoints,+ outdir,+ plugins: [plugin],+ minify: true,+ target: "browser",+ sourcemap: "linked",+ define: {+ "process.env.NODE_ENV": JSON.stringify("production"),+ },+ ...cliConfig, // Merge in any CLI-provided options+});++// Print the results+const end = performance.now();++const outputTable = result.outputs.map((output) => ({+ File: path.relative(process.cwd(), output.path),+ Type: output.kind,+ Size: formatFileSize(output.size),+}));++console.table(outputTable);+const buildTime = (end - start).toFixed(2);++console.log(`\nβ Build completed in ${buildTime}ms\n`);++const filesDir = path.join(process.cwd(), "files");++for await (const file of new Bun.Glob("chunk-*").scan(filesDir)) {+ await rm(path.join(filesDir, file));+}++const indexHtml = path.join(filesDir, "index.html");+if (existsSync(indexHtml)) {+ await rm(indexHtml);+}++const files = readdirSync(outdir);+for (const file of files) {+ cpSync(path.join(outdir, file), path.join(filesDir, file));+}++if (!Bun.env.AWS_ACCESS_KEY_ID || !Bun.env.AWS_ACCESS_SECRET_KEY) {+ console.log(+ "Skipping R2 upload: AWS_ACCESS_KEY_ID and AWS_ACCESS_SECRET_KEY are not set",+ );+} else {+ const client = new S3Client({+ accessKeyId: Bun.env.AWS_ACCESS_KEY_ID,+ secretAccessKey: Bun.env.AWS_ACCESS_SECRET_KEY,+ endpoint:+ "https://2fe488b3b0f4deee223aef7464784c46.r2.cloudflarestorage.com",+ bucket: "parser-media",+ });++ for (const file of readdirSync(filesDir)) {+ const exists = await client.exists(file);+ const fileToUpload = Bun.file(path.join(filesDir, file));+ if (exists) {+ const stat = await client.stat(file);+ if (stat.size === fileToUpload.size) {+ console.log(+ `Skipping ${file} because it already exists and is the same size`,+ );+ continue;+ }+ }++ await client.write(file, fileToUpload);+ console.log(`Uploaded ${file}`);+ }+}diff --git a/packages/remotion-media/bun-env.d.ts b/packages/remotion-media/bun-env.d.tsnew file mode 100644index 0000000000..72f1c26e61--- /dev/null+++ b/packages/remotion-media/bun-env.d.ts@@ -0,0 +1,17 @@+// Generated by `bun init`++declare module "*.svg" {+ /**+ * A path to the SVG file+ */+ const path: `${string}.svg`;+ export = path;+}++declare module "*.module.css" {+ /**+ * A record of class names to their corresponding CSS module classes+ */+ const classes: { readonly [key: string]: string };+ export = classes;+}diff --git a/packages/remotion-media/bunfig.toml b/packages/remotion-media/bunfig.tomlnew file mode 100644index 0000000000..8877354c1f--- /dev/null+++ b/packages/remotion-media/bunfig.toml@@ -0,0 +1,4 @@++[serve.static]+plugins = ["bun-plugin-tailwind"]+env = "BUN_PUBLIC_*"\ No newline at end of filediff --git a/packages/remotion-media/clean.ts b/packages/remotion-media/clean.tsnew file mode 100644index 0000000000..b5e977dc08--- /dev/null+++ b/packages/remotion-media/clean.ts@@ -0,0 +1,5 @@+import { $ } from "bun";++$`rm -rf files`;+$`rm -rf out`;+$`rm -rf dist`;diff --git a/packages/remotion-media/dialogue.wav b/packages/remotion-media/dialogue.wavnew file mode 100644index 0000000000..979505b41cBinary files /dev/null and b/packages/remotion-media/dialogue.wav differdiff --git a/packages/remotion-media/ding.wav b/packages/remotion-media/ding.wavnew file mode 100644index 0000000000..2e1b1d25cfBinary files /dev/null and b/packages/remotion-media/ding.wav differdiff --git a/packages/remotion-media/eslint.config.mjs b/packages/remotion-media/eslint.config.mjsnew file mode 100644index 0000000000..720d5858f9--- /dev/null+++ b/packages/remotion-media/eslint.config.mjs@@ -0,0 +1,10 @@+import {remotionFlatConfig} from '@remotion/eslint-config-internal';++const config = remotionFlatConfig({react: true});++export default [+ ...(Array.isArray(config) ? config : [config]),+ {+ ignores: ['src/compositions/**'],+ },+];diff --git a/packages/remotion-media/first-frame-at-4sec.webm b/packages/remotion-media/first-frame-at-4sec.webmnew file mode 100644index 0000000000..a1a9904c7fBinary files /dev/null and b/packages/remotion-media/first-frame-at-4sec.webm differdiff --git a/packages/remotion-media/generate.ts b/packages/remotion-media/generate.tsnew file mode 100644index 0000000000..6715040ef6--- /dev/null+++ b/packages/remotion-media/generate.ts@@ -0,0 +1,663 @@+import { copyFileSync, existsSync, mkdirSync } from "fs";+import { $ } from "bun";+import path from "path";++const audioCodecs = [+ "aac",+ "flac",+ "mp3",+ "opus",+ "vorbis",+ "pcm",+ "none",+] as const;++const videoCodecs = ["h264", "h265", "vp8", "vp9", "prores", "none"] as const;+const containers = ["mp4", "wav", "mp3", "flac", "webm", "mkv", "mov"] as const;+const categories = [+ "codecs",+ "dimensions",+ "durations",+ "fps",+ "audio",+ "sample-rates",+ "greenscreen",+ "edge-cases",+ "sound-effects",+ "hls",+] as const;++type Container = (typeof containers)[number];+type VideoCodec = (typeof videoCodecs)[number];+type AudioCodec = (typeof audioCodecs)[number];+type Category = (typeof categories)[number];++type VideoVariant = {+ videoCodec: VideoCodec;+ audioCodec: AudioCodec;+ container: Container | "m3u8";+ fileNames: string[];+ size: number;+ category: Category;+ attribution?: string;+};++const outDir = "files";++const canFitAudioCodecInContainer: {+ [key in Container]: { [key in AudioCodec]: boolean };+} = {+ mp4: {+ aac: true,+ flac: true,+ mp3: true,+ opus: false,+ vorbis: false,+ pcm: true,+ none: true,+ },+ wav: {+ aac: false,+ flac: false,+ mp3: false,+ opus: false,+ vorbis: false,+ pcm: true,+ none: false,+ },+ flac: {+ aac: false,+ flac: true,+ mp3: false,+ opus: false,+ vorbis: false,+ pcm: false,+ none: false,+ },+ webm: {+ aac: false,+ flac: false,+ mp3: false,+ opus: true,+ vorbis: true,+ pcm: false,+ none: true,+ },+ mp3: {+ aac: false,+ flac: false,+ mp3: true,+ opus: false,+ vorbis: false,+ pcm: false,+ none: false,+ },+ mkv: {+ aac: true,+ flac: true,+ mp3: true,+ opus: true,+ vorbis: true,+ pcm: false,+ none: true,+ },+ mov: {+ aac: true,+ flac: false,+ mp3: false,+ opus: false,+ vorbis: false,+ pcm: true,+ none: true,+ },+};++const canFitVideoCodecInContainer: {+ [key in Container]: { [key in VideoCodec]: boolean };+} = {+ mp4: {+ h264: true,+ h265: true,+ vp8: false,+ vp9: false,+ prores: false,+ none: false,+ },+ wav: {+ h264: false,+ h265: false,+ vp8: false,+ vp9: false,+ prores: false,+ none: true,+ },+ flac: {+ h264: false,+ h265: false,+ vp8: false,+ vp9: false,+ prores: false,+ none: true,+ },+ webm: {+ h264: false,+ h265: false,+ vp8: true,+ vp9: true,+ prores: false,+ none: false,+ },+ mp3: {+ h264: false,+ h265: false,+ vp8: false,+ vp9: false,+ prores: false,+ none: true,+ },+ mkv: {+ h264: true,+ h265: true,+ vp8: true,+ vp9: true,+ prores: true,+ none: false,+ },+ mov: {+ h264: true,+ h265: true,+ vp8: false,+ vp9: false,+ prores: true,+ none: false,+ },+};++const defaultVideoCodec: { [key in Container]: VideoCodec | null } = {+ mp4: "h264",+ wav: null,+ flac: null,+ webm: "vp8",+ mp3: null,+ mkv: "h264",+ mov: "h264",+};++const defaultAudioCodec: { [key in Container]: AudioCodec | null } = {+ mp4: "aac",+ wav: "pcm",+ flac: "flac",+ webm: null,+ mp3: "mp3",+ mkv: "aac",+ mov: "aac",+};++const isVideoContainer: { [key in Container]: boolean } = {+ mp4: true,+ wav: false,+ flac: false,+ webm: true,+ mp3: false,+ mkv: true,+ mov: true,+};++const videoEncoders: {+ [key in VideoCodec]: string | null;+} = {+ h264: "libx264",+ h265: "libx265",+ vp8: "libvpx",+ vp9: "libvpx-vp9",+ prores: "prores_ks",+ none: null,+};++const audioEncoders: {+ [key in AudioCodec]: string | null;+} = {+ aac: "aac",+ flac: "flac",+ mp3: "mp3",+ opus: "libopus",+ vorbis: "libvorbis",+ pcm: "pcm_s16le",+ none: null,+};++const extensions: {+ [key in Container]: string;+} = {+ flac: "flac",+ mp3: "mp3",+ mp4: "mp4",+ mkv: "mkv",+ webm: "webm",+ wav: "wav",+ mov: "mov",+};++const getOutputName = ({+ container,+ videoCodec,+ audioCodec,+ abbreviateDefaultVideoCodec,+ abbreviateDefaultAudioCodec,+}: {+ container: Container;+ videoCodec: VideoCodec;+ audioCodec: AudioCodec;+ abbreviateDefaultVideoCodec: boolean;+ abbreviateDefaultAudioCodec: boolean;+}) => {+ const isDefaultVideoCodec = defaultVideoCodec[container] === videoCodec;+ const isDefaultAudioCodec = defaultAudioCodec[container] === audioCodec;++ return [+ [+ isVideoContainer[container] ? "video" : "audio",+ isDefaultVideoCodec && abbreviateDefaultVideoCodec+ ? null+ : isVideoContainer[container]+ ? videoCodec+ : null,+ isDefaultAudioCodec && abbreviateDefaultAudioCodec ? null : audioCodec,+ ]+ .filter(Boolean)+ .join("-"),+ extensions[container],+ ].join(".");+};++const base8k = path.join("out", "8k.mp4");+const baseMute = path.join("out", "mute.mp4");++if (!(await Bun.file(base8k).exists())) {+ await $`bunx remotion render src/compositions/index.ts Base ${base8k} --frames=0-599 --scale=4 --muted`;+}++if (!(await Bun.file(baseMute).exists())) {+ await $`bunx remotion render src/compositions/index.ts Base ${baseMute} --muted`;+}++const variants: VideoVariant[] = [];++for (const container of containers) {+ for (const videoCodec of videoCodecs) {+ for (const audioCodec of audioCodecs) {+ if (!canFitAudioCodecInContainer[container][audioCodec]) {+ continue;+ }++ if (!canFitVideoCodecInContainer[container][videoCodec]) {+ continue;+ }++ const [outputName, ...alternativeNames] = [+ ...new Set([+ getOutputName({+ container,+ videoCodec,+ audioCodec,+ abbreviateDefaultAudioCodec: true,+ abbreviateDefaultVideoCodec: true,+ }),+ getOutputName({+ container,+ videoCodec,+ audioCodec,+ abbreviateDefaultAudioCodec: true,+ abbreviateDefaultVideoCodec: false,+ }),+ getOutputName({+ container,+ videoCodec,+ audioCodec,+ abbreviateDefaultAudioCodec: false,+ abbreviateDefaultVideoCodec: true,+ }),+ getOutputName({+ container,+ videoCodec,+ audioCodec,+ abbreviateDefaultAudioCodec: false,+ abbreviateDefaultVideoCodec: false,+ }),+ ]),+ ];++ if (!existsSync(outDir)) {+ mkdirSync(outDir, { recursive: true });+ }++ if (!(await Bun.file(path.join(outDir, outputName)).exists())) {+ console.log(`Generating ${outputName}`);++ const videoEncoder = videoEncoders[videoCodec];+ const audioEncoder = audioEncoders[audioCodec];++ // 10 second video+ await $`ffmpeg ${videoEncoder ? "-i" : ""} ${+ videoEncoder ? baseMute : ""+ } ${audioEncoder ? "-i" : ""} ${+ audioEncoder ? "tone.wav" : ""+ } -t 10 -c:v ${videoEncoder} -c:a ${audioEncoder} ${path.join(+ outDir,+ outputName+ )} -y`;+ }++ for (const alternativeName of alternativeNames) {+ copyFileSync(+ path.join(outDir, outputName),+ path.join(outDir, alternativeName)+ );+ }++ const size = await Bun.file(path.join(outDir, outputName)).stat();++ const videoVariant: VideoVariant = {+ videoCodec,+ audioCodec,+ container,+ fileNames: [outputName, ...alternativeNames],+ size: size.size,+ category: "codecs",+ };+ variants.push(videoVariant);+ }+ }+}++// Generate additional size variants (16:9) from out/8k.mp4 using H.264/AAC MP4+const sizePresets = [+ { width: 640, height: 360, label: "360p" },+ { width: 854, height: 480, label: "480p" },+ { width: 1280, height: 720, label: "720p" },+ { width: 1920, height: 1080, label: "1080p" },+ { width: 2560, height: 1440, label: "1440p" },+ { width: 3840, height: 2160, label: "2160p" },+] as const;++for (const preset of sizePresets) {+ const outputName = `video-${preset.label}.mp4`;+ const targetPath = path.join(outDir, outputName);++ if (!(await Bun.file(targetPath).exists())) {+ console.log(`Generating ${outputName} from ${base8k}`);+ await $`ffmpeg -i ${base8k} -i tone.wav -vf scale=${preset.width}:${preset.height} -c:v libx264 -c:a aac ${targetPath} -y`;+ }++ const stat = await Bun.file(targetPath).stat();+ const videoVariant: VideoVariant = {+ videoCodec: "h264",+ audioCodec: "aac",+ container: "mp4",+ fileNames: [outputName],+ size: stat.size,+ category: "dimensions",+ };+ variants.push(videoVariant);+}++// Generate duration variants (use BaseMute as the video reference), H.264/AAC MP4+const durationBaseVideoPath = "out/mute.mp4";+const durationPresets = [+ { seconds: 5, label: "5s" },+ { seconds: 10, label: "10s" },+ { seconds: 30, label: "30s" },+ { seconds: 60, label: "1m" },+ { seconds: 60 * 5, label: "5m" },+ { seconds: 60 * 10, label: "10m" },+ { seconds: 60 * 30, label: "30m" },+] as const;++for (const preset of durationPresets) {+ const outputName = `video-${preset.label}.mp4`;+ const targetPath = path.join(outDir, outputName);++ if (!(await Bun.file(targetPath).exists())) {+ console.log(`Generating ${outputName} from ${durationBaseVideoPath}`);+ await $`ffmpeg -i ${durationBaseVideoPath} -i tone.wav -t ${preset.seconds} -c:v copy -c:a aac ${targetPath} -y`;+ }++ const stat = await Bun.file(targetPath).stat();+ const videoVariant: VideoVariant = {+ videoCodec: "h264",+ audioCodec: "aac",+ container: "mp4",+ fileNames: [outputName],+ size: stat.size,+ category: "durations",+ };+ variants.push(videoVariant);+}++const fpsPresets = [+ { fps: 24, label: "24fps" },+ { fps: 25, label: "25fps" },+ { fps: 29.97, label: "29.97fps" },+ { fps: 30, label: "30fps" },+ { fps: 59.94, label: "59.94fps" },+ { fps: 60, label: "60fps" },+ { fps: 120, label: "120fps" },+ { fps: 240, label: "240fps" },+] as const;++for (const preset of fpsPresets) {+ const outputName = `video-${preset.label}.mp4`;+ const targetPath = path.join(outDir, outputName);++ if (!(await Bun.file(targetPath).exists())) {+ console.log(`Generating ${outputName}`);+ const intermediate = path.join("out", `${preset.label}.mp4`);+ if (!(await Bun.file(intermediate).exists())) {+ await $`bunx remotion render src/compositions/index.ts Base --props="{\"fps\": ${+ preset.fps+ }}" --frames=0-${Math.round(+ preset.fps * 10 - 1+ )} --muted=true ${intermediate}`;+ }+ await $`ffmpeg -i ${intermediate} -i tone.wav -t 10 -c:v copy -c:a aac ${targetPath} -y`;+ }++ const stat = await Bun.file(targetPath).stat();+ variants.push({+ videoCodec: "h264",+ audioCodec: "aac",+ container: "mp4",+ fileNames: [outputName],+ size: stat.size,+ category: "fps",+ });+}++copyFileSync("dialogue.wav", path.join(outDir, "dialogue.wav"));+variants.push({+ videoCodec: "none",+ audioCodec: "pcm",+ container: "wav",+ fileNames: ["dialogue.wav"],+ size: Bun.file(path.join(outDir, "dialogue.wav")).size,+ category: "audio",+});++variants.push({+ videoCodec: "h264",+ audioCodec: "pcm",+ container: "mov",+ fileNames: ["multiple-audio-streams.mov"],+ size: 66906020,+ category: "audio",+});++// Generate PCM WAV sine tone files at various sample rates+const pcmSampleRates = [+ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000,+ 176400, 192000,+] as const;++for (const sr of pcmSampleRates) {+ const outputName = `audio-${sr}hz.wav`;+ const targetPath = path.join(outDir, outputName);+ if (!(await Bun.file(targetPath).exists())) {+ console.log(`Generating ${outputName} (sine 1kHz, 10s, pcm_s16le)`);+ await $`ffmpeg -f lavfi -i ${`sine=frequency=1000:sample_rate=${sr}:duration=10`} -c:a pcm_s16le -ar ${sr} ${targetPath} -y`;+ }+ const stat = await Bun.file(targetPath).stat();+ variants.push({+ videoCodec: "none",+ audioCodec: "pcm",+ container: "wav",+ fileNames: [outputName],+ size: stat.size,+ category: "sample-rates",+ });+}++copyFileSync("greenscreen.mp4", path.join(outDir, "greenscreen.mp4"));+variants.push({+ videoCodec: "h264",+ audioCodec: "aac",+ container: "mp4",+ fileNames: ["greenscreen.mp4"],+ size: Bun.file(path.join(outDir, "greenscreen.mp4")).size,+ category: "greenscreen",+});++copyFileSync(+ "first-frame-at-4sec.webm",+ path.join(outDir, "first-frame-at-4sec.webm")+);+variants.push({+ videoCodec: "vp9",+ audioCodec: "opus",+ container: "webm",+ fileNames: ["first-frame-at-4sec.webm"],+ size: Bun.file(path.join(outDir, "first-frame-at-4sec.webm")).size,+ category: "edge-cases",+});++// Sound effects (pre-existing files, CC0 licensed)+const soundEffects = [+ {+ fileName: "whoosh.wav",+ attribution:+ "Woosh by 1bob -- https://freesound.org/s/831936/ -- License: Creative Commons 0",+ },+ {+ fileName: "whip.wav",+ attribution:+ "SWSH_Badminton Racquet_Recording_01_JW Audio by JW_Audio -- https://freesound.org/s/838766/ -- License: Creative Commons 0",+ },+ {+ fileName: "page-turn.wav",+ attribution:+ "Draw Knife 1 by kenney.nl -- https://kenney.nl -- License: Creative Commons 0",+ },+ {+ fileName: "switch.wav",+ attribution:+ "UI Audio - Switch 35 by kenney.nl -- https://kenney.nl -- License: Creative Commons 0",+ },+ {+ fileName: "mouse-click.wav",+ attribution:+ "Mouse Click Sound.mp3 by Pixeliota -- https://freesound.org/s/678248/ -- License: Creative Commons 0",+ },+ {+ fileName: "shutter-modern.wav",+ attribution:+ "DSLR Shutter fast 006.wav by ristooooo1 -- https://freesound.org/s/539136/ -- License: Creative Commons 0",+ },+ {+ fileName: "shutter-old.wav",+ attribution:+ "Werra.wav by hmilleo -- https://freesound.org/s/409093/ -- License: Creative Commons 0",+ },+ {+ fileName: "bruh.wav",+ attribution:+ "Bruh Sound Effect -- https://soundeffects.fandom.com/wiki/Bruh_Sound_Effect",+ },+ {+ fileName: "windows-xp-error.wav",+ attribution:+ "Windows XP Error -- https://www.myinstants.com/en/instant/windows-xp-error/",+ },+ {+ fileName: "vine-boom.wav",+ attribution:+ "Vine Boom Sound -- https://www.myinstants.com/en/instant/vine-boom-sound-70972/",+ },+ {+ fileName: "ding.wav",+ attribution:+ "Ding Sound Effect -- https://www.myinstants.com/en/instant/ding-sound-effect/",+ },+];++for (const sfx of soundEffects) {+ copyFileSync(sfx.fileName, path.join(outDir, sfx.fileName));+ const stat = await Bun.file(path.join(outDir, sfx.fileName)).stat();+ variants.push({+ videoCodec: "none",+ audioCodec: "pcm",+ container: "wav",+ fileNames: [sfx.fileName],+ size: stat.size,+ category: "sound-effects",+ attribution: sfx.attribution,+ });+}++// Generate HLS (m3u8) variants β H.264/AAC with both MPEG-TS and fMP4 segments+const hlsPresets = [+ { label: "ts", segmentType: "mpegts", segmentExt: "ts" },+ { label: "fmp4", segmentType: "fmp4", segmentExt: "m4s" },+] as const;++for (const preset of hlsPresets) {+ const outputName = `hls-${preset.label}.m3u8`;+ const targetPath = path.join(outDir, outputName);+ const segmentPattern = path.join(+ outDir,+ `hls-${preset.label}-%d.${preset.segmentExt}`+ );+ const initFilename = `hls-${preset.label}-init.mp4`;++ if (!(await Bun.file(targetPath).exists())) {+ console.log(`Generating ${outputName}`);+ if (preset.segmentType === "fmp4") {+ await $`ffmpeg -i ${baseMute} -i tone.wav -t 10 -c:v libx264 -c:a aac -hls_time 2 -hls_playlist_type vod -hls_segment_type fmp4 -hls_fmp4_init_filename ${initFilename} -hls_segment_filename ${segmentPattern} ${targetPath} -y`;+ } else {+ await $`ffmpeg -i ${baseMute} -i tone.wav -t 10 -c:v libx264 -c:a aac -hls_time 2 -hls_playlist_type vod -hls_segment_type mpegts -hls_segment_filename ${segmentPattern} ${targetPath} -y`;+ }+ }++ const segmentFiles: string[] = [];+ for await (const segFile of new Bun.Glob(+ `hls-${preset.label}-*.${preset.segmentExt}`+ ).scan(outDir)) {+ segmentFiles.push(segFile);+ }+ if (+ preset.segmentType === "fmp4" &&+ (await Bun.file(path.join(outDir, initFilename)).exists())+ ) {+ segmentFiles.push(initFilename);+ }++ const stat = await Bun.file(targetPath).stat();+ variants.push({+ videoCodec: "h264",+ audioCodec: "aac",+ container: "m3u8",+ fileNames: [outputName, ...segmentFiles.sort()],+ size: stat.size,+ category: "hls",+ });+}++await Bun.write("variants.json", JSON.stringify(variants, null, 2));diff --git a/packages/remotion-media/greenscreen.mp4 b/packages/remotion-media/greenscreen.mp4new file mode 100644index 0000000000..248061b3f6Binary files /dev/null and b/packages/remotion-media/greenscreen.mp4 differdiff --git a/packages/remotion-media/ideas.txt b/packages/remotion-media/ideas.txtnew file mode 100644index 0000000000..a9233e99d7--- /dev/null+++ b/packages/remotion-media/ideas.txt@@ -0,0 +1,6 @@+- different frame rates 15fps, 60fps, 120 fps, 240fps+- different lengths+- HDR videos+- no CORS+- different audio channel layouts+- different sample rates\ No newline at end of filediff --git a/packages/remotion-media/mouse-click.wav b/packages/remotion-media/mouse-click.wavnew file mode 100644index 0000000000..b500ed0a28Binary files /dev/null and b/packages/remotion-media/mouse-click.wav differdiff --git a/packages/remotion-media/package.json b/packages/remotion-media/package.jsonnew file mode 100644index 0000000000..37a7b4941a--- /dev/null+++ b/packages/remotion-media/package.json@@ -0,0 +1,40 @@+{+ "name": "@remotion/remotion-media",+ "version": "4.0.463",+ "private": true,+ "type": "module",+ "repository": {+ "url": "https://github.com/remotion-dev/remotion/tree/main/packages/remotion-media"+ },+ "scripts": {+ "dev": "bun --hot src/index.tsx",+ "start": "NODE_ENV=production bun src/index.tsx",+ "build": "bun generate.ts && bun run build.ts",+ "generate": "bun generate.ts",+ "bundle": "bun run build.ts",+ "clean": "bun clean.ts",+ "lint": "eslint src && tsc",+ "formatting": "prettier src --check"+ },+ "dependencies": {+ "@remotion/cli": "workspace:*",+ "@remotion/media": "workspace:*",+ "@remotion/paths": "workspace:*",+ "@remotion/shapes": "workspace:*",+ "@remotion/studio": "workspace:*",+ "bun-plugin-tailwind": "0.1.2",+ "react": "catalog:",+ "react-dom": "catalog:",+ "remotion": "workspace:*",+ "tailwindcss": "4.2.0"+ },+ "devDependencies": {+ "@remotion/eslint-config-internal": "workspace:*",+ "@types/bun": "catalog:",+ "@types/react": "catalog:",+ "@types/react-dom": "catalog:",+ "@typescript/native-preview": "catalog:",+ "eslint": "catalog:",+ "prettier": "catalog:"+ }+}diff --git a/packages/remotion-media/page-turn.wav b/packages/remotion-media/page-turn.wavnew file mode 100644index 0000000000..bdb5979139Binary files /dev/null and b/packages/remotion-media/page-turn.wav differdiff --git a/packages/remotion-media/public/gt-planar-black.woff2 b/packages/remotion-media/public/gt-planar-black.woff2new file mode 100644index 0000000000..0696ffdd7cBinary files /dev/null and b/packages/remotion-media/public/gt-planar-black.woff2 differdiff --git a/packages/remotion-media/public/gt-planar-bold.woff2 b/packages/remotion-media/public/gt-planar-bold.woff2new file mode 100644index 0000000000..a6688fcfb8Binary files /dev/null and b/packages/remotion-media/public/gt-planar-bold.woff2 differdiff --git a/packages/remotion-media/public/gt-planar-medium.woff2 b/packages/remotion-media/public/gt-planar-medium.woff2new file mode 100644index 0000000000..10e1e5a042Binary files /dev/null and b/packages/remotion-media/public/gt-planar-medium.woff2 differdiff --git a/packages/remotion-media/public/gt-planar-regular.woff2 b/packages/remotion-media/public/gt-planar-regular.woff2new file mode 100644index 0000000000..29ad899a66Binary files /dev/null and b/packages/remotion-media/public/gt-planar-regular.woff2 differdiff --git a/packages/remotion-media/public/tone-1k-60s.wav b/packages/remotion-media/public/tone-1k-60s.wavnew file mode 100644index 0000000000..52824f5004Binary files /dev/null and b/packages/remotion-media/public/tone-1k-60s.wav differdiff --git a/packages/remotion-media/shutter-modern.wav b/packages/remotion-media/shutter-modern.wavnew file mode 100644index 0000000000..7b20a24cefBinary files /dev/null and b/packages/remotion-media/shutter-modern.wav differdiff --git a/packages/remotion-media/shutter-old.wav b/packages/remotion-media/shutter-old.wavnew file mode 100644index 0000000000..59e87ec4c1Binary files /dev/null and b/packages/remotion-media/shutter-old.wav differdiff --git a/packages/remotion-media/src/App.tsx b/packages/remotion-media/src/App.tsxnew file mode 100644index 0000000000..4377852566--- /dev/null+++ b/packages/remotion-media/src/App.tsx@@ -0,0 +1,260 @@+import React, {useEffect, useState} from 'react';+import variants from '../variants.json';+import './index.css';++const CopyLink = ({href}: {readonly href: string}) => {+ const [copied, setCopied] = React.useState(false);++ const handleCopy = () => {+ navigator.clipboard.writeText(href);+ setCopied(true);+ setTimeout(() => {+ setCopied(false);+ }, 1000);+ };++ return (+ <span+ onClick={handleCopy}+ className=" text-sm hover:text-blue-500 cursor-pointer"+ >+ {copied ? 'Copied' : 'Copy link'}+ </span>+ );+};++const VideoVariant = ({+ variant,+}: {+ readonly variant: (typeof variants)[number];+}) => {+ return (+ <div className="bg-white p-2 mb-2 border-2 border-b-4 rounded-md">+ <a+ href={`/${variant.fileNames[0]}`}+ className="leading-tight hover:text-blue-500"+ >+ <strong className="mr-2 inline-block font-brand">+ {variant.fileNames[0]}+ </strong>+ </a>+ <div className="flex-1" />+ <div className="text-neutral-500 text-sm font-brand">+ {variant.size < 1024 * 1024+ ? `${(variant.size / 1024).toFixed(0)} KB`+ : `${(variant.size / 1024 / 1024).toFixed(1)} MB`}{' '}+ {' β '}+ {variant.container.toUpperCase()}+ {' β '}+ {variant.videoCodec === 'none'+ ? 'No video'+ : variant.videoCodec.toUpperCase()}+ {' β '}+ {variant.audioCodec === 'none'+ ? 'No audio'+ : variant.audioCodec.toUpperCase()}+ {' β '}+ <CopyLink href={`https://remotion.media/${variant.fileNames[0]}`} />+ {' β '}+ <a+ href={`/${variant.fileNames[0]}`}+ download={variant.fileNames[0]}+ className=" text-sm hover:text-blue-500 cursor-pointer"+ >+ Download+ </a>+ {' β '}+ <a+ href={`https://remotion.dev/convert?url=${encodeURIComponent(+ `https://remotion.media/${variant.fileNames[0]}`,+ )}`}+ download={variant.fileNames[0]}+ className=" text-sm hover:text-blue-500 cursor-pointer"+ >+ Probe+ </a>+ </div>+ {variant.fileNames.length > 1 && (+ <div className="text-neutral-500 text-sm font-brand">+ <span>Aliases: </span>+ {variant.fileNames.slice(1).map((fileName) => (+ <span key={fileName} className="mr-2">+ {fileName}+ </span>+ ))}+ </div>+ )}+ </div>+ );+};++const categoryLabelMap: Record<string, string> = {+ codecs: 'Codecs',+ dimensions: 'Dimensions',+ durations: 'Durations',+ audio: 'Audio',+ fps: 'FPS',+ 'sample-rates': 'Sample Rates',+ greenscreen: 'Green Screen',+ 'edge-cases': 'Edge Cases',+ 'sound-effects': 'Sound Effects',+};++const getCategoryLabel = (category: string) =>+ categoryLabelMap[category] ?? category;++const CategoryGroup = ({+ category,+ variants: v,+}: {+ readonly category: string;+ readonly variants: (typeof variants)[number][];+}) => {+ return (+ <div id={`category-${category}`} className="scroll-mt-4">+ <h3 className="text-lg font-bold mt-5 mb-4 font-brand">+ {getCategoryLabel(category)}+ </h3>+ {v.map((variant) => (+ <VideoVariant key={variant.fileNames[0]} variant={variant} />+ ))}+ </div>+ );+};++const groups = variants.reduce(+ (acc, variant) => {+ acc[variant.category] = acc[variant.category] || [];+ acc[variant.category].push(variant);+ return acc;+ },+ {} as Record<string, (typeof variants)[number][]>,+);++const categoryKeys = Object.keys(groups);++const Sidebar = ({+ activeCategory,+ showBackToTop,+}: {+ readonly activeCategory: string | null;+ readonly showBackToTop: boolean;+}) => {+ return (+ <nav className="hidden lg:block sticky top-4 self-start w-48 shrink-0 pt-6">+ <ul className="flex flex-col gap-1">+ {categoryKeys.map((category) => (+ <li key={category}>+ <a+ href={`#category-${category}`}+ className={`block px-3 py-1.5 rounded-md text-sm font-brand transition-colors ${+ activeCategory === category+ ? 'bg-blue-100 text-blue-700 font-semibold'+ : 'text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900'+ }`}+ >+ {getCategoryLabel(category)}+ </a>+ </li>+ ))}+ {showBackToTop && (+ <li className="mt-2 pt-2 border-t border-neutral-200">+ <a+ href="#"+ onClick={(e) => {+ e.preventDefault();+ window.scrollTo({top: 0});+ }}+ className="block px-3 py-1.5 rounded-md text-sm font-brand text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900 transition-colors"+ >+ Back to top+ </a>+ </li>+ )}+ </ul>+ </nav>+ );+};++export function App() {+ const [activeCategory, setActiveCategory] = useState<string | null>(null);+ const [showBackToTop, setShowBackToTop] = useState(false);++ useEffect(() => {+ const handleScroll = () => {+ setShowBackToTop(window.scrollY > 500);+ };++ window.addEventListener('scroll', handleScroll, {passive: true});+ return () => window.removeEventListener('scroll', handleScroll);+ }, []);++ useEffect(() => {+ const observers: IntersectionObserver[] = [];+ const visibleCategories = new Set<string>();++ for (const category of categoryKeys) {+ const el = document.getElementById(`category-${category}`);+ if (!el) continue;++ const observer = new IntersectionObserver(+ ([entry]) => {+ if (entry.isIntersecting) {+ visibleCategories.add(category);+ } else {+ visibleCategories.delete(category);+ }++ // Pick the first visible category in document order+ for (const key of categoryKeys) {+ if (visibleCategories.has(key)) {+ setActiveCategory(key);+ return;+ }+ }+ },+ {rootMargin: '-10% 0px -80% 0px'},+ );+ observer.observe(el);+ observers.push(observer);+ }++ return () => {+ for (const observer of observers) observer.disconnect();+ };+ }, []);++ return (+ <div className="max-w-[960px] w-full m-auto mt-4 px-4 mb-20">+ <h2 className="text-2xl font-bold mt-10 mb-2 font-brand">+ Audio and video files for testing+ </h2>+ <p className="text-neutral-500 font-brand mt-1 mb-8">+ All files are available on{' '}+ <code className="font-brand text-brand">remotion.media/[filename]</code>+ .+ <br />+ Hosted on Cloudflare R2 Free Tier, allowing for theoretically unlimited+ bandwidth. <br />+ Files may be used royalty-free and without attribution.+ </p>+ <div className="flex gap-8 items-start">+ <Sidebar+ activeCategory={activeCategory}+ showBackToTop={showBackToTop}+ />+ <div className="flex-1 min-w-0">+ {Object.entries(groups).map(([category, categoryVariants]) => (+ <CategoryGroup+ key={category}+ category={category}+ variants={categoryVariants}+ />+ ))}+ </div>+ </div>+ </div>+ );+}++export default App;diff --git a/packages/remotion-media/src/compositions/3d-svg.ts b/packages/remotion-media/src/compositions/3d-svg.tsnew file mode 100644index 0000000000..0aa9bc893e--- /dev/null+++ b/packages/remotion-media/src/compositions/3d-svg.ts@@ -0,0 +1,59 @@+import type {Vector4D} from './matrix';++export type ThreeDReducedInstruction =+ | {+ type: 'M';+ point: Vector4D;+ }+ | {+ type: 'L';+ point: Vector4D;+ }+ | {+ type: 'C';+ cp1: Vector4D;+ cp2: Vector4D;+ point: Vector4D;+ }+ | {+ type: 'Q';+ cp: Vector4D;+ point: Vector4D;+ }+ | {+ type: 'Z';+ point: Vector4D;+ };++const serializeThreeDReducedInstruction = (+ instruction: ThreeDReducedInstruction,+): string => {+ if (instruction.type === 'M') {+ return `M ${instruction.point[0]} ${instruction.point[1]}`;+ }++ if (instruction.type === 'L') {+ return `L ${instruction.point[0]} ${instruction.point[1]}`;+ }++ if (instruction.type === 'C') {+ return `C ${instruction.cp1[0]} ${instruction.cp1[1]} ${instruction.cp2[0]} ${instruction.cp2[1]} ${instruction.point[0]} ${instruction.point[1]}`;+ }++ if (instruction.type === 'Q') {+ return `Q ${instruction.cp[0]} ${instruction.cp[1]} ${instruction.point[0]} ${instruction.point[1]}`;+ }++ if (instruction.type === 'Z') {+ return 'Z';+ }++ throw new Error('Unknown instruction type');+};++export const threeDIntoSvgPath = (+ instructions: ThreeDReducedInstruction[],+): string =>+ instructions+ .map((instruction) => serializeThreeDReducedInstruction(instruction))+ .join(' ');diff --git a/packages/remotion-media/src/compositions/ColorBars.tsx b/packages/remotion-media/src/compositions/ColorBars.tsxnew file mode 100644index 0000000000..6ac43178ce--- /dev/null+++ b/packages/remotion-media/src/compositions/ColorBars.tsx@@ -0,0 +1,30 @@+export const ColorBars = () => {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 672 504"+ style={{+ width: '100%',+ height: '100%',+ }}+ preserveAspectRatio="none"+ >+ <path fill="#131313" d="M0 0h672v504H0z" />+ <path fill="silver" d="M0 0h96v336H0z" />+ <path fill="#c0c000" d="M96 0v336h96V0z" />+ <path fill="#00c0c0" d="M192 0v336h96V0z" />+ <path fill="#00c000" d="M288 0v336h96V0z" />+ <path fill="#c000c0" d="M384 0v336h96V0z" />+ <path fill="#c00000" d="M480 0v336h96V0z" />+ <path fill="#0000c0" d="M576 0v336h96V0zM0 336h96v42H0z" />+ <path fill="#c000c0" d="M192 336h96v42H192z" />+ <path fill="#00c0c0" d="M384 336h96v42H384z" />+ <path fill="silver" d="M576 336h96v42H576z" />+ <path fill="#00214c" d="M0 378h120v126H0z" />+ <path fill="#fff" d="M120 378h120v126H120z" />+ <path fill="#32006a" d="M240 378h120v126H240z" />+ <path fill="#090909" d="M480 378h32v126H480z" />+ <path fill="#1d1d1d" d="M544 378h32v126H544z" />+ </svg>+ );+};diff --git a/packages/remotion-media/src/compositions/Face.tsx b/packages/remotion-media/src/compositions/Face.tsxnew file mode 100644index 0000000000..ae91a565e4--- /dev/null+++ b/packages/remotion-media/src/compositions/Face.tsx@@ -0,0 +1,59 @@+import React, {useState} from 'react';+import {random} from 'remotion';+import type {ThreeDReducedInstruction} from './3d-svg';+import {threeDIntoSvgPath} from './3d-svg';++export type FaceSVGProps = {+ readonly strokeLinecap?: React.SVGAttributes<SVGPathElement>['strokeLinecap'];+ readonly strokeMiterlimit?: React.SVGAttributes<SVGPathElement>['strokeMiterlimit'];+};++export const Face: React.FC<+ {+ readonly points: ThreeDReducedInstruction[];+ readonly color: string;+ readonly strokeColor: string;+ readonly strokeWidth: number;+ readonly crispEdges: boolean;+ } & FaceSVGProps+> = ({+ color,+ points,+ strokeColor,+ strokeWidth,+ strokeMiterlimit,+ strokeLinecap,+ crispEdges,+}) => {+ const [id] = useState(() => random(null).toString().replace('.', ''));+ const d = threeDIntoSvgPath(points);++ return (+ <>+ <defs>+ {strokeWidth ? (+ <mask id={id}>+ <path+ strokeLinecap={strokeLinecap}+ shapeRendering={crispEdges ? 'crispEdges' : undefined}+ strokeMiterlimit={strokeMiterlimit}+ strokeWidth={strokeWidth}+ d={d}+ fill="white"+ />+ </mask>+ ) : null}+ </defs>+ <path+ d={d}+ fill={color}+ mask={strokeWidth ? `url(#${id})` : undefined}+ stroke={strokeColor}+ strokeMiterlimit={strokeMiterlimit}+ shapeRendering={crispEdges ? 'crispEdges' : undefined}+ strokeLinecap={strokeLinecap}+ strokeWidth={strokeWidth}+ />+ </>+ );+};diff --git a/packages/remotion-media/src/compositions/Faces.tsx b/packages/remotion-media/src/compositions/Faces.tsxnew file mode 100644index 0000000000..4fc2bf1216--- /dev/null+++ b/packages/remotion-media/src/compositions/Faces.tsx@@ -0,0 +1,52 @@+import React from 'react';+import type {ThreeDElement} from './element';+import type {FaceSVGProps} from './Face';+import {Face} from './Face';+import type {FaceType} from './map-face';++const sortFacesZIndex = (face: FaceType[]): FaceType[] => {+ return face.slice().sort((a, b) => {+ return b.centerPoint[2] - a.centerPoint[2];+ });+};++export const Faces: React.FC<+ {+ readonly elements: ThreeDElement[];+ readonly noSort?: boolean;+ } & FaceSVGProps+> = ({elements, noSort, ...svgProps}) => {+ const sortedElement = noSort+ ? elements+ : elements.sort((a, b) => {+ return b.centerPoint[2] - a.centerPoint[2];+ });++ return (+ <>+ {sortedElement.map((element, i) => {+ const sortedFaces = sortFacesZIndex(element.faces);++ return (+ <React.Fragment key={i}>+ {sortedFaces.map(+ ({points, color, strokeWidth, strokeColor, crispEdges}, i) => {+ return (+ <Face+ key={JSON.stringify(points) + i}+ strokeColor={strokeColor}+ color={color}+ points={points}+ strokeWidth={strokeWidth}+ crispEdges={crispEdges}+ {...svgProps}+ />+ );+ },+ )}+ </React.Fragment>+ );+ })}+ </>+ );+};diff --git a/packages/remotion-media/src/compositions/FrameCounter.tsx b/packages/remotion-media/src/compositions/FrameCounter.tsxnew file mode 100644index 0000000000..3a3bbf65da--- /dev/null+++ b/packages/remotion-media/src/compositions/FrameCounter.tsx@@ -0,0 +1,91 @@+import {useMemo} from 'react';+import {AbsoluteFill, useCurrentFrame, useVideoConfig} from 'remotion';++/*++the timecode hh:mm:ss:ff is common in video editors, where ff is frames.+how does this work when the fps is 29.97++## How 29.97 fps timecode works (drop-frame vs non-drop-frame)++In video, a timecode like hh:mm:ss:ff expresses hours, minutes, seconds, and frames. At an integer frame rate (e.g., 24, 25, 30 fps), each second has exactly that many frames, so timecode matches real clock time.++With NTSC color video, the actual frame rate is approximately 29.97 fps, i.e. precisely 30/1.001 β 29.97002997β¦ fps. If you count frames as if it were exactly 30 fps, your timecode will drift ahead of real time by about 3.6 seconds per hour.++To solve this, the industry uses two schemes:++- Non-drop-frame (NDF): Count every frame sequentially as if it were 30 fps. Simple, but the timecode does not match real-time clock. It runs fast by ~3.6 s/hour.+- Drop-frame (DF): Adjust the numbering to keep timecode aligned with real time. No video frames are actually removed; only some timecode numbers are skipped.++### Drop-frame timecode rules (for 29.97 fps)++- The timecode numbering skips frame numbers at the start of most minutes to correct the 0.1% rate difference.+- Specifically, you skip frame numbers 00 and 01 at the start of every minute, except every 10th minute.+- In other words, in DF mode you do not use:+ - mm:00:00 and mm:00:01 at the start of minutes where mm β {01, 02, 03, 04, 06, 07, 08, 09} (and similarly for 11β19, 21β29, β¦, 51β59).+ - You do use all frame numbers at minutes 00, 10, 20, 30, 40, 50.+- This drops 2 timecode numbers per minute Γ 9 minutes every 10-minute block = 18 numbers per 10 minutes.+- Over one hour, that totals 108 timecode numbers skipped. At nominal 30 fps numbering, thatβs 108/30 = 3.6 seconds worth of numbering, which cancels the 29.97 vs 30 drift. Thus DF timecode stays aligned to wall-clock time.++### Practical implications++- FF range: At 29.97, editors still display frames 00β29 per second in both DF and NDF modes; the difference is only which frame numbers exist at specific minute boundaries in DF.+- Display: DF timecode is usually marked with a semicolon or period before frames, e.g. hh:mm:ss;ff (or hh:mm:ss.ff). NDF typically uses a colon hh:mm:ss:ff.+- Broadcast/delivery: Use drop-frame for North American NTSC-derived systems (59.94i/29.97p/23.976p with 29.97-based timelines) if you need timecode to match real time (e.g., schedules, captions, broadcast logs).+- Creative/post: Non-drop-frame may be fine within post workflows if absolute clock matching isnβt required, but be aware of the drift.++### Quick examples++- In DF, after 00:00:59:29 comes 00:01:00:02 (00 and 01 are skipped).+- At 00:10:59:29, the next is 00:11:00:00 (no skip at the 10th minute).+- At exactly 01:00:00;00 DF timecode, the real elapsed wall time is exactly one hour; in NDF 01:00:00:00, real time is about 59:56.4.+++*/++export const FrameCounter = () => {+ const frame = useCurrentFrame();+ const {fps: fractionalFps} = useVideoConfig();+ const fps = Math.round(fractionalFps);++ const timestamp = useMemo(() => {+ const minutes = Math.floor(frame / (60 * fps));+ const seconds = Math.floor((frame % (60 * fps)) / fps);+ const frames = frame % fps;+ return `${minutes.toString().padStart(2, '0')}:${seconds+ .toString()+ .padStart(2, '0')}:${frames.toString().padStart(2, '0')}`;+ }, [frame, fps]);++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ fontSize: 200,+ fontWeight: '600',+ color: 'white',+ fontFamily: 'GT Planar',+ fontFeatureSettings: "'ss03' on",+ fontVariantNumeric: 'tabular-nums',+ padding: 100,+ }}+ >+ <div+ style={{+ backgroundColor: 'rgba(0, 0, 0, 0.7)',+ paddingLeft: 40,+ paddingRight: 40,+ paddingTop: 30,+ paddingBottom: 30,+ display: 'flex',+ flexDirection: 'column',+ width: 1600,+ }}+ >+ <div style={{fontSize: 400}}>{frame}</div>+ <div>{timestamp}</div>+ </div>+ </AbsoluteFill>+ );+};diff --git a/packages/remotion-media/src/compositions/Root.tsx b/packages/remotion-media/src/compositions/Root.tsxnew file mode 100644index 0000000000..029ed52e3c--- /dev/null+++ b/packages/remotion-media/src/compositions/Root.tsx@@ -0,0 +1,30 @@+import {Composition} from 'remotion';+import {Spiral} from './Spiral';+import {Tone} from './Tone';++export const Root = () => {+ return (+ <>+ <Composition+ id="Base"+ component={Spiral}+ durationInFrames={30 * 30 * 60}+ width={1920}+ height={1080}+ calculateMetadata={({props}) => {+ return {+ fps: (props.fps as number) ?? 30,+ };+ }}+ />+ <Composition+ id="Tone"+ component={Tone}+ durationInFrames={30 * 30 * 60}+ fps={30}+ width={1920}+ height={1080}+ />+ </>+ );+};diff --git a/packages/remotion-media/src/compositions/Spiral.tsx b/packages/remotion-media/src/compositions/Spiral.tsxnew file mode 100644index 0000000000..c421130d3c--- /dev/null+++ b/packages/remotion-media/src/compositions/Spiral.tsx@@ -0,0 +1,91 @@+import {parsePath, resetPath} from '@remotion/paths';+import {makeTriangle} from '@remotion/shapes';+import React from 'react';+import {+ AbsoluteFill,+ interpolateColors,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {centerPath} from './center';+import {ColorBars} from './ColorBars';+import {BLUE} from './colors';+import {transformElement} from './element';+import {Faces} from './Faces';+import {FrameCounter} from './FrameCounter';+import {extrudeElement} from './join-inbetween-tiles';+import {+ rotateX,+ rotateY,+ rotateZ,+ translateX,+ translateY,+ translateZ,+} from './matrix';++export const Spiral: React.FC = () => {+ const frame = (Math.sin(useCurrentFrame() / 50) + 1) * 50 + 400;+ const {height, width} = useVideoConfig();+ const viewBox = [-width / 2, -height / 2, width, height];++ const triangle = makeTriangle({+ direction: 'right',+ length: 300,+ edgeRoundness: 0.71,+ });++ const items = new Array(8).fill(true).map((item, i) => {+ const color = interpolateColors(i, [0, 8], ['#E9F3FD', BLUE]);+ const cursor = transformElement(+ extrudeElement({+ depth: 30,+ backFaceColor: color,+ frontFaceColor: color,+ points: parsePath(centerPath(resetPath(triangle.path))),+ sideColor: '#000',+ strokeWidth: 10,+ description: 'Cursor',+ strokeColor: '#000',+ crispEdges: true,+ }),+ [+ rotateZ((frame - i * 3) / 90),+ rotateY(Math.PI / 4),+ rotateY(Math.sin(i * 0.03) * Math.PI + frame / 300),+ rotateX(Math.cos(i * 0.03) * Math.PI + (frame - i * 30) / 150),+ translateX(Math.sin(i * 0.03) * 3000),+ translateZ(Math.sin(i * 0.03) * 6000),+ translateY(-i * 0.5 * 100),+ translateX(-300),+ translateY(150),+ ],+ );++ return cursor;+ });++ return (+ <AbsoluteFill+ style={{+ backgroundColor: 'transparent',+ }}+ >+ <AbsoluteFill>+ <ColorBars />+ </AbsoluteFill>+ <AbsoluteFill>+ <svg+ viewBox={viewBox.join(' ')}+ style={{+ scale: '2.6',+ }}+ >+ <Faces noSort elements={items} />+ </svg>+ </AbsoluteFill>+ <AbsoluteFill>+ <FrameCounter />+ </AbsoluteFill>+ </AbsoluteFill>+ );+};diff --git a/packages/remotion-media/src/compositions/Tone.tsx b/packages/remotion-media/src/compositions/Tone.tsxnew file mode 100644index 0000000000..f774bdc196--- /dev/null+++ b/packages/remotion-media/src/compositions/Tone.tsx@@ -0,0 +1,13 @@+import {Audio, staticFile} from 'remotion';++export const Tone = () => {+ return (+ <Audio+ src={staticFile('tone-1k-60s.wav')}+ loop+ volume={(f) => {+ return (Math.sin(f * Math.PI * 2 * 30 * 10) + 1) / 2;+ }}+ />+ );+};diff --git a/packages/remotion-media/src/compositions/center.ts b/packages/remotion-media/src/compositions/center.tsnew file mode 100644index 0000000000..a609ee8502--- /dev/null+++ b/packages/remotion-media/src/compositions/center.ts@@ -0,0 +1,14 @@+import {getBoundingBox, translatePath} from '@remotion/paths';++export const centerPath = (path: string) => {+ const bBox = getBoundingBox(path);+ const buttonWidth = bBox.x2 - bBox.x1;+ const buttonHeight = bBox.y2 - bBox.y1;++ const centeredButton = translatePath(+ path,+ -buttonWidth / 2,+ -buttonHeight / 2,+ );+ return centeredButton;+};diff --git a/packages/remotion-media/src/compositions/colors.ts b/packages/remotion-media/src/compositions/colors.tsnew file mode 100644index 0000000000..985a2173ad--- /dev/null+++ b/packages/remotion-media/src/compositions/colors.ts@@ -0,0 +1,2 @@+export const BLUE = '#0b84f3';+export const GREEN = 'rgb(16 171 58)';diff --git a/packages/remotion-media/src/compositions/element.ts b/packages/remotion-media/src/compositions/element.tsnew file mode 100644index 0000000000..95fd47111a--- /dev/null+++ b/packages/remotion-media/src/compositions/element.ts@@ -0,0 +1,69 @@+import {makeId} from './make-id';+import type {FaceType} from './map-face';+import {transformFace} from './map-face';+import type {MatrixTransform4D, Vector4D} from './matrix';+import {multiplyMatrix, translateX, translateY, translateZ} from './matrix';++export type ThreeDElement = {+ faces: FaceType[];+ id: string;+ description: string;+ centerPoint: Vector4D;+};++export const makeElement = (+ face: FaceType | FaceType[],+ centerPoint: Vector4D,+ description: string,+): ThreeDElement => {+ return {+ faces: Array.isArray(face) ? face : [face],+ id: makeId(),+ centerPoint,+ description,+ };+};++export const transformElement = (+ element: ThreeDElement,+ transformations: MatrixTransform4D[],+): ThreeDElement => {+ return {+ ...element,+ faces: element.faces.map((face) => {+ return transformFace(face, transformations);+ }),+ id: makeId(),+ centerPoint: transformations.reduce(+ (point, transformation) => multiplyMatrix(transformation, point),+ element.centerPoint,+ ),+ };+};++export const transformAroundItself = (+ element: ThreeDElement,+ transformations: MatrixTransform4D[],+): ThreeDElement => {+ const actualTransformations = [+ translateX(-element.centerPoint[0]),+ translateY(-element.centerPoint[1]),+ translateZ(-element.centerPoint[2]),+ ...transformations,+ translateX(element.centerPoint[0]),+ translateY(element.centerPoint[1]),+ translateZ(element.centerPoint[2]),+ ];++ return {+ ...element,+ faces: element.faces.map((face) => {+ return transformFace(face, actualTransformations);+ }),+ id: makeId(),+ centerPoint: transformations.reduce(+ (point, transformation) => multiplyMatrix(transformation, point),+ element.centerPoint,+ ),+ };+};diff --git a/packages/remotion-media/src/compositions/fix-z.ts b/packages/remotion-media/src/compositions/fix-z.tsnew file mode 100644index 0000000000..21c24a2d1e--- /dev/null+++ b/packages/remotion-media/src/compositions/fix-z.ts@@ -0,0 +1,45 @@+import type {Instruction} from '@remotion/paths';+import {reduceInstructions} from '@remotion/paths';+import type {ThreeDReducedInstruction} from './3d-svg';+import type {Vector4D} from './matrix';++export const turnInto3D = (+ instructions: Instruction[],+): ThreeDReducedInstruction[] => {+ let lastMove: Vector4D = [0, 0, 0, 1];+ const newInstructions: ThreeDReducedInstruction[] = [];+ const reduced = reduceInstructions(instructions);++ for (let i = 0; i < reduced.length; i++) {+ const instruction = reduced[i];++ if (instruction.type === 'Z') {+ newInstructions.push({+ type: 'Z',+ point: lastMove,+ });+ } else if (instruction.type === 'M') {+ lastMove = [instruction.x, instruction.y, 0, 1];+ newInstructions.push({+ point: [instruction.x, instruction.y, 0, 1],+ type: 'M',+ });+ } else if (instruction.type === 'L') {+ newInstructions.push({+ type: 'L',+ point: [instruction.x, instruction.y, 0, 1],+ });+ } else if (instruction.type === 'C') {+ newInstructions.push({+ type: 'C',+ point: [instruction.x, instruction.y, 0, 1],+ cp1: [instruction.cp1x, instruction.cp1y, 0, 1],+ cp2: [instruction.cp2x, instruction.cp2y, 0, 1],+ });+ } else {+ throw new Error('unknown');+ }+ }++ return newInstructions;+};diff --git a/packages/remotion-media/src/compositions/index.ts b/packages/remotion-media/src/compositions/index.tsnew file mode 100644index 0000000000..69bbf506ad--- /dev/null+++ b/packages/remotion-media/src/compositions/index.ts@@ -0,0 +1,4 @@+import {registerRoot} from 'remotion';+import {Root} from './Root';++registerRoot(Root);diff --git a/packages/remotion-media/src/compositions/join-between-tiles.ts b/packages/remotion-media/src/compositions/join-between-tiles.tsnew file mode 100644index 0000000000..99ff22c349--- /dev/null+++ b/packages/remotion-media/src/compositions/join-between-tiles.ts@@ -0,0 +1,180 @@+import type {Instruction} from '@remotion/paths';+import {+ getBoundingBox,+ reduceInstructions,+ serializeInstructions,+} from '@remotion/paths';+import type {ThreeDReducedInstruction} from './3d-svg';+import type {ThreeDElement} from './element';+import {makeElement} from './element';+import {turnInto3D} from './fix-z';+import type {FaceType} from './map-face';+import {transformFace, translateSvgInstruction} from './map-face';+import type {Vector4D} from './matrix';+import {translateZ} from './matrix';+import {subdivideInstructions} from './subdivide-instructions';+import {truthy} from './truthy';++export const extrudeElement = ({+ depth,+ sideColor,+ frontFaceColor,+ backFaceColor,+ points,+ strokeWidth,+ description,+ strokeColor,+ crispEdges,+}: {+ depth: number;+ sideColor: string;+ frontFaceColor: string;+ backFaceColor: string;+ points: Instruction[];+ strokeWidth: number;+ description: string;+ strokeColor: string;+ crispEdges: boolean;+}): ThreeDElement => {+ const boundingBox = getBoundingBox(+ serializeInstructions(reduceInstructions(points)),+ );++ const centerX = (boundingBox.x2 - boundingBox.x1) / 2 + boundingBox.x1;+ const centerY = (boundingBox.y2 - boundingBox.y1) / 2 + boundingBox.y1;++ const threeD = turnInto3D(points);+ const instructions: FaceType = {+ centerPoint: [0, 0, 0, 1],+ points: subdivideInstructions(+ subdivideInstructions(subdivideInstructions(threeD)),+ ),+ strokeWidth,+ strokeColor,+ color: 'black',+ description,+ crispEdges,+ };++ const unscaledBackFace = transformFace(instructions, [translateZ(depth / 2)]);+ const unscaledFrontFace = transformFace(instructions, [+ translateZ(-depth / 2),+ ]);++ const inbetween = unscaledBackFace.points.map((t, i): FaceType => {+ const nextInstruction =+ i === unscaledBackFace.points.length - 1+ ? unscaledBackFace.points[0]+ : unscaledBackFace.points[i + 1];++ const currentPoint = t.point;+ const nextPoint = nextInstruction.point;+ const movingOver: Vector4D = [+ nextPoint[0],+ nextPoint[1],+ nextPoint[2] - depth,+ nextPoint[3],+ ];++ const translatedInstruction = translateSvgInstruction(+ inverseInstruction(nextInstruction, currentPoint),+ 0,+ 0,+ -depth,+ );+ const newInstructions: ThreeDReducedInstruction[] = [+ {+ type: 'M' as const,+ point: currentPoint,+ },+ nextInstruction,+ nextInstruction.type === 'Z'+ ? {+ type: 'M' as const,+ point: nextInstruction.point,+ }+ : null,+ {+ type: 'L' as const,+ point: movingOver,+ },+ translatedInstruction,+ {+ type: 'L' as const,+ point: currentPoint,+ },+ ].filter(truthy);++ return {+ points: newInstructions,+ color: sideColor,+ centerPoint: [0, 0, 0, 1],+ strokeWidth: 0,+ strokeColor: 'black',+ description: description + 'inbetween',+ crispEdges: true,+ };+ });++ const scaledFrontFace: FaceType = {+ ...unscaledFrontFace,+ color: frontFaceColor,+ description: description + '(front)',+ };+ const scaledBackFace: FaceType = {+ ...unscaledBackFace,+ color: backFaceColor,+ description: description + '(back)',+ };++ return makeElement(+ [...inbetween, scaledFrontFace, scaledBackFace],+ [centerX, centerY, 0, 1],+ description,+ );+};++const inverseInstruction = (+ instruction: ThreeDReducedInstruction,+ comingFrom: Vector4D,+): ThreeDReducedInstruction => {+ if (instruction.type === 'M') {+ return {+ type: 'M',+ point: comingFrom,+ };+ }++ if (instruction.type === 'L') {+ return {+ type: 'L',+ point: comingFrom,+ };+ }++ if (instruction.type === 'C') {+ return {+ type: 'C',+ point: comingFrom,+ cp1: instruction.cp2,+ cp2: instruction.cp1,+ };+ }++ if (instruction.type === 'Q') {+ return {+ type: 'Q',+ point: comingFrom,+ cp: instruction.cp,+ };+ }++ if (instruction.type === 'Z') {+ return {+ type: 'L',+ point: comingFrom,+ };+ }++ throw new Error('Unknown instruction type');+};diff --git a/packages/remotion-media/src/compositions/join-inbetween-tiles.ts b/packages/remotion-media/src/compositions/join-inbetween-tiles.tsnew file mode 100644index 0000000000..99ff22c349--- /dev/null+++ b/packages/remotion-media/src/compositions/join-inbetween-tiles.ts@@ -0,0 +1,180 @@+import type {Instruction} from '@remotion/paths';+import {+ getBoundingBox,+ reduceInstructions,+ serializeInstructions,+} from '@remotion/paths';+import type {ThreeDReducedInstruction} from './3d-svg';+import type {ThreeDElement} from './element';+import {makeElement} from './element';+import {turnInto3D} from './fix-z';+import type {FaceType} from './map-face';+import {transformFace, translateSvgInstruction} from './map-face';+import type {Vector4D} from './matrix';+import {translateZ} from './matrix';+import {subdivideInstructions} from './subdivide-instructions';+import {truthy} from './truthy';++export const extrudeElement = ({+ depth,+ sideColor,+ frontFaceColor,+ backFaceColor,+ points,+ strokeWidth,+ description,+ strokeColor,+ crispEdges,+}: {+ depth: number;+ sideColor: string;+ frontFaceColor: string;+ backFaceColor: string;+ points: Instruction[];+ strokeWidth: number;+ description: string;+ strokeColor: string;+ crispEdges: boolean;+}): ThreeDElement => {+ const boundingBox = getBoundingBox(+ serializeInstructions(reduceInstructions(points)),+ );++ const centerX = (boundingBox.x2 - boundingBox.x1) / 2 + boundingBox.x1;+ const centerY = (boundingBox.y2 - boundingBox.y1) / 2 + boundingBox.y1;++ const threeD = turnInto3D(points);+ const instructions: FaceType = {+ centerPoint: [0, 0, 0, 1],+ points: subdivideInstructions(+ subdivideInstructions(subdivideInstructions(threeD)),+ ),+ strokeWidth,+ strokeColor,+ color: 'black',+ description,+ crispEdges,+ };++ const unscaledBackFace = transformFace(instructions, [translateZ(depth / 2)]);+ const unscaledFrontFace = transformFace(instructions, [+ translateZ(-depth / 2),+ ]);++ const inbetween = unscaledBackFace.points.map((t, i): FaceType => {+ const nextInstruction =+ i === unscaledBackFace.points.length - 1+ ? unscaledBackFace.points[0]+ : unscaledBackFace.points[i + 1];++ const currentPoint = t.point;+ const nextPoint = nextInstruction.point;+ const movingOver: Vector4D = [+ nextPoint[0],+ nextPoint[1],+ nextPoint[2] - depth,+ nextPoint[3],+ ];++ const translatedInstruction = translateSvgInstruction(+ inverseInstruction(nextInstruction, currentPoint),+ 0,+ 0,+ -depth,+ );+ const newInstructions: ThreeDReducedInstruction[] = [+ {+ type: 'M' as const,+ point: currentPoint,+ },+ nextInstruction,+ nextInstruction.type === 'Z'+ ? {+ type: 'M' as const,+ point: nextInstruction.point,+ }+ : null,+ {+ type: 'L' as const,+ point: movingOver,+ },+ translatedInstruction,+ {+ type: 'L' as const,+ point: currentPoint,+ },+ ].filter(truthy);++ return {+ points: newInstructions,+ color: sideColor,+ centerPoint: [0, 0, 0, 1],+ strokeWidth: 0,+ strokeColor: 'black',+ description: description + 'inbetween',+ crispEdges: true,+ };+ });++ const scaledFrontFace: FaceType = {+ ...unscaledFrontFace,+ color: frontFaceColor,+ description: description + '(front)',+ };+ const scaledBackFace: FaceType = {+ ...unscaledBackFace,+ color: backFaceColor,+ description: description + '(back)',+ };++ return makeElement(+ [...inbetween, scaledFrontFace, scaledBackFace],+ [centerX, centerY, 0, 1],+ description,+ );+};++const inverseInstruction = (+ instruction: ThreeDReducedInstruction,+ comingFrom: Vector4D,+): ThreeDReducedInstruction => {+ if (instruction.type === 'M') {+ return {+ type: 'M',+ point: comingFrom,+ };+ }++ if (instruction.type === 'L') {+ return {+ type: 'L',+ point: comingFrom,+ };+ }++ if (instruction.type === 'C') {+ return {+ type: 'C',+ point: comingFrom,+ cp1: instruction.cp2,+ cp2: instruction.cp1,+ };+ }++ if (instruction.type === 'Q') {+ return {+ type: 'Q',+ point: comingFrom,+ cp: instruction.cp,+ };+ }++ if (instruction.type === 'Z') {+ return {+ type: 'L',+ point: comingFrom,+ };+ }++ throw new Error('Unknown instruction type');+};diff --git a/packages/remotion-media/src/compositions/make-id.ts b/packages/remotion-media/src/compositions/make-id.tsnew file mode 100644index 0000000000..12175a78f5--- /dev/null+++ b/packages/remotion-media/src/compositions/make-id.ts@@ -0,0 +1,5 @@+import {random} from 'remotion';++export const makeId = () => {+ return random(null).toString().replace('.', '');+};diff --git a/packages/remotion-media/src/compositions/map-face.ts b/packages/remotion-media/src/compositions/map-face.tsnew file mode 100644index 0000000000..db1584d3d7--- /dev/null+++ b/packages/remotion-media/src/compositions/map-face.ts@@ -0,0 +1,171 @@+import {parsePath} from '@remotion/paths';+import type {ThreeDReducedInstruction} from './3d-svg';+import type {ThreeDElement} from './element';+import {transformElement} from './element';+import {turnInto3D} from './fix-z';+import type {MatrixTransform4D, Vector4D} from './matrix';+import {multiplyMatrix, multiplyMatrixAndSvgInstruction} from './matrix';++export type FaceType = {+ color: string;+ points: ThreeDReducedInstruction[];+ centerPoint: Vector4D;+ strokeWidth: number;+ strokeColor: string;+ description: string;+ crispEdges: boolean;+};++export const translateSvgInstruction = (+ instruction: ThreeDReducedInstruction,+ x: number,+ y: number,+ z: number,+): ThreeDReducedInstruction => {+ if (instruction.type === 'M') {+ return {+ type: 'M',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ };+ }++ if (instruction.type === 'L') {+ return {+ type: 'L',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ };+ }++ if (instruction.type === 'C') {+ return {+ type: 'C',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ cp1: [+ instruction.cp1[0] + x,+ instruction.cp1[1] + y,+ instruction.cp1[2] + z,+ instruction.cp1[3],+ ],+ cp2: [+ instruction.cp2[0] + x,+ instruction.cp2[1] + y,+ instruction.cp2[2] + z,+ instruction.cp2[3],+ ],+ };+ }++ if (instruction.type === 'Q') {+ return {+ type: 'Q',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ cp: [+ instruction.cp[0] + x,+ instruction.cp[1] + y,+ instruction.cp[2] + z,+ instruction.cp[3],+ ],+ };+ }++ if (instruction.type === 'Z') {+ return {+ type: 'Z',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ };+ }++ throw new Error('Unknown instruction type: ' + JSON.stringify(instruction));+};++export const transformFace = (+ face: FaceType,+ transformations: MatrixTransform4D[],+): FaceType => {+ return {+ ...face,+ points: face.points.map((p) => {+ return transformations.reduce((acc, t) => {+ return multiplyMatrixAndSvgInstruction(t, acc);+ }, p);+ }),+ centerPoint: transformations.reduce((acc, t) => {+ const result = multiplyMatrix(t, acc);+ return result;+ }, face.centerPoint),+ };+};++export const transformFaces = ({+ faces,+ transformations,+}: {+ faces: FaceType[];+ transformations: MatrixTransform4D[];+}) => {+ return faces.map((face) => {+ return transformFace(face, transformations);+ });+};++export const transformElements = (+ elements: ThreeDElement[],+ transformations: MatrixTransform4D[],+) => {+ return elements.map((element) => {+ return transformElement(element, transformations);+ });+};++export const makeFace = ({+ points,+ strokeWidth,+ strokeColor,+ fill,+ description,+ crispEdges,+}: {+ points: string | ThreeDReducedInstruction[];+ strokeWidth: number;+ strokeColor: string;+ fill: string;+ description: string;+ crispEdges: boolean;+}): FaceType => {+ const centerPoint: Vector4D = [0, 0, 0, 1];++ return {+ centerPoint,+ color: fill,+ points: typeof points === 'string' ? turnInto3D(parsePath(points)) : points,+ strokeWidth,+ strokeColor,+ description,+ crispEdges,+ };+};diff --git a/packages/remotion-media/src/compositions/matrix.ts b/packages/remotion-media/src/compositions/matrix.tsnew file mode 100644index 0000000000..f2649e5a2e--- /dev/null+++ b/packages/remotion-media/src/compositions/matrix.ts@@ -0,0 +1,312 @@+import type {ThreeDReducedInstruction} from './3d-svg';++export const translated4d = function (vec: Vector) {+ return stride({v: vec, m: identity4(), width: 4, offset: 3, colStride: 0});+};++export const stride = function ({+ v,+ m,+ width,+ offset,+ colStride,+}: {+ v: Vector;+ m: MatrixTransform4D;+ width: number;+ offset: number;+ colStride: number;+}) {+ for (let i = 0; i < v.length; i++) {+ m[+ i * width + // Column+ ((i * colStride + offset + width) % width) // Row+ ] = v[i];+ }++ return m;+};++export const identity4 = function (): MatrixTransform4D {+ const n = 4;+ let size = n * n;+ const m = new Array(size) as MatrixTransform4D;+ while (size--) {+ m[size] = size % (n + 1) === 0 ? 1.0 : 0.0;+ }++ return m;+};++export const m44multiply = (+ ...matrices: MatrixTransform4D[]+): MatrixTransform4D => {+ return multiplyMany(4, matrices);+};++// Accept an integer indicating the size of the matrices being multiplied (3 for 3x3), and any+// number of matrices following it.+function multiplyMany(+ size: number,+ listOfMatrices: MatrixTransform4D[],+): MatrixTransform4D {+ if (listOfMatrices.length < 2) {+ throw new Error('multiplication expected two or more matrices');+ }++ let result = mul(listOfMatrices[0], listOfMatrices[1], size);+ let next = 2;+ while (next < listOfMatrices.length) {+ result = mul(result, listOfMatrices[next], size);+ next++;+ }++ return result as MatrixTransform4D;+}++function mul(m1: number[], m2: number[], size: number): number[] {+ if (m1.length !== m2.length) {+ throw new Error(+ `Undefined for matrices of different sizes. m1.length=${m1.length}, m2.length=${m2.length}`,+ );+ }++ if (size * size !== m1.length) {+ throw new Error(+ `Undefined for non-square matrices. array size was ${size}`,+ );+ }++ const result = Array(m1.length);+ for (let r = 0; r < size; r++) {+ for (let c = 0; c < size; c++) {+ // Accumulate a sum of m1[r,k]*m2[k, c]+ let acc = 0;+ for (let k = 0; k < size; k++) {+ acc += m1[size * r + k] * m2[size * k + c];+ }++ result[r * size + c] = acc;+ }+ }++ return result;+}++export type Vector2D = [number, number];+export type Vector = [number, number, number];+export type Vector4D = [number, number, number, number];++const rotated = function (axisVec: Vector, radians: number): MatrixTransform4D {+ return rotatedUnitSinCos(+ normalize(axisVec),+ Math.sin(radians),+ Math.cos(radians),+ );+};++export const rotateX = (radians: number) => {+ return rotated([1, 0, 0], radians);+};++export const rotateY = (radians: number) => {+ return rotated([0, 1, 0], radians);+};++export const rotateZ = (radians: number) => {+ return rotated([0, 0, 1], radians);+};++export type MatrixTransform4D = [+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+];++export const scaled = function (value: number | Vector) {+ const vec: Vector = typeof value === 'number' ? [value, value, value] : value;+ return stride({v: vec, m: identity4(), width: 4, offset: 0, colStride: 1});+};++const rotatedUnitSinCos = function (+ axisVec: Vector,+ sinAngle: number,+ cosAngle: number,+): MatrixTransform4D {+ const x = axisVec[0];+ const y = axisVec[1];+ const z = axisVec[2];+ const c = cosAngle;+ const s = sinAngle;+ const t = 1 - c;+ return [+ t * x * x + c,+ t * x * y - s * z,+ t * x * z + s * y,+ 0,+ t * x * y + s * z,+ t * y * y + c,+ t * y * z - s * x,+ 0,+ t * x * z - s * y,+ t * y * z + s * x,+ t * z * z + c,+ 0,+ 0,+ 0,+ 0,+ 1,+ ];+};++export const normalize = function (v: Vector): Vector {+ return mulScalar(v, 1 / vectorLength(v));+};++export const normalize4d = function (v: Vector4D): Vector4D {+ return mulScalar(v, 1 / vectorLength(v));+};++const vectorLength = function (v: number[]) {+ return Math.sqrt(lengthSquared(v));+};++const lengthSquared = function (v: number[]) {+ return dot(v, v);+};++export const dot = function (a: number[], b: number[]) {+ if (a.length !== b.length) {+ throw new Error(+ `Cannot perform dot product on arrays of different length (${a.length} vs ${b.length})`,+ );+ }++ return a+ .map((v, i) => {+ return v * b[i];+ })+ .reduce((acc, cur) => {+ return acc + cur;+ });+};++const translated = function (vec: Vector) {+ return stride({+ v: vec,+ m: identity4(),+ width: 4,+ offset: 3,+ colStride: 0,+ });+};++export const translateX = (x: number) => {+ return translated([x, 0, 0]);+};++export const translateY = (y: number) => {+ return translated([0, y, 0]);+};++export const translateZ = (z: number) => {+ return translated([0, 0, z]);+};++export type Camera = {+ near: number;+ far: number;+ angle: number;+ eye: Vector;+ coa: Vector;+ up: Vector;+};++export const mulScalar = function <T extends number[]>(v: T, s: number): T {+ return v.map((i) => {+ return i * s;+ }) as T;+};++export function multiplyMatrixAndSvgInstruction(+ matrix: MatrixTransform4D,+ point: ThreeDReducedInstruction,+): ThreeDReducedInstruction {+ if (point.type === 'C') {+ return {+ type: 'C',+ cp1: multiplyMatrix(matrix, point.cp1),+ cp2: multiplyMatrix(matrix, point.cp2),+ point: multiplyMatrix(matrix, point.point),+ };+ }++ if (point.type === 'Q') {+ return {+ type: 'Q',+ cp: multiplyMatrix(matrix, point.cp),+ point: multiplyMatrix(matrix, point.point),+ };+ }++ if (point.type === 'M') {+ return {+ type: 'M',+ point: multiplyMatrix(matrix, point.point),+ };+ }++ if (point.type === 'L') {+ return {+ type: 'L',+ point: multiplyMatrix(matrix, point.point),+ };+ }++ if (point.type === 'Z') {+ return {+ type: 'Z',+ point: multiplyMatrix(matrix, point.point),+ };+ }++ throw new Error('Unknown instruction type: ' + JSON.stringify(point));+}++export const multiplyMatrix = (+ matrix: MatrixTransform4D,+ point: Vector4D,+): Vector4D => {+ if (matrix.length !== 16 || point.length !== 4) {+ throw new Error('Invalid matrix or vector dimension');+ }++ const result: Vector4D = [0, 0, 0, 0];++ for (let i = 0; i < 4; i++) {+ for (let j = 0; j < 4; j++) {+ result[i] += matrix[i * 4 + j] * point[j];+ }+ }++ return result;+};++export const sub4d = function (a: Vector4D, b: Vector4D): Vector4D {+ return a.map((v, i) => {+ return v - b[i];+ }) as Vector4D;+};diff --git a/packages/remotion-media/src/compositions/subdivide-instructions.ts b/packages/remotion-media/src/compositions/subdivide-instructions.tsnew file mode 100644index 0000000000..38912af22c--- /dev/null+++ b/packages/remotion-media/src/compositions/subdivide-instructions.ts@@ -0,0 +1,238 @@+import type {Instruction} from '@remotion/paths';+import type {ThreeDReducedInstruction} from './3d-svg';+import type {Vector2D, Vector4D} from './matrix';++export const subdivideInstructions = (+ instructions: ThreeDReducedInstruction[],+): ThreeDReducedInstruction[] => {+ const newInstructions: ThreeDReducedInstruction[] = [];+ instructions.forEach((instruction, i) => {+ if (instruction.type === 'M') {+ newInstructions.push(instruction);+ return;+ }++ if (instruction.type === 'Z') {+ newInstructions.push(instruction);+ return;+ }++ const previousInstruction = instructions[i - 1];+ const subdivided = subdivideInstruction(+ previousInstruction.point,+ instruction,+ );+ newInstructions.push(...subdivided);+ });+ return newInstructions;+};++const subdivideInstruction = (+ from: Vector4D,+ instruction: ThreeDReducedInstruction,+): ThreeDReducedInstruction[] => {+ if (instruction.type === 'C') {+ return subdivide3DCInstruction(from, instruction);+ }++ if (instruction.type === 'L' || instruction.type === 'M') {+ return subdivideLOrMInstruction(from, instruction);+ }++ if (instruction.type === 'Q') {+ return subdivideQInstruction(from, instruction);+ }++ if (instruction.type === 'Z') {+ return [instruction];+ }++ throw new Error('Cannot subdivide instruction');+};++const subdivideLOrMInstruction = (+ from: Vector4D,+ instruction: ThreeDReducedInstruction,+) => {+ if (instruction.type !== 'L' && instruction.type !== 'M') {+ throw new Error('Expected L or M instruction');+ }++ const t = 0.5;+ const q0: Vector4D = [+ (1 - t) * from[0] + t * instruction.point[0],+ (1 - t) * from[1] + t * instruction.point[1],+ (1 - t) * from[2] + t * instruction.point[2],+ (1 - t) * from[3] + t * instruction.point[3],+ ];++ const curves: [ThreeDReducedInstruction, ThreeDReducedInstruction] = [+ {type: instruction.type, point: q0},+ {type: instruction.type, point: instruction.point},+ ];++ return curves;+};++export const subdivide2DCInstruction = (+ fromX: number,+ fromY: number,+ instruction: Instruction,+ t: number,+) => {+ if (instruction.type !== 'C') {+ throw new Error('Expected C instruction');+ }++ const q0: Vector2D = [+ (1 - t) * fromX + t * instruction.cp1x,+ (1 - t) * fromY + t * instruction.cp1y,+ ];++ const q1: Vector2D = [+ (1 - t) * instruction.cp1x + t * instruction.cp2x,+ (1 - t) * instruction.cp1y + t * instruction.cp2y,+ ];++ const q2: Vector2D = [+ (1 - t) * instruction.cp2x + t * instruction.x,+ (1 - t) * instruction.cp2y + t * instruction.y,+ ];++ const r0: Vector2D = [+ (1 - t) * q0[0] + t * q1[0],+ (1 - t) * q0[1] + t * q1[1],+ ];++ const r1: Vector2D = [+ (1 - t) * q1[0] + t * q2[0],+ (1 - t) * q1[1] + t * q2[1],+ ];++ const s0: Vector2D = [+ (1 - t) * r0[0] + t * r1[0],+ (1 - t) * r0[1] + t * r1[1],+ ];++ const curves: [Instruction, Instruction] = [+ {+ type: 'C',+ x: s0[0],+ y: s0[1],+ cp1x: q0[0],+ cp1y: q0[1],+ cp2x: r0[0],+ cp2y: r0[1],+ },+ {+ type: 'C',+ x: instruction.x,+ y: instruction.y,+ cp1x: r1[0],+ cp1y: r1[1],+ cp2x: q2[0],+ cp2y: q2[1],+ },+ ];++ return curves;+};++const subdivide3DCInstruction = (+ from: Vector4D,+ instruction: ThreeDReducedInstruction,+) => {+ if (instruction.type !== 'C') {+ throw new Error('Expected C instruction');+ }++ const t = 0.5;++ const q0: Vector4D = [+ (1 - t) * from[0] + t * instruction.cp1[0],+ (1 - t) * from[1] + t * instruction.cp1[1],+ (1 - t) * from[2] + t * instruction.cp1[2],+ (1 - t) * from[3] + t * instruction.cp1[3],+ ];++ const q1: Vector4D = [+ (1 - t) * instruction.cp1[0] + t * instruction.cp2[0],+ (1 - t) * instruction.cp1[1] + t * instruction.cp2[1],+ (1 - t) * instruction.cp1[2] + t * instruction.cp2[2],+ (1 - t) * instruction.cp1[3] + t * instruction.cp2[3],+ ];++ const q2: Vector4D = [+ (1 - t) * instruction.cp2[0] + t * instruction.point[0],+ (1 - t) * instruction.cp2[1] + t * instruction.point[1],+ (1 - t) * instruction.cp2[2] + t * instruction.point[2],+ (1 - t) * instruction.cp2[3] + t * instruction.point[3],+ ];++ const r0: Vector4D = [+ (1 - t) * q0[0] + t * q1[0],+ (1 - t) * q0[1] + t * q1[1],+ (1 - t) * q0[2] + t * q1[2],+ (1 - t) * q0[3] + t * q1[3],+ ];++ const r1: Vector4D = [+ (1 - t) * q1[0] + t * q2[0],+ (1 - t) * q1[1] + t * q2[1],+ (1 - t) * q1[2] + t * q2[2],+ (1 - t) * q1[3] + t * q2[3],+ ];++ const s0: Vector4D = [+ (1 - t) * r0[0] + t * r1[0],+ (1 - t) * r0[1] + t * r1[1],+ (1 - t) * r0[2] + t * r1[2],+ (1 - t) * r0[3] + t * r1[3],+ ];++ const curves: [ThreeDReducedInstruction, ThreeDReducedInstruction] = [+ {type: 'C', point: s0, cp1: q0, cp2: r0},+ {type: 'C', point: instruction.point, cp1: r1, cp2: q2},+ ];++ return curves;+};++const subdivideQInstruction = (+ from: Vector4D,+ instruction: ThreeDReducedInstruction,+) => {+ if (instruction.type !== 'Q') {+ throw new Error('Expected Q instruction');+ }++ const t = 0.5;+ const q0: Vector4D = [+ (1 - t) * from[0] + t * instruction.cp[0],+ (1 - t) * from[1] + t * instruction.cp[1],+ (1 - t) * from[2] + t * instruction.cp[2],+ (1 - t) * from[3] + t * instruction.cp[3],+ ];++ const q1: Vector4D = [+ (1 - t) * instruction.cp[0] + t * instruction.point[0],+ (1 - t) * instruction.cp[1] + t * instruction.point[1],+ (1 - t) * instruction.cp[2] + t * instruction.point[2],+ (1 - t) * instruction.cp[3] + t * instruction.point[3],+ ];++ const r0: Vector4D = [+ (1 - t) * q0[0] + t * q1[0],+ (1 - t) * q0[1] + t * q1[1],+ (1 - t) * q0[2] + t * q1[2],+ (1 - t) * q0[3] + t * q1[3],+ ];++ const newInstructions: [ThreeDReducedInstruction, ThreeDReducedInstruction] =+ [+ {type: 'Q', point: r0, cp: q0},+ {type: 'Q', point: instruction.point, cp: q1},+ ];++ return newInstructions;+};diff --git a/packages/remotion-media/src/compositions/truthy.ts b/packages/remotion-media/src/compositions/truthy.tsnew file mode 100644index 0000000000..56f9b01ea9--- /dev/null+++ b/packages/remotion-media/src/compositions/truthy.ts@@ -0,0 +1,4 @@+type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;+export function truthy<T>(value: T): value is Truthy<T> {+ return Boolean(value);+}diff --git a/packages/remotion-media/src/frontend.tsx b/packages/remotion-media/src/frontend.tsxnew file mode 100644index 0000000000..a4033b4edf--- /dev/null+++ b/packages/remotion-media/src/frontend.tsx@@ -0,0 +1,20 @@+/**+ * This file is the entry point for the React app, it sets up the root+ * element and renders the App component to the DOM.+ *+ * It is included in `src/index.html`.+ */++import {createRoot} from 'react-dom/client';+import {App} from './App';++function start() {+ const root = createRoot(document.getElementById('root')!);+ root.render(<App />);+}++if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', start);+} else {+ start();+}diff --git a/packages/remotion-media/src/index.css b/packages/remotion-media/src/index.cssnew file mode 100644index 0000000000..b651332a52--- /dev/null+++ b/packages/remotion-media/src/index.css@@ -0,0 +1,56 @@+@import 'tailwindcss';++@font-face {+ font-family: 'GTPlanar';+ src: url('../public/gt-planar-regular.woff2') format('woff2');+ font-feature-settings: 'ss03' on;+ font-weight: 400;+ font-style: normal;+}++@font-face {+ font-family: 'GTPlanar';+ src: url('../public/gt-planar-medium.woff2') format('woff2');+ font-feature-settings: 'ss03' on;+ font-weight: 500;+ font-style: normal;+}+@font-face {+ font-family: 'GTPlanar';+ src: url('../public/gt-planar-bold.woff2') format('woff2');+ font-feature-settings: 'ss03' on;+ font-weight: 700;+ font-style: normal;+}++@font-face {+ font-family: 'GTPlanar';+ src: url('../public/gt-planar-black.woff2') format('woff2');+ font-feature-settings: 'ss03' on;+ font-weight: 900;+ font-style: normal;+}++@layer base {+ html {+ scroll-behavior: smooth;+ }+ :root {+ @apply bg-[#F8FAFC] font-sans w-full;+ }+}++@media (prefers-reduced-motion) {+ *,+ ::before,+ ::after {+ animation: none !important;+ }+}++@theme {+ --font-brand:+ 'GTPlanar', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,+ Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;+ --color-brand: #0b84f3;+}diff --git a/packages/remotion-media/src/index.html b/packages/remotion-media/src/index.htmlnew file mode 100644index 0000000000..b6c7bd6167--- /dev/null+++ b/packages/remotion-media/src/index.html@@ -0,0 +1,12 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>remotion.media</title>+ </head>+ <body>+ <div id="root"></div>+ <script type="module" src="./frontend.tsx"></script>+ </body>+</html>diff --git a/packages/remotion-media/src/index.tsx b/packages/remotion-media/src/index.tsxnew file mode 100644index 0000000000..355dec16cc--- /dev/null+++ b/packages/remotion-media/src/index.tsx@@ -0,0 +1,16 @@+import {serve} from 'bun';+import index from './index.html';++serve({+ routes: {+ // Serve index.html for all unmatched routes.+ '/*': index,+ },+ development: process.env.NODE_ENV !== 'production' && {+ // Enable browser hot reloading in development+ hmr: true,++ // Echo console logs from the browser to the server+ console: true,+ },+});diff --git a/packages/remotion-media/switch.wav b/packages/remotion-media/switch.wavnew file mode 100644index 0000000000..ceb5a7c85dBinary files /dev/null and b/packages/remotion-media/switch.wav differdiff --git a/packages/remotion-media/tsconfig.json b/packages/remotion-media/tsconfig.jsonnew file mode 100644index 0000000000..a34691c8d5--- /dev/null+++ b/packages/remotion-media/tsconfig.json@@ -0,0 +1,21 @@+{+ "compilerOptions": {+ "target": "ESNext",+ "noEmit": true,+ "module": "Preserve",+ "moduleResolution": "bundler",+ "allowJs": true,+ "strict": true,+ "esModuleInterop": true,+ "resolveJsonModule": true,+ "skipLibCheck": true,+ "isolatedModules": true,+ "jsx": "react-jsx",+ "lib": ["ES2021", "DOM"],+ "paths": {+ "@/*": ["./src/*"]+ }+ },+ "include": ["src", "generate.ts", "build.ts", "clean.ts", "bun-env.d.ts"],+ "exclude": ["dist", "node_modules", "files", "out"]+}diff --git a/packages/remotion-media/variants.json b/packages/remotion-media/variants.jsonnew file mode 100644index 0000000000..d8d42dbc6f--- /dev/null+++ b/packages/remotion-media/variants.json@@ -0,0 +1,1116 @@+[+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video.mp4",+ "video-h264.mp4",+ "video-aac.mp4",+ "video-h264-aac.mp4"+ ],+ "size": 2005880,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "flac",+ "container": "mp4",+ "fileNames": [+ "video-flac.mp4",+ "video-h264-flac.mp4"+ ],+ "size": 1966571,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "mp3",+ "container": "mp4",+ "fileNames": [+ "video-mp3.mp4",+ "video-h264-mp3.mp4"+ ],+ "size": 2003652,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "pcm",+ "container": "mp4",+ "fileNames": [+ "video-pcm.mp4",+ "video-h264-pcm.mp4"+ ],+ "size": 3760128,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "none",+ "container": "mp4",+ "fileNames": [+ "video-none.mp4",+ "video-h264-none.mp4"+ ],+ "size": 1837459,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-h265.mp4",+ "video-h265-aac.mp4"+ ],+ "size": 1449927,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "flac",+ "container": "mp4",+ "fileNames": [+ "video-h265-flac.mp4"+ ],+ "size": 1410618,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "mp3",+ "container": "mp4",+ "fileNames": [+ "video-h265-mp3.mp4"+ ],+ "size": 1447699,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "pcm",+ "container": "mp4",+ "fileNames": [+ "video-h265-pcm.mp4"+ ],+ "size": 3204175,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "none",+ "container": "mp4",+ "fileNames": [+ "video-h265-none.mp4"+ ],+ "size": 1281506,+ "category": "codecs"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio.wav",+ "audio-pcm.wav"+ ],+ "size": 1920078,+ "category": "codecs"+ },+ {+ "videoCodec": "none",+ "audioCodec": "mp3",+ "container": "mp3",+ "fileNames": [+ "audio.mp3",+ "audio-mp3.mp3"+ ],+ "size": 160748,+ "category": "codecs"+ },+ {+ "videoCodec": "none",+ "audioCodec": "flac",+ "container": "flac",+ "fileNames": [+ "audio.flac",+ "audio-flac.flac"+ ],+ "size": 135327,+ "category": "codecs"+ },+ {+ "videoCodec": "vp8",+ "audioCodec": "opus",+ "container": "webm",+ "fileNames": [+ "video-opus.webm",+ "video-vp8-opus.webm"+ ],+ "size": 1065491,+ "category": "codecs"+ },+ {+ "videoCodec": "vp8",+ "audioCodec": "vorbis",+ "container": "webm",+ "fileNames": [+ "video-vorbis.webm",+ "video-vp8-vorbis.webm"+ ],+ "size": 937784,+ "category": "codecs"+ },+ {+ "videoCodec": "vp8",+ "audioCodec": "none",+ "container": "webm",+ "fileNames": [+ "video-none.webm",+ "video-vp8-none.webm"+ ],+ "size": 879717,+ "category": "codecs"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "opus",+ "container": "webm",+ "fileNames": [+ "video-vp9-opus.webm"+ ],+ "size": 2661566,+ "category": "codecs"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "vorbis",+ "container": "webm",+ "fileNames": [+ "video-vp9-vorbis.webm"+ ],+ "size": 2533859,+ "category": "codecs"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "none",+ "container": "webm",+ "fileNames": [+ "video-vp9-none.webm"+ ],+ "size": 2475792,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mkv",+ "fileNames": [+ "video.mkv",+ "video-h264.mkv",+ "video-aac.mkv",+ "video-h264-aac.mkv"+ ],+ "size": 1999677,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "flac",+ "container": "mkv",+ "fileNames": [+ "video-flac.mkv",+ "video-h264-flac.mkv"+ ],+ "size": 1963723,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "mp3",+ "container": "mkv",+ "fileNames": [+ "video-mp3.mkv",+ "video-h264-mp3.mkv"+ ],+ "size": 1999377,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "opus",+ "container": "mkv",+ "fileNames": [+ "video-opus.mkv",+ "video-h264-opus.mkv"+ ],+ "size": 2021519,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "vorbis",+ "container": "mkv",+ "fileNames": [+ "video-vorbis.mkv",+ "video-h264-vorbis.mkv"+ ],+ "size": 1893814,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "none",+ "container": "mkv",+ "fileNames": [+ "video-none.mkv",+ "video-h264-none.mkv"+ ],+ "size": 1835744,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "aac",+ "container": "mkv",+ "fileNames": [+ "video-h265.mkv",+ "video-h265-aac.mkv"+ ],+ "size": 1443360,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "flac",+ "container": "mkv",+ "fileNames": [+ "video-h265-flac.mkv"+ ],+ "size": 1407405,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "mp3",+ "container": "mkv",+ "fileNames": [+ "video-h265-mp3.mkv"+ ],+ "size": 1443060,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "opus",+ "container": "mkv",+ "fileNames": [+ "video-h265-opus.mkv"+ ],+ "size": 1465202,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "vorbis",+ "container": "mkv",+ "fileNames": [+ "video-h265-vorbis.mkv"+ ],+ "size": 1337497,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "none",+ "container": "mkv",+ "fileNames": [+ "video-h265-none.mkv"+ ],+ "size": 1279427,+ "category": "codecs"+ },+ {+ "videoCodec": "vp8",+ "audioCodec": "aac",+ "container": "mkv",+ "fileNames": [+ "video-vp8.mkv",+ "video-vp8-aac.mkv"+ ],+ "size": 1043733,+ "category": "codecs"+ },+ {+ "videoCodec": "vp8",+ "audioCodec": "flac",+ "container": "mkv",+ "fileNames": [+ "video-vp8-flac.mkv"+ ],+ "size": 1007776,+ "category": "codecs"+ },+ {+ "videoCodec": "vp8",+ "audioCodec": "mp3",+ "container": "mkv",+ "fileNames": [+ "video-vp8-mp3.mkv"+ ],+ "size": 1043433,+ "category": "codecs"+ },+ {+ "videoCodec": "vp8",+ "audioCodec": "opus",+ "container": "mkv",+ "fileNames": [+ "video-vp8-opus.mkv"+ ],+ "size": 1065575,+ "category": "codecs"+ },+ {+ "videoCodec": "vp8",+ "audioCodec": "vorbis",+ "container": "mkv",+ "fileNames": [+ "video-vp8-vorbis.mkv"+ ],+ "size": 937868,+ "category": "codecs"+ },+ {+ "videoCodec": "vp8",+ "audioCodec": "none",+ "container": "mkv",+ "fileNames": [+ "video-vp8-none.mkv"+ ],+ "size": 879797,+ "category": "codecs"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "aac",+ "container": "mkv",+ "fileNames": [+ "video-vp9.mkv",+ "video-vp9-aac.mkv"+ ],+ "size": 2639808,+ "category": "codecs"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "flac",+ "container": "mkv",+ "fileNames": [+ "video-vp9-flac.mkv"+ ],+ "size": 2603851,+ "category": "codecs"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "mp3",+ "container": "mkv",+ "fileNames": [+ "video-vp9-mp3.mkv"+ ],+ "size": 2639508,+ "category": "codecs"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "opus",+ "container": "mkv",+ "fileNames": [+ "video-vp9-opus.mkv"+ ],+ "size": 2661650,+ "category": "codecs"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "vorbis",+ "container": "mkv",+ "fileNames": [+ "video-vp9-vorbis.mkv"+ ],+ "size": 2533943,+ "category": "codecs"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "none",+ "container": "mkv",+ "fileNames": [+ "video-vp9-none.mkv"+ ],+ "size": 2475872,+ "category": "codecs"+ },+ {+ "videoCodec": "prores",+ "audioCodec": "aac",+ "container": "mkv",+ "fileNames": [+ "video-prores.mkv",+ "video-prores-aac.mkv"+ ],+ "size": 140913336,+ "category": "codecs"+ },+ {+ "videoCodec": "prores",+ "audioCodec": "flac",+ "container": "mkv",+ "fileNames": [+ "video-prores-flac.mkv"+ ],+ "size": 140877186,+ "category": "codecs"+ },+ {+ "videoCodec": "prores",+ "audioCodec": "mp3",+ "container": "mkv",+ "fileNames": [+ "video-prores-mp3.mkv"+ ],+ "size": 140913036,+ "category": "codecs"+ },+ {+ "videoCodec": "prores",+ "audioCodec": "opus",+ "container": "mkv",+ "fileNames": [+ "video-prores-opus.mkv"+ ],+ "size": 140935179,+ "category": "codecs"+ },+ {+ "videoCodec": "prores",+ "audioCodec": "vorbis",+ "container": "mkv",+ "fileNames": [+ "video-prores-vorbis.mkv"+ ],+ "size": 140807173,+ "category": "codecs"+ },+ {+ "videoCodec": "prores",+ "audioCodec": "none",+ "container": "mkv",+ "fileNames": [+ "video-prores-none.mkv"+ ],+ "size": 140749103,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mov",+ "fileNames": [+ "video.mov",+ "video-h264.mov",+ "video-aac.mov",+ "video-h264-aac.mov"+ ],+ "size": 2005957,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "pcm",+ "container": "mov",+ "fileNames": [+ "video-pcm.mov",+ "video-h264-pcm.mov"+ ],+ "size": 3760113,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "none",+ "container": "mov",+ "fileNames": [+ "video-none.mov",+ "video-h264-none.mov"+ ],+ "size": 1837432,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "aac",+ "container": "mov",+ "fileNames": [+ "video-h265.mov",+ "video-h265-aac.mov"+ ],+ "size": 1450008,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "pcm",+ "container": "mov",+ "fileNames": [+ "video-h265-pcm.mov"+ ],+ "size": 3204164,+ "category": "codecs"+ },+ {+ "videoCodec": "h265",+ "audioCodec": "none",+ "container": "mov",+ "fileNames": [+ "video-h265-none.mov"+ ],+ "size": 1281483,+ "category": "codecs"+ },+ {+ "videoCodec": "prores",+ "audioCodec": "aac",+ "container": "mov",+ "fileNames": [+ "video-prores.mov",+ "video-prores-aac.mov"+ ],+ "size": 140908351,+ "category": "codecs"+ },+ {+ "videoCodec": "prores",+ "audioCodec": "pcm",+ "container": "mov",+ "fileNames": [+ "video-prores-pcm.mov"+ ],+ "size": 142663059,+ "category": "codecs"+ },+ {+ "videoCodec": "prores",+ "audioCodec": "none",+ "container": "mov",+ "fileNames": [+ "video-prores-none.mov"+ ],+ "size": 140740422,+ "category": "codecs"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-360p.mp4"+ ],+ "size": 35728439,+ "category": "dimensions"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-480p.mp4"+ ],+ "size": 35983115,+ "category": "dimensions"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-720p.mp4"+ ],+ "size": 36507967,+ "category": "dimensions"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-1080p.mp4"+ ],+ "size": 37378464,+ "category": "dimensions"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-1440p.mp4"+ ],+ "size": 38300807,+ "category": "dimensions"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-2160p.mp4"+ ],+ "size": 40365974,+ "category": "dimensions"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-5s.mp4"+ ],+ "size": 2061745,+ "category": "durations"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-10s.mp4"+ ],+ "size": 4335431,+ "category": "durations"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-30s.mp4"+ ],+ "size": 12756693,+ "category": "durations"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-1m.mp4"+ ],+ "size": 25266373,+ "category": "durations"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-5m.mp4"+ ],+ "size": 125507936,+ "category": "durations"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-10m.mp4"+ ],+ "size": 249897169,+ "category": "durations"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-30m.mp4"+ ],+ "size": 748909719,+ "category": "durations"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-24fps.mp4"+ ],+ "size": 3700056,+ "category": "fps"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-25fps.mp4"+ ],+ "size": 3795076,+ "category": "fps"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-29.97fps.mp4"+ ],+ "size": 4273776,+ "category": "fps"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-30fps.mp4"+ ],+ "size": 4275384,+ "category": "fps"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-59.94fps.mp4"+ ],+ "size": 5881638,+ "category": "fps"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-60fps.mp4"+ ],+ "size": 5887211,+ "category": "fps"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-120fps.mp4"+ ],+ "size": 9030640,+ "category": "fps"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "video-240fps.mp4"+ ],+ "size": 17780437,+ "category": "fps"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "dialogue.wav"+ ],+ "size": 4787658,+ "category": "audio"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "pcm",+ "container": "mov",+ "fileNames": [+ "multiple-audio-streams.mov"+ ],+ "size": 66906020,+ "category": "audio"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-8000hz.wav"+ ],+ "size": 160078,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-11025hz.wav"+ ],+ "size": 220578,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-12000hz.wav"+ ],+ "size": 240078,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-16000hz.wav"+ ],+ "size": 320078,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-22050hz.wav"+ ],+ "size": 441078,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-24000hz.wav"+ ],+ "size": 480078,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-32000hz.wav"+ ],+ "size": 640078,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-44100hz.wav"+ ],+ "size": 882078,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-48000hz.wav"+ ],+ "size": 960078,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-88200hz.wav"+ ],+ "size": 1764102,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-96000hz.wav"+ ],+ "size": 1920102,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-176400hz.wav"+ ],+ "size": 3528102,+ "category": "sample-rates"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "audio-192000hz.wav"+ ],+ "size": 3840102,+ "category": "sample-rates"+ },+ {+ "videoCodec": "h264",+ "audioCodec": "aac",+ "container": "mp4",+ "fileNames": [+ "greenscreen.mp4"+ ],+ "size": 888217,+ "category": "greenscreen"+ },+ {+ "videoCodec": "vp9",+ "audioCodec": "opus",+ "container": "webm",+ "fileNames": [+ "first-frame-at-4sec.webm"+ ],+ "size": 911894,+ "category": "edge-cases"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "whoosh.wav"+ ],+ "size": 13620,+ "category": "sound-effects",+ "attribution": "Woosh by 1bob -- https://freesound.org/s/831936/ -- License: Creative Commons 0"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "whip.wav"+ ],+ "size": 66732,+ "category": "sound-effects",+ "attribution": "SWSH_Badminton Racquet_Recording_01_JW Audio by JW_Audio -- https://freesound.org/s/838766/ -- License: Creative Commons 0"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "page-turn.wav"+ ],+ "size": 35334,+ "category": "sound-effects",+ "attribution": "Draw Knife 1 by kenney.nl -- https://kenney.nl -- License: Creative Commons 0"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "switch.wav"+ ],+ "size": 58290,+ "category": "sound-effects",+ "attribution": "UI Audio - Switch 35 by kenney.nl -- https://kenney.nl -- License: Creative Commons 0"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "mouse-click.wav"+ ],+ "size": 70110,+ "category": "sound-effects",+ "attribution": "Mouse Click Sound.mp3 by Pixeliota -- https://freesound.org/s/678248/ -- License: Creative Commons 0"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "shutter-modern.wav"+ ],+ "size": 43224,+ "category": "sound-effects",+ "attribution": "DSLR Shutter fast 006.wav by ristooooo1 -- https://freesound.org/s/539136/ -- License: Creative Commons 0"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "shutter-old.wav"+ ],+ "size": 55600,+ "category": "sound-effects",+ "attribution": "Werra.wav by hmilleo -- https://freesound.org/s/409093/ -- License: Creative Commons 0"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "bruh.wav"+ ],+ "size": 207438,+ "category": "sound-effects",+ "attribution": "Bruh Sound Effect -- https://soundeffects.fandom.com/wiki/Bruh_Sound_Effect"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "windows-xp-error.wav"+ ],+ "size": 87630,+ "category": "sound-effects",+ "attribution": "Windows XP Error -- https://www.myinstants.com/en/instant/windows-xp-error/"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "vine-boom.wav"+ ],+ "size": 221516,+ "category": "sound-effects",+ "attribution": "Vine Boom Sound -- https://www.myinstants.com/en/instant/vine-boom-sound-70972/"+ },+ {+ "videoCodec": "none",+ "audioCodec": "pcm",+ "container": "wav",+ "fileNames": [+ "ding.wav"+ ],+ "size": 520782,+ "category": "sound-effects",+ "attribution": "Ding Sound Effect -- https://www.myinstants.com/en/instant/ding-sound-effect/"+ }+]\ No newline at end of filediff --git a/packages/remotion-media/vine-boom.wav b/packages/remotion-media/vine-boom.wavnew file mode 100644index 0000000000..880b29e801Binary files /dev/null and b/packages/remotion-media/vine-boom.wav differdiff --git a/packages/remotion-media/whip.wav b/packages/remotion-media/whip.wavnew file mode 100644index 0000000000..d56ad8e991Binary files /dev/null and b/packages/remotion-media/whip.wav differdiff --git a/packages/remotion-media/whoosh.wav b/packages/remotion-media/whoosh.wavnew file mode 100644index 0000000000..06f8189b1eBinary files /dev/null and b/packages/remotion-media/whoosh.wav differdiff --git a/packages/remotion-media/windows-xp-error.wav b/packages/remotion-media/windows-xp-error.wavnew file mode 100644index 0000000000..a6e6dd577fBinary files /dev/null and b/packages/remotion-media/windows-xp-error.wav differ