Skip to content

🎥 Make videos programmatically with React

merge main

Jonny Burgere8f7f2a3e572
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4688554305..231feebab6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,3 +1,7 @@
+Want to watch a tutorial video instead? [Click here](https://www.youtube.com/watch?v=edWIkrjFgoQ)
+
+---
+
## Contributing
Issues and pull requests of all sorts are welcome!
@@ -41,4 +45,4 @@ running to keep the monorepos building and synchronized.
As a testbed, you can use the `example` folder. Run `npm start` to trigger the preview and `npm run render` to trigger the render process.
### Testing
-For information about testing, please consult [TESTING.md](./TESTING.md).
\ No newline at end of file
+For information about testing, please consult [TESTING.md](./TESTING.md).
diff --git a/lerna.json b/lerna.json
index fe72a139d4..416136cd3f 100644
--- a/lerna.json
+++ b/lerna.json
@@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
- "version": "2.1.9"
+ "version": "2.1.11"
}
diff --git a/packages/babel-loader/package.json b/packages/babel-loader/package.json
index c0927fdfdb..e5e79cf3c7 100644
--- a/packages/babel-loader/package.json
+++ b/packages/babel-loader/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/babel-loader",
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "babel-loader polyfill for Remotion",
"main": "dist/index.js",
"scripts": {
@@ -33,7 +33,7 @@
"eslint": "^7.25.0",
"prettier": "^2.0.5",
"prettier-plugin-organize-imports": "^1.1.1",
- "remotion": "2.1.9",
+ "remotion": "2.1.11",
"typescript": "^4.1.2"
},
"publishConfig": {
diff --git a/packages/bundler/package-lock.json b/packages/bundler/package-lock.json
index c1786d93d0..8396be773f 100644
--- a/packages/bundler/package-lock.json
+++ b/packages/bundler/package-lock.json
@@ -1,10 +1,13 @@
{
- "name": "bundler",
- "version": "2.1.9",
+ "name": "@remotion/bundler",
+ "version": "2.1.10",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
+ "name": "@remotion/bundler",
+ "version": "2.1.10",
+ "license": "SEE LICENSE IN LICENSE.md",
"dependencies": {
"@jonny/eslint-config": "^2.1.233",
"@jonny/webpack-dev-middleware": "^4.1.3",
@@ -23,11 +26,12 @@
"prettier": "^2.0.5",
"prettier-plugin-organize-imports": "^1.1.1",
"react-refresh": "^0.9.0-rc.2",
- "semver": "7.3.4",
"style-loader": "^2.0.0",
- "styled-components": "^5.2.1",
"typescript": "^4.1.2",
"url-loader": "^4.1.1",
+ "remotion": "2.1.10",
+ "semver": "7.3.4",
+ "styled-components": "^5.2.1",
"webpack": "5.37.0",
"webpack-hot-middleware": "^2.25.0"
}
@@ -6412,53 +6416,6 @@
"resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",
"integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI="
},
- "node_modules/url-loader": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-4.1.1.tgz",
- "integrity": "sha512-3BTV812+AVHHOJQO8O5MkWgZ5aosP7GnROJwvzLS9hWDj00lZ6Z0wNak423Lp9PBZN05N+Jk/N5Si8jRAlGyWA==",
- "dependencies": {
- "loader-utils": "^2.0.0",
- "mime-types": "^2.1.27",
- "schema-utils": "^3.0.0"
- },
- "engines": {
- "node": ">= 10.13.0"
- }
- },
- "node_modules/url-loader/node_modules/@types/json-schema": {
- "version": "7.0.6",
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
- "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw=="
- },
- "node_modules/url-loader/node_modules/ajv": {
- "version": "6.12.6",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
- "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
- "dependencies": {
- "fast-deep-equal": "^3.1.1",
- "fast-json-stable-stringify": "^2.0.0",
- "json-schema-traverse": "^0.4.1",
- "uri-js": "^4.2.2"
- }
- },
- "node_modules/url-loader/node_modules/ajv-keywords": {
- "version": "3.5.2",
- "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
- "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ=="
- },
- "node_modules/url-loader/node_modules/schema-utils": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz",
- "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==",
- "dependencies": {
- "@types/json-schema": "^7.0.6",
- "ajv": "^6.12.5",
- "ajv-keywords": "^3.5.2"
- },
- "engines": {
- "node": ">= 10.13.0"
- }
- },
"node_modules/url-parse": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz",
@@ -11919,49 +11876,6 @@
"resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",
"integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI="
},
- "url-loader": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-4.1.1.tgz",
- "integrity": "sha512-3BTV812+AVHHOJQO8O5MkWgZ5aosP7GnROJwvzLS9hWDj00lZ6Z0wNak423Lp9PBZN05N+Jk/N5Si8jRAlGyWA==",
- "requires": {
- "loader-utils": "^2.0.0",
- "mime-types": "^2.1.27",
- "schema-utils": "^3.0.0"
- },
- "dependencies": {
- "@types/json-schema": {
- "version": "7.0.6",
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
- "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw=="
- },
- "ajv": {
- "version": "6.12.6",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
- "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
- "requires": {
- "fast-deep-equal": "^3.1.1",
- "fast-json-stable-stringify": "^2.0.0",
- "json-schema-traverse": "^0.4.1",
- "uri-js": "^4.2.2"
- }
- },
- "ajv-keywords": {
- "version": "3.5.2",
- "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
- "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ=="
- },
- "schema-utils": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz",
- "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==",
- "requires": {
- "@types/json-schema": "^7.0.6",
- "ajv": "^6.12.5",
- "ajv-keywords": "^3.5.2"
- }
- }
- }
- },
"url-parse": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.1.tgz",
diff --git a/packages/bundler/package.json b/packages/bundler/package.json
index 273e82d08a..babac9adbb 100644
--- a/packages/bundler/package.json
+++ b/packages/bundler/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/bundler",
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "Bundler for Remotion",
"main": "dist/index.js",
"sideEffects": false,
@@ -29,11 +29,10 @@
"file-loader": "^6.0.0",
"latest-version": "^5.1.0",
"react-refresh": "^0.9.0-rc.2",
- "remotion": "2.1.9",
+ "remotion": "2.1.11",
"semver": "7.3.4",
"style-loader": "^2.0.0",
"styled-components": "^5.2.1",
- "url-loader": "^4.1.1",
"webpack": "5.37.0",
"webpack-hot-middleware": "^2.25.0"
},
diff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.ts
index 99f7646ec3..2d091278d5 100644
--- a/packages/bundler/src/webpack-config.ts
+++ b/packages/bundler/src/webpack-config.ts
@@ -110,12 +110,6 @@ export const webpackConfig = ({
},
module: {
rules: [
- {
- test: /\.(woff|woff2)$/,
- use: {
- loader: require.resolve('url-loader'),
- },
- },
{
test: /\.css$/i,
use: [require.resolve('style-loader'), require.resolve('css-loader')],
@@ -161,8 +155,21 @@ export const webpackConfig = ({
: null,
].filter(truthy),
},
+ {
+ test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
+ use: [
+ {
+ loader: require.resolve('file-loader'),
+ options: {
+ name: '[name].[ext]',
+ outputPath: 'fonts/',
+ },
+ },
+ ],
+ },
{
test: /\.jsx?$/,
+ exclude: /node_modules/,
use: [
{
loader: require.resolve('esbuild-loader'),
@@ -171,6 +178,13 @@ export const webpackConfig = ({
target: 'chrome85',
},
},
+ environment === 'development'
+ ? {
+ loader: require.resolve(
+ '@webhotelier/webpack-fast-refresh/loader.js'
+ ),
+ }
+ : null,
].filter(truthy),
},
],
diff --git a/packages/cli/package.json b/packages/cli/package.json
index c2286baee6..ae1f24ba99 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/cli",
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "CLI for Remotion",
"main": "dist/index.js",
"sideEffects": false,
@@ -19,17 +19,17 @@
"author": "Jonny Burger <[email protected]>",
"license": "SEE LICENSE IN LICENSE.md",
"dependencies": {
- "@remotion/bundler": "2.1.9",
- "@remotion/media-utils": "2.1.9",
- "@remotion/player": "2.1.9",
- "@remotion/renderer": "2.1.9",
+ "@remotion/bundler": "2.1.11",
+ "@remotion/media-utils": "2.1.11",
+ "@remotion/player": "2.1.11",
+ "@remotion/renderer": "2.1.11",
"ansi-diff": "^1.1.1",
"better-opn": "^2.1.1",
"chalk": "^4.1.0",
"dotenv": "^9.0.0",
"execa": "^4.0.2",
"minimist": "^1.2.5",
- "remotion": "2.1.9",
+ "remotion": "2.1.11",
"semver": "^7.3.4",
"webpack": "5.37.0",
"xns": "^2.0.7"
diff --git a/packages/cli/src/editor/components/Timeline/TimelineListItem.tsx b/packages/cli/src/editor/components/Timeline/TimelineListItem.tsx
index 671e55f08c..a231d53cc8 100644
--- a/packages/cli/src/editor/components/Timeline/TimelineListItem.tsx
+++ b/packages/cli/src/editor/components/Timeline/TimelineListItem.tsx
@@ -7,6 +7,7 @@ import {
} from '../../helpers/timeline-layout';
import {TimelineActionState} from './timeline-state-reducer';
import {TimelineCollapseToggle} from './TimelineCollapseToggle';
+import {TimelineSequenceFrame} from './TimelineSequenceFrame';
const HOOK_WIDTH = 7;
const BORDER_BOTTOM_LEFT_RADIUS = 2;
@@ -130,7 +131,13 @@ export const TimelineListItem: React.FC<{
<div style={space} />
</>
) : null}
- {text}
+ <div>
+ {text || 'Untitled'}
+ <TimelineSequenceFrame
+ duration={sequence.duration}
+ from={sequence.from}
+ />
+ </div>
</div>
);
};
diff --git a/packages/cli/src/editor/components/Timeline/TimelineSequenceFrame.tsx b/packages/cli/src/editor/components/Timeline/TimelineSequenceFrame.tsx
new file mode 100644
index 0000000000..d7c6dc27a8
--- /dev/null
+++ b/packages/cli/src/editor/components/Timeline/TimelineSequenceFrame.tsx
@@ -0,0 +1,42 @@
+import React from 'react';
+import {useCurrentFrame, useVideoConfig} from 'remotion';
+import {renderFrame} from '../../state/render-frame';
+
+const relativeFrameStyle: React.CSSProperties = {
+ fontSize: 12,
+ fontFamily: 'Arial, Helvetica, sans-serif',
+ color: 'white',
+ opacity: 0.6,
+ marginTop: 2,
+ cursor: 'help',
+};
+
+export const TimelineSequenceFrame: React.FC<{
+ from: number;
+ duration: number;
+}> = ({from, duration}) => {
+ const frame = useCurrentFrame();
+ const {fps} = useVideoConfig();
+ const relativeFrame = frame - from;
+
+ const isInRange = relativeFrame >= 0 && relativeFrame < duration;
+
+ if (!isInRange) {
+ return null;
+ }
+
+ return (
+ <div
+ title={`
+The current time within the sequence.
+
+Call \`useCurrentFrame()\` within the sequence to get the time programmatically.
+
+Call \`const {durationInFrames} = useVideoConfig()\` to get the duration of the sequence.
+`.trim()}
+ style={relativeFrameStyle}
+ >
+ {renderFrame(relativeFrame, fps)} ({relativeFrame})
+ </div>
+ );
+};
diff --git a/packages/cli/src/get-config-file-name.ts b/packages/cli/src/get-config-file-name.ts
index fccb890513..e6543a7b8a 100644
--- a/packages/cli/src/get-config-file-name.ts
+++ b/packages/cli/src/get-config-file-name.ts
@@ -1,8 +1,13 @@
import {parsedCli} from './parse-command-line';
-const defaultConfigFile = 'remotion.config.ts';
+let defaultConfigFile = 'remotion.config.ts';
+const defaultConfigFileJavascript = 'remotion.config.js';
+const defaultConfigFileTypescript = 'remotion.config.ts';
-export const getConfigFileName = (): string => {
+export const getConfigFileName = (isJavascript: boolean): string => {
+ defaultConfigFile = isJavascript
+ ? defaultConfigFileJavascript
+ : defaultConfigFileTypescript;
return parsedCli.config ?? defaultConfigFile;
};
diff --git a/packages/cli/src/get-filename.ts b/packages/cli/src/get-filename.ts
index 00b73a4842..8b8601636c 100644
--- a/packages/cli/src/get-filename.ts
+++ b/packages/cli/src/get-filename.ts
@@ -31,6 +31,12 @@ export const getOutputFilename = (
extension = 'mp4';
}
+ if (codec === 'h264-mkv') {
+ Log.info('No file extension specified, adding .mkv automatically.');
+ filename += '.mkv';
+ extension = 'mkv';
+ }
+
if (codec === 'vp8' || codec === 'vp9') {
Log.info('No file extension specified, adding .webm automatically.');
filename += '.webm';
@@ -45,9 +51,9 @@ export const getOutputFilename = (
}
if (codec === 'h264') {
- if (extension !== 'mp4') {
+ if (extension !== 'mp4' && extension !== 'mkv') {
Log.error(
- 'When using the H264 codec, the output filename must end in .mp4.'
+ 'When using the H264 codec, the output filename must end in .mp4 or .mkv.'
);
process.exit(1);
}
diff --git a/packages/cli/src/image-formats.ts b/packages/cli/src/image-formats.ts
index f01b66d62d..2dbbd256f8 100644
--- a/packages/cli/src/image-formats.ts
+++ b/packages/cli/src/image-formats.ts
@@ -15,6 +15,7 @@ export const getImageFormat = (
if (
codec === 'h264' ||
+ codec === 'h264-mkv' ||
codec === 'h265' ||
codec === 'vp8' ||
codec === 'vp9' ||
diff --git a/packages/cli/src/is-javascript.ts b/packages/cli/src/is-javascript.ts
new file mode 100644
index 0000000000..f927cc6f7a
--- /dev/null
+++ b/packages/cli/src/is-javascript.ts
@@ -0,0 +1,8 @@
+const isJavascript = (fullPath: string): boolean => {
+ const splitFullPath = fullPath.split('.');
+ const extension = splitFullPath[splitFullPath.length - 1];
+
+ return extension === 'jsx' || extension === 'js';
+};
+
+export {isJavascript};
diff --git a/packages/cli/src/load-config.ts b/packages/cli/src/load-config.ts
index 1311232103..b9d7e6dd48 100644
--- a/packages/cli/src/load-config.ts
+++ b/packages/cli/src/load-config.ts
@@ -4,47 +4,63 @@ import typescript from 'typescript';
import {isDefaultConfigFile} from './get-config-file-name';
import {Log} from './log';
-export const loadConfigFile = (configFileName: string): string | null => {
- const configFile = path.resolve(process.cwd(), configFileName);
- const tsconfigJson = path.join(process.cwd(), 'tsconfig.json');
- if (!fs.existsSync(tsconfigJson)) {
- Log.error(
- 'Could not find a tsconfig.json file in your project. Did you delete it? Create a tsconfig.json in the root of your project. Copy the default file from https://github.com/remotion-dev/template/blob/main/tsconfig.json.'
- );
- process.exit(1);
- }
-
- if (!fs.existsSync(configFile)) {
- if (!isDefaultConfigFile(configFileName)) {
+export const loadConfigFile = (
+ configFileName: string,
+ isJavascript: boolean
+): string | null => {
+ if (!isJavascript) {
+ const configFile = path.resolve(process.cwd(), configFileName);
+ const tsconfigJson = path.join(process.cwd(), 'tsconfig.json');
+ if (!fs.existsSync(tsconfigJson)) {
Log.error(
- `You specified a config file located at ${configFileName}, but no file at ${configFile} could be found.`
+ 'Could not find a tsconfig.json file in your project. Did you delete it? Create a tsconfig.json in the root of your project. Copy the default file from https://github.com/remotion-dev/template/blob/main/tsconfig.json.'
);
process.exit(1);
}
- return null;
- }
+ if (!fs.existsSync(configFile)) {
+ if (!isDefaultConfigFile(configFileName)) {
+ Log.error(
+ `You specified a config file located at ${configFileName}, but no file at ${configFile} could be found.`
+ );
+ process.exit(1);
+ }
- const tsConfig = typescript.readConfigFile(
- tsconfigJson,
- typescript.sys.readFile
- );
+ return null;
+ }
- const compilerOptions = typescript.parseJsonConfigFileContent(
- tsConfig.config,
- typescript.sys,
- './'
- );
+ const tsConfig = typescript.readConfigFile(
+ tsconfigJson,
+ typescript.sys.readFile
+ );
- const output = typescript.transpileModule(
- fs.readFileSync(configFile, 'utf-8'),
- {
- compilerOptions: compilerOptions.options,
- }
+ const compilerOptions = typescript.parseJsonConfigFileContent(
+ tsConfig.config,
+ typescript.sys,
+ './'
+ );
+
+ const output = typescript.transpileModule(
+ fs.readFileSync(configFile, 'utf-8'),
+ {
+ compilerOptions: compilerOptions.options,
+ }
+ );
+
+ // eslint-disable-next-line no-eval
+ eval(output.outputText);
+
+ return configFileName;
+ }
+
+ const configFiles = path.resolve(process.cwd(), configFileName);
+ const outputs = typescript.transpileModule(
+ fs.readFileSync(configFiles, 'utf-8'),
+ {}
);
// eslint-disable-next-line no-eval
- eval(output.outputText);
+ eval(outputs.outputText);
return configFileName;
};
diff --git a/packages/cli/src/preview.ts b/packages/cli/src/preview.ts
index 2ed2cc45f5..a9599d1ded 100644
--- a/packages/cli/src/preview.ts
+++ b/packages/cli/src/preview.ts
@@ -8,6 +8,7 @@ import xns from 'xns';
import {getConfigFileName} from './get-config-file-name';
import {getEnvironmentVariables} from './get-env';
import {getInputProps} from './get-input-props';
+import {isJavascript} from './is-javascript';
import {loadConfigFile} from './load-config';
import {parsedCli} from './parse-command-line';
@@ -18,7 +19,9 @@ export const previewCommand = xns(async () => {
const {port: desiredPort} = parsedCli;
const fullPath = path.join(process.cwd(), file);
- loadConfigFile(getConfigFileName());
+ const isFileJavascript = isJavascript(fullPath);
+
+ loadConfigFile(getConfigFileName(isFileJavascript), isFileJavascript);
const inputProps = getInputProps();
const envVariables = await getEnvironmentVariables();
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 9d0a5ad25e..66610dc66b 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -15,6 +15,7 @@ import {Internals} from 'remotion';
import {getCliOptions} from './get-cli-options';
import {getCompositionId} from './get-composition-id';
import {getConfigFileName} from './get-config-file-name';
+import {isJavascript} from './is-javascript';
import {loadConfigFile} from './load-config';
import {Log} from './log';
import {parseCommandLine, parsedCli} from './parse-command-line';
@@ -61,8 +62,10 @@ export const render = async () => {
const file = parsedCli._[1];
const fullPath = path.join(process.cwd(), file);
- const configFileName = getConfigFileName();
- const appliedName = loadConfigFile(configFileName);
+ const isFileJavascript = isJavascript(fullPath);
+
+ const configFileName = getConfigFileName(isFileJavascript);
+ const appliedName = loadConfigFile(configFileName, isFileJavascript);
parseCommandLine();
if (appliedName) {
Log.verbose(`Applied configuration from ${appliedName}.`);
diff --git a/packages/core/package.json b/packages/core/package.json
index 161cfb652b..7ef9b09451 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
{
"name": "remotion",
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "Render videos in React",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/packages/core/src/config/codec.ts b/packages/core/src/config/codec.ts
index 384a580352..e12075692a 100644
--- a/packages/core/src/config/codec.ts
+++ b/packages/core/src/config/codec.ts
@@ -7,6 +7,7 @@ const validCodecs = [
'aac',
'wav',
'prores',
+ 'h264-mkv',
] as const;
export type Codec = typeof validCodecs[number];
@@ -102,6 +103,16 @@ export const getFinalOutputCodec = ({
return 'aac';
}
+ if (inputCodec === undefined && fileExtension === 'mkv') {
+ if (emitWarning) {
+ console.info(
+ 'You have specified a .mkv extension, using the H264 encoder and WAV audio format.'
+ );
+ }
+
+ return 'h264-mkv';
+ }
+
return inputCodec ?? DEFAULT_CODEC;
};
diff --git a/packages/core/src/config/crf.ts b/packages/core/src/config/crf.ts
index 3ece1d34a3..3bc17c0142 100644
--- a/packages/core/src/config/crf.ts
+++ b/packages/core/src/config/crf.ts
@@ -22,7 +22,7 @@ export const getDefaultCrfForCodec = (codec: Codec): number => {
return 0;
}
- if (codec === 'h264') {
+ if (codec === 'h264' || codec === 'h264-mkv') {
return 18; // FFMPEG default 23
}
@@ -54,7 +54,7 @@ export const getValidCrfRanges = (codec: Codec): [number, number] => {
return [0, 0];
}
- if (codec === 'h264') {
+ if (codec === 'h264' || codec === 'h264-mkv') {
return [1, 51];
}
@@ -78,7 +78,7 @@ export const validateSelectedCrfAndCodecCombination = (
codec: Codec
) => {
const range = getValidCrfRanges(codec);
- if (crf === 0 && codec === 'h264') {
+ if (crf === 0 && (codec === 'h264' || codec === 'h264-mkv')) {
throw new TypeError(
"Setting the CRF to 0 with a H264 codec is not supported anymore because of it's inconsistencies between platforms. Videos with CRF 0 cannot be played on iOS/macOS. 0 is a extreme value with inefficient settings which you probably want. Set CRF to a higher value to fix this error."
);
diff --git a/packages/core/src/get-environment.ts b/packages/core/src/get-environment.ts
index cb866d26d9..a910d9847c 100644
--- a/packages/core/src/get-environment.ts
+++ b/packages/core/src/get-environment.ts
@@ -13,14 +13,6 @@ export const getRemotionEnvironment = (): RemotionEnvironment => {
return 'rendering';
}
- if (process.env.NODE_ENV === 'development') {
- if (typeof window !== 'undefined' && window.remotion_isPlayer) {
- return 'player-development';
- }
-
- return 'preview';
- }
-
// The Jest framework sets NODE_ENV as test.
// Right now we don't need to treat it in a special
// way which is good - defaulting to `rendering`.
@@ -28,5 +20,9 @@ export const getRemotionEnvironment = (): RemotionEnvironment => {
return 'rendering';
}
- throw new Error('Cannot determine Remotion environment');
+ if (typeof window !== 'undefined' && window.remotion_isPlayer) {
+ return 'player-development';
+ }
+
+ return 'preview';
};
diff --git a/packages/core/src/test/codec.test.ts b/packages/core/src/test/codec.test.ts
index 9e1af7db9c..4c659e9be4 100644
--- a/packages/core/src/test/codec.test.ts
+++ b/packages/core/src/test/codec.test.ts
@@ -4,7 +4,7 @@ import {
getOutputCodecOrUndefined,
setCodec,
} from '../config/codec';
-import {expectToThrow} from "./expect-to-throw";
+import {expectToThrow} from './expect-to-throw';
// getFinalOutputCodec
@@ -17,8 +17,9 @@ describe('Codec tests valid codec input', () => {
'mp3',
'aac',
'wav',
+ 'h264-mkv',
];
- validCodecInput.forEach(entry =>
+ validCodecInput.forEach((entry) =>
test(`codec ${entry}`, () =>
expect(
getFinalOutputCodec({
@@ -61,7 +62,7 @@ describe('Codec tests undefined codec input with known extension', () => {
describe('Codec tests undefined codec input with unknown extension', () => {
const unknownExtensions = ['', 'abc'];
- unknownExtensions.forEach(entry =>
+ unknownExtensions.forEach((entry) =>
test(`testing with "${entry}" as extension`, () =>
expect(
getFinalOutputCodec({
@@ -83,14 +84,17 @@ describe('Codec tests setOutputFormat', () => {
'vp9',
undefined,
];
- validCodecInputs.forEach(entry =>
+ validCodecInputs.forEach((entry) =>
test(`testing with ${entry}`, () => {
setCodec(entry);
expect(getOutputCodecOrUndefined()).toEqual(entry);
})
);
test('setCodec with invalid coded', () => {
- // @ts-expect-error
- expectToThrow(() => setCodec('invalid'), /Codec must be one of the following:/)
- })
+ expectToThrow(
+ // @ts-expect-error
+ () => setCodec('invalid'),
+ /Codec must be one of the following:/
+ );
+ });
});
diff --git a/packages/create-video/package.json b/packages/create-video/package.json
index 8080505edd..7bf1a8211b 100644
--- a/packages/create-video/package.json
+++ b/packages/create-video/package.json
@@ -1,6 +1,6 @@
{
"name": "create-video",
- "version": "2.1.9",
+ "version": "2.1.10",
"description": "",
"main": "index.js",
"bin": {
diff --git a/packages/docs/components/ColorDemo/Big.tsx b/packages/docs/components/ColorDemo/Big.tsx
index 85c951e495..1db31f3435 100644
--- a/packages/docs/components/ColorDemo/Big.tsx
+++ b/packages/docs/components/ColorDemo/Big.tsx
@@ -7,12 +7,7 @@ import {
useVideoConfig,
} from "remotion";
import { getReadableColor } from "./readable-color";
-
-const container: React.CSSProperties = {
- fontFamily:
- "--apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif",
- fontWeight: "bold",
-};
+import { defaultStyles } from './styles';
export const Big: React.FC<{
color: string;
@@ -29,11 +24,7 @@ export const Big: React.FC<{
return (
<AbsoluteFill
style={{
- ...container,
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- flex: 1,
+ ...defaultStyles,
color: getReadableColor(color),
fontSize: 150,
}}
diff --git a/packages/docs/components/ColorDemo/Shade/index.tsx b/packages/docs/components/ColorDemo/ColorName.tsx
similarity index 59%
rename from packages/docs/components/ColorDemo/Shade/index.tsx
rename to packages/docs/components/ColorDemo/ColorName.tsx
index e54a7685c3..b0e4c34964 100644
--- a/packages/docs/components/ColorDemo/Shade/index.tsx
+++ b/packages/docs/components/ColorDemo/ColorName.tsx
@@ -1,7 +1,12 @@
import namer from 'color-namer';
import React from 'react';
-import {spring, useCurrentFrame, useVideoConfig} from 'remotion';
-import {getReadableColor} from '../readable-color';
+import {
+ spring,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
+import { getReadableColor } from './readable-color';
+import { defaultStyles } from './styles';
export const Shade: React.FC<{
color: string;
@@ -19,16 +24,8 @@ export const Shade: React.FC<{
return (
<div
style={{
- display: 'flex',
- justifyContent: 'center',
- alignItems: 'center',
- fontFamily:
- "--apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif",
- fontWeight: 'bold',
- fontSize: 100,
- lineHeight: 1.1,
+ ...defaultStyles,
backgroundColor: getReadableColor(color),
- flex: 1,
color,
}}
>
diff --git a/packages/docs/components/ColorDemo/Name.tsx b/packages/docs/components/ColorDemo/Name.tsx
index ae6c71cbf5..d3e60f0b0d 100644
--- a/packages/docs/components/ColorDemo/Name.tsx
+++ b/packages/docs/components/ColorDemo/Name.tsx
@@ -6,12 +6,7 @@ import {
useCurrentFrame,
useVideoConfig,
} from "remotion";
-
-const container: React.CSSProperties = {
- fontFamily:
- "--apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif",
- fontWeight: "bold",
-};
+import { defaultStyles } from './styles';
export const Name: React.FC<{
name: string;
@@ -28,25 +23,23 @@ export const Name: React.FC<{
return (
<AbsoluteFill
style={{
- ...container,
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- flex: 1,
- fontSize: 100,
+ ...defaultStyles,
backgroundColor: "white",
color: "black",
}}
>
- <div>
+ <div
+ style={{
+ transform: `translateY(${interpolate(
+ progress,
+ [0, 1],
+ [1000, 0]
+ )}px)`,
+ }}
+ >
<span
style={{
display: "block",
- transform: `translateY(${interpolate(
- progress,
- [0, 1],
- [1000, 0]
- )}px)`,
lineHeight: 1.1,
}}
>
@@ -55,11 +48,6 @@ export const Name: React.FC<{
<span
style={{
display: "block",
- transform: `translateY(${interpolate(
- progress,
- [0, 1],
- [1000, 0]
- )}px)`,
lineHeight: 1.1,
}}
>
diff --git a/packages/docs/components/ColorDemo/Palette/index.tsx b/packages/docs/components/ColorDemo/Palette.tsx
similarity index 69%
rename from packages/docs/components/ColorDemo/Palette/index.tsx
rename to packages/docs/components/ColorDemo/Palette.tsx
index 337144f7a6..3f1d4bc768 100644
--- a/packages/docs/components/ColorDemo/Palette/index.tsx
+++ b/packages/docs/components/ColorDemo/Palette.tsx
@@ -1,16 +1,13 @@
-import {shade, tint} from 'polished';
+import { shade, tint } from 'polished';
import React from 'react';
-import {interpolate, spring, useCurrentFrame, useVideoConfig} from 'remotion';
-import {getReadableColor} from '../readable-color';
-
-const outer: React.CSSProperties = {
- display: 'flex',
- justifyContent: 'center',
- alignItems: 'center',
- flex: 1,
- fontFamily:
- "--apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif",
-};
+import {
+ interpolate,
+ spring,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
+import { getReadableColor } from './readable-color';
+import { defaultStyles } from './styles';
export const Palette: React.FC<{
color: string;
@@ -20,14 +17,14 @@ export const Palette: React.FC<{
const scale = interpolate(frame, [0, 50, 70], [0.8, 1.8, 10], {});
return (
- <div style={outer}>
+ <div style={defaultStyles}>
<div
style={{
+ display: 'flex',
flex: 1,
flexDirection: 'row',
width: width * 0.6,
height: height * 0.6,
- display: 'flex',
position: 'absolute',
transform: `scale(${scale})`,
}}
diff --git a/packages/docs/components/ColorDemo/Colors/index.tsx b/packages/docs/components/ColorDemo/RGBColors.tsx
similarity index 78%
rename from packages/docs/components/ColorDemo/Colors/index.tsx
rename to packages/docs/components/ColorDemo/RGBColors.tsx
index 5adf700c0b..2d17622fd6 100644
--- a/packages/docs/components/ColorDemo/Colors/index.tsx
+++ b/packages/docs/components/ColorDemo/RGBColors.tsx
@@ -1,16 +1,12 @@
import { parseToRgb } from "polished";
import React from "react";
-import { interpolate, spring, useCurrentFrame, useVideoConfig } from "remotion";
-
-const container: React.CSSProperties = {
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
- fontFamily:
- "--apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif",
- fontWeight: "bold",
- fontSize: 30,
-};
+import {
+ interpolate,
+ spring,
+ useCurrentFrame,
+ useVideoConfig,
+} from "remotion";
+import { defaultStyles } from './styles';
const BAR_SCALE_FACTOR = 1.5;
const TOP_PANEL = 100;
@@ -22,10 +18,6 @@ const row: React.CSSProperties = {
height: BAR_SCALE_FACTOR * 255 + TOP_PANEL,
};
-const bar: React.CSSProperties = {
- borderRadius: 10,
-};
-
const rgb = ["#ff7979", "#badc58", "#3498db"];
export const Colors: React.FC<{
@@ -49,11 +41,9 @@ export const Colors: React.FC<{
return (
<div
style={{
- ...container,
- flex: 1,
- justifyContent: "center",
- alignItems: "center",
+ ...defaultStyles,
backgroundColor: "white",
+ fontSize: 30,
}}
>
<div style={row}>
@@ -76,18 +66,23 @@ export const Colors: React.FC<{
overflow: "hidden",
}}
>
- <span style={{ opacity: barProgress, fontSize: 80 }}>
+ <span
+ style={{
+ opacity: barProgress,
+ fontSize: 80
+ }}
+ >
{String(color)}
</span>
</div>
<div
key={index}
style={{
- ...bar,
width: 250,
marginLeft: barMargin,
marginRight: barMargin,
height: color * BAR_SCALE_FACTOR * barProgress,
+ borderRadius: 10,
backgroundColor: rgb[index],
}}
/>
diff --git a/packages/docs/components/ColorDemo/Main.tsx b/packages/docs/components/ColorDemo/index.tsx
similarity index 78%
rename from packages/docs/components/ColorDemo/Main.tsx
rename to packages/docs/components/ColorDemo/index.tsx
index 4387a20db1..ddecdb0680 100644
--- a/packages/docs/components/ColorDemo/Main.tsx
+++ b/packages/docs/components/ColorDemo/index.tsx
@@ -1,13 +1,13 @@
-import {parseToRgb} from 'polished';
+import { parseToRgb } from 'polished';
import React from 'react';
-import {AbsoluteFill, Sequence} from 'remotion';
-import {Big} from './Big';
-import {Colors} from './Colors';
-import {Name} from './Name';
-import {Palette} from './Palette';
-import {Shade} from './Shade';
+import { AbsoluteFill, Sequence } from 'remotion';
+import { Big } from './Big';
+import { Colors } from './RGBColors';
+import { Name } from './Name';
+import { Palette } from './Palette';
+import { Shade } from './ColorName';
-export const Main: React.FC<{
+export const ColorDemo: React.FC<{
color: string;
name: string;
}> = ({color, name}) => {
diff --git a/packages/docs/components/ColorDemo/readable-color.ts b/packages/docs/components/ColorDemo/readable-color.ts
index de27e5b107..6c44e9a700 100644
--- a/packages/docs/components/ColorDemo/readable-color.ts
+++ b/packages/docs/components/ColorDemo/readable-color.ts
@@ -1,4 +1,4 @@
-import {getLuminance} from 'polished';
+import { getLuminance } from 'polished';
export const getReadableColor = (color: string): string => {
const luminance = getLuminance(color);
diff --git a/packages/docs/components/ColorDemo/styles.tsx b/packages/docs/components/ColorDemo/styles.tsx
new file mode 100644
index 0000000000..53ea0a598f
--- /dev/null
+++ b/packages/docs/components/ColorDemo/styles.tsx
@@ -0,0 +1,13 @@
+import React from "react";
+
+export const defaultStyles: React.CSSProperties = {
+ display: "flex",
+ flex: 1,
+ justifyContent: "center",
+ alignItems: "center",
+ fontFamily:
+ "--apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif",
+ fontWeight: "bold",
+ fontSize: 100,
+ lineHeight: 1.1,
+};
diff --git a/packages/docs/components/LandingPage/PlayerPreview.tsx b/packages/docs/components/LandingPage/PlayerPreview.tsx
index 293ab26470..6bc52a31a9 100644
--- a/packages/docs/components/LandingPage/PlayerPreview.tsx
+++ b/packages/docs/components/LandingPage/PlayerPreview.tsx
@@ -14,7 +14,7 @@ export const PlayerPreview: React.FC = () => {
style={{
boxShadow: "var(--box-shadow)",
}}
- src="http://i3.ytimg.com/vi/gwlDorikqgY/maxresdefault.jpg"
+ src="https://i3.ytimg.com/vi/gwlDorikqgY/maxresdefault.jpg"
></img>
<div
style={{
diff --git a/packages/docs/components/Player.tsx b/packages/docs/components/Player.tsx
index 2e581e8e52..b20919ed19 100644
--- a/packages/docs/components/Player.tsx
+++ b/packages/docs/components/Player.tsx
@@ -1,6 +1,6 @@
import { Player } from "@remotion/player";
import React, { useState } from "react";
-import { Main } from "./ColorDemo/Main";
+import { ColorDemo } from "./ColorDemo";
import "./input-fields.css";
export const PlayerExample: React.FC = () => {
@@ -10,7 +10,7 @@ export const PlayerExample: React.FC = () => {
return (
<div>
<Player
- component={Main}
+ component={ColorDemo}
compositionWidth={1280}
compositionHeight={720}
controls
@@ -33,6 +33,9 @@ export const PlayerExample: React.FC = () => {
placeholder="Your name"
value={name}
onChange={(e) => setName(e.target.value)}
+ style={{
+ backgroundColor: "#fffee4",
+ }}
/>
</p>
<p>
diff --git a/packages/docs/docs/animating-properties.md b/packages/docs/docs/animating-properties.md
index 8b90bc07c0..a4eb1a2488 100644
--- a/packages/docs/docs/animating-properties.md
+++ b/packages/docs/docs/animating-properties.md
@@ -91,3 +91,9 @@ export const MyVideo = () => {
```
You should see the text 'jump in'. The default spring configuration leads to a little bit of overshoot, meaning the text will bounce a little bit. See the reference page about the `spring` function to learn how to customize your spring animations.
+
+## Always animate using `useCurrentFrame()`
+
+Watch out for flickering issues during rendering that arise if you write animations that are not driven by [`useCurrentFrame()`](/docs/use-current-frame) - for example CSS transitions.
+
+[Read more about how Remotion's rendering works](/docs/flickering) - understanding it will help you avoid issues down the road.
diff --git a/packages/docs/docs/cli.md b/packages/docs/docs/cli.md
index 21701a747e..55be0a5c86 100644
--- a/packages/docs/docs/cli.md
+++ b/packages/docs/docs/cli.md
@@ -55,7 +55,7 @@ Specify a location for a dotenv file. Default `.env`. Available in v2.2 and late
### `--codec`
-[`h264` or `h265` or `png` or `vp8` or `vp9` or `mp3` or `aac` or `wav` or `prores`](/docs/config#setcodec). If you don't supply `--codec`, it will use the H.264 encoder. Available since v1.4.
+[`h264` or `h265` or `png` or `vp8` or `vp9` or `mp3` or `aac` or `wav` or `prores` or `h264-mkv`](/docs/config#setcodec). If you don't supply `--codec`, it will use the H.264 encoder. Available since v1.4.
### `--prores-profile`
diff --git a/packages/docs/docs/config.mdx b/packages/docs/docs/config.mdx
index 047549988a..99700d4dc9 100644
--- a/packages/docs/docs/config.mdx
+++ b/packages/docs/docs/config.mdx
@@ -213,6 +213,7 @@ Choose one of the supported codecs: `h264` _(default)_, `h265`, `vp8`, `vp9`.
- `mp3` will export audio only as an MP3 file _(available from v2.0)_
- `wav` will export audio only as an WAV file _(available from v2.0)_
- `aac` will export audio only as an AAC file _(available from v2.0)_
+- `mkv` will export using H264 codec, MKV container format and WAV audio codec. _(available from v2.1.12)_
```tsx
Config.Output.setCodec('h265');
diff --git a/packages/docs/docs/easing.md b/packages/docs/docs/easing.md
index d61436ef63..c2f16009c1 100644
--- a/packages/docs/docs/easing.md
+++ b/packages/docs/docs/easing.md
@@ -52,7 +52,7 @@ import {interpolate, Easing} from 'remotion';
const MyVideo: React.FC = () => {
const frame = useCurrentFrame();
- const interpolated = interpolate(frame, [0, 100], {
+ const interpolated = interpolate(frame, [0, 100], [0, 1], {
easing: Easing.bezier(0.8, 0.22, 0.96, 0.65),
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
diff --git a/packages/docs/docs/encoding.md b/packages/docs/docs/encoding.md
index 0aae16ad57..a35894a930 100644
--- a/packages/docs/docs/encoding.md
+++ b/packages/docs/docs/encoding.md
@@ -19,7 +19,7 @@ Remotion supports 5 video codecs: `h264` (_default_), `h265`, `vp8`, `vp9`, `pro
</tr>
<tr>
<td>H.264 <sub>also known as MPEG-4</sub></td>
- <td>.mp4</td>
+ <td>.mp4 or .mkv</td>
<td style={{color: 'red'}}>Large</td>
<td style={{color: 'green', fontWeight: 'bold'}}>Very fast</td>
<td><a href="https://caniuse.com/mpeg4" style={{color: 'green', fontWeight: 'bold'}}>Very good</a></td>
@@ -227,6 +227,14 @@ Higher bitrate means higher quality and higher file size.
You can pass `mp3`, `wav` or `aac` as a codec. If you do it, an audio file will be output in the corresponding format. Quality settings will be ignored.
+## Use .mkv container format
+
+You can set the codec to `h264-mkv` to use the mkv container format together with the H264 codec. If you select this option, the audio will be encoded losslessly using the WAV codec.
+
+:::info
+This preset was created for Remotion Lambda, and is optimal for when concatenating multiple video clips into one.
+:::
+
## What other settings do you need?
Which of the dozens of options that FFMPEG supports would you like to see exposed in Remotion? Let us know by opening an [issue on our issue tracker!](https://github.com/remotion-dev/remotion/issues)
diff --git a/packages/docs/docs/flickering.md b/packages/docs/docs/flickering.md
new file mode 100644
index 0000000000..f9bfae69d4
--- /dev/null
+++ b/packages/docs/docs/flickering.md
@@ -0,0 +1,41 @@
+---
+id: flickering
+title: Flickering
+---
+
+If your video flickers or suffers from choppyness during rendering, it is an indication that you have a **multi-threading issue**.
+
+The rendering process of Remotion works as follows:
+
+<img src="/img/parallel-rendering.png" />
+
+We open multiple tabs to render the video to speed up the process dramatically. These tabs don't share state and animations that run independent of [`useCurrentFrame()`](/docs/use-current-frame) will break. Frames don't render in order and frames can be skipped.
+
+## Solution
+
+You need to code your video in a way that animations run purely off the value of [`useCurrentFrame()`](/docs/use-current-frame). Think of your component as a function that transforms a frame number into an image. Make sure you check all these boxes:
+
+- [x] Your component should always display the same image when called multiple times.
+- [x] Your component should not rely on frames being rendered sequentially.
+- [x] Your component should not animate when the video is paused.
+- [x] Your component should not rely on randomness - [Exception: `random()`](/docs/random)
+
+## Integrations
+
+Often the problem arises from using other animation techniques than the ones built into Remotion. These techniques animate based off realtime instead of `useCurrentFrame()`. Sometimes we can apply a patch to synchronize other animation techniques with Remotion.
+
+Head over to [**the list of integrations**](/docs/third-party) to see if there is an integration for your animation technique.
+
+## Bypass multithreading
+
+If your animation will not break if the frames are rendered in order, users often use the [`--concurrency=1`](/docs/cli#--concurrency) flag. This will fix flickering / choppyness in many cases and is a viable path if the effort of refactoring is too big. The drawback of this technique is that it is way slower and that the correct timing of the animations is still not guaranteed.
+
+## Why Remotion works this way
+
+We commonly get asked if Remotion would consider changing the way how it renders. While we are always have an open ear for how to improve Remotion, the following points need to be considered:
+
+- Rendering speed is of critical importance for many Remotion users, especially those who are relying on server-side rendering. Rendering each frame sequentially would be detrimental for speed, a sacrifice that is not worth it when it's possible to write concurrency-safe videos.
+
+- Setting `--concurrency=1` on a video that would be choppy otherwise does not fully fix the problem. Often the result looks okay only because of coincidence, because the rendering speed is approximately the same as the animation speed. There is no real timing synchronization and results will differ across machines.
+
+- Multithreading is very important for future ideas such as [rendering on AWS Lambda](https://github.com/remotion-dev/remotion/pull/423). Using this integration, you can render a video much faster by rendering it on multiple computers at the same time. All you need for it is a video that is programmed in a concurrency-safe way.
diff --git a/packages/docs/docs/overwriting-webpack-config.md b/packages/docs/docs/overwriting-webpack-config.md
index 25aca164bc..5e74c4a6d3 100644
--- a/packages/docs/docs/overwriting-webpack-config.md
+++ b/packages/docs/docs/overwriting-webpack-config.md
@@ -85,6 +85,94 @@ Config.Bundling.overrideWebpackConfig((currentConfiguration) => {
Create a file which contains `declare module '*.mdx';` in your project to fix a TypeScript error showing up.
:::
+### Enable TailwindCSS support
+
+1. Install the following dependencies:
+
+<Tabs
+defaultValue="npm"
+values={[
+{ label: 'npm', value: 'npm', },
+{ label: 'yarn', value: 'yarn', },
+]
+}>
+<TabItem value="npm">
+
+```bash
+npm i postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
+```
+
+ </TabItem>
+
+ <TabItem value="yarn">
+
+```bash
+yarn add postcss-loader postcss postcss-preset-env tailwindcss autoprefixer
+```
+
+ </TabItem>
+</Tabs>
+
+2. Add the following to your [`remotion.config.ts`](/docs/config) file:
+
+```ts
+Config.Bundling.overrideWebpackConfig((currentConfiguration) => {
+ return {
+ ...currentConfiguration,
+ module: {
+ ...currentConfiguration.module,
+ rules: [
+ ...(currentConfiguration.module?.rules
+ ? currentConfiguration.module.rules
+ : []
+ ).filter((rule) => {
+ if (rule === "...") {
+ return false;
+ }
+ if (rule.test?.toString().includes(".css")) {
+ return false;
+ }
+ return true;
+ }),
+ {
+ test: /\.css$/i,
+ use: [
+ "style-loader",
+ "css-loader",
+ {
+ loader: "postcss-loader",
+ options: {
+ postcssOptions: {
+ plugins: ["postcss-preset-env", "tailwindcss"],
+ },
+ },
+ },
+ ],
+ },
+ ],
+ },
+ };
+});
+```
+
+3. Create a file `src/style.css` with the following content:
+
+```css
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
+```
+
+4. Import the stylesheet in your `src/index.ts` file. Add to the top of the file:
+
+```js
+import "/style.css";
+```
+
+5. Start using TailwindCSS! You can verify that it's working by adding `className="bg-red-900"` to any element.
+
+6. _Optional_: Add a `tailwind.config.js` file to the root of your project. Add `/* eslint-env node */` to the top of the file to get rid of an ESLint rule complaining that `module` is not defined.
+
### Enable SASS/SCSS support
1. Install the following dependencies:
diff --git a/packages/docs/docs/ssr.md b/packages/docs/docs/ssr.md
index 73ec81f6a9..969b83ad83 100644
--- a/packages/docs/docs/ssr.md
+++ b/packages/docs/docs/ssr.md
@@ -17,6 +17,7 @@ Follow this commented example to see how to render a video:
```tsx
import fs from 'fs';
+import path from 'path';
import {evaluateRootForCompositions} from 'remotion';
import {bundle} from '@remotion/bundler';
import {
@@ -81,7 +82,7 @@ const start = async () => {
// Add this step if you want to make an MP4 out of the rendered frames.
await stitchFramesToVideo({
// Input directory of the frames
- dir: tmpDir,
+ dir: framesDir,
// Overwrite existing video
force: true,
// Possible overwrite of video metadata,
@@ -93,7 +94,7 @@ const start = async () => {
// Must match the value above for the image format
imageFormat: 'jpeg',
// Pass in the desired output path of the video. Et voilà!
- outputLocation: path.join(tmpDir, 'out.mp4'),
+ outputLocation: path.join(framesDir, 'out.mp4'),
// FFMPEG pixel format
pixelFormat: 'yuv420p',
// Information needed to construct audio correctly.
diff --git a/packages/docs/docs/third-party.md b/packages/docs/docs/third-party.md
new file mode 100644
index 0000000000..9fdce4fa81
--- /dev/null
+++ b/packages/docs/docs/third-party.md
@@ -0,0 +1,41 @@
+---
+id: third-party
+title: Third party integrations
+sidebar_label: Third party integrations
+---
+
+All animations in Remotion must be driven by the value returned by the [`useCurrentFrame()`](/docs/use-current-frame) hook. If you would like to use another way of animations in Remotion, you need an integration that supports synchronizing the timing with Remotion.
+
+On this page, we maintain a list of integrations for popular ways of animating on the web, and provide status for popular requests.
+
+## CSS animations
+
+You can synchronize animations with Remotions time using the `animation-play-state` and `animation-delay` CSS properties. Check out [example code](https://github.com/ahgsql/remotion-animation/blob/main/src/index.js) or use the [remotion-animation](https://github.com/ahgsql/remotion-animation/blob/main/src/index.js) library directly (_inofficial library_).
+
+## GIFs
+
+Use the [`@remotion/gif`](/docs/gif) component.
+
+## Framer Motion
+
+At the moment, we don't have a Framer Motion integration, but are discussing the matter on [Github Issues](https://github.com/remotion-dev/remotion/issues/399).
+
+## Lottie
+
+Use the [`remotion-lottie`](https://github.com/ahgsql/remotion-lottie) package (_inofficial library_).
+
+## Three.JS
+
+Use the [`@remotion/three`](/docs/three) package.
+
+## react-spring
+
+There is no direct compatibility but Remotion provides it's own [`spring()`](/docs/spring) instead.
+
+## Reanimated
+
+There is no integration available but Remotion shares some code with Reanimated, in particular [`interpolate()`](/docs/interpolate), [`spring()`](/docs/spring) and [`Easing`](/docs/easing). This makes it easier to refactor already existing animation from Reanimated.
+
+## Other libraries
+
+Are you interested in using other libraries with Remotion? You can [file a Github issue](https://github.com/remotion-dev/remotion/issues/new) to inquire it. While we cannot guarantee to help you, you can register interest and kick of the discussion.
diff --git a/packages/docs/docs/three.mdx b/packages/docs/docs/three.mdx
index a5bba56d00..7513106643 100644
--- a/packages/docs/docs/three.mdx
+++ b/packages/docs/docs/three.mdx
@@ -17,7 +17,7 @@ These are the only two APIs provided - for everything else you can use the stand
## Starter template
-Check out [remotion-template-three](https://github.com/remotion-dev/remotion-template-three), a minimal boilerplate for Remotion and React Three Fiber. It is a template repository, you can click "Use this template" on the Github repo to get started.
+Check out [remotion-template-three](https://github.com/remotion-dev/template-three), a minimal boilerplate for Remotion and React Three Fiber. It is a template repository, you can click "Use this template" on the Github repo to get started.
<ThreeDPlayer />
diff --git a/packages/docs/docs/using-fonts.md b/packages/docs/docs/using-fonts.md
index 48d395ca46..29370f52bd 100644
--- a/packages/docs/docs/using-fonts.md
+++ b/packages/docs/docs/using-fonts.md
@@ -54,6 +54,6 @@ const MyComp: React.FC = () => {
}
```
-## File requirements
+### File requirements
-Fonts must have a `.woff` or `.woff2` file extension to be loaded.
+Fonts must have one of the following file extensions to be loaded: `woff`, `woff2`, `ttf`, `eot`.
diff --git a/packages/docs/package-lock.json b/packages/docs/package-lock.json
index fe09b89fbc..e495f25510 100644
--- a/packages/docs/package-lock.json
+++ b/packages/docs/package-lock.json
@@ -8,9 +8,11 @@
"dependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.14.0",
"@docusaurus/core": "2.0.0-beta.0",
+ "@docusaurus/module-type-aliases": "^2.0.0-beta.0",
"@docusaurus/preset-classic": "2.0.0-beta.0",
"@mdx-js/react": "^1.6.21",
"@splitbee/web": "^0.2.4",
+ "@tsconfig/docusaurus": "^1.0.2",
"@types/color-namer": "^1.3.0",
"@types/hls.js": "^0.13.3",
"@types/jest": "^26.0.23",
@@ -1787,6 +1789,11 @@
"react-dom": "^16.8.4 || ^17.0.0"
}
},
+ "node_modules/@docusaurus/module-type-aliases": {
+ "version": "2.0.0-beta.1",
+ "resolved": "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-2.0.0-beta.1.tgz",
+ "integrity": "sha512-FPy/Wa4dH0QvtR92/JJi7t2SB1tnySuSGVNf4e0llArZ4E7+vzTAmd4qVfzBuS+LMj/M6woKHLn+zKKUkfaZOw=="
+ },
"node_modules/@docusaurus/plugin-content-blog": {
"version": "2.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.0.0-beta.0.tgz",
@@ -2914,6 +2921,11 @@
"node": ">=10.13.0"
}
},
+ "node_modules/@tsconfig/docusaurus": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@tsconfig/docusaurus/-/docusaurus-1.0.2.tgz",
+ "integrity": "sha512-x4rRVb346vjyym6QbeB1Tv01XXwhbkujOmvDmtf0bT20oc2gbDhbmwpskKqZ5Of2Q/Vk4jNk1WMiLsZdJ9t7Dw=="
+ },
"node_modules/@types/babel__core": {
"version": "7.1.14",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.14.tgz",
@@ -18911,6 +18923,11 @@
"webpack": "^5.28.0"
}
},
+ "@docusaurus/module-type-aliases": {
+ "version": "2.0.0-beta.1",
+ "resolved": "https://registry.npmjs.org/@docusaurus/module-type-aliases/-/module-type-aliases-2.0.0-beta.1.tgz",
+ "integrity": "sha512-FPy/Wa4dH0QvtR92/JJi7t2SB1tnySuSGVNf4e0llArZ4E7+vzTAmd4qVfzBuS+LMj/M6woKHLn+zKKUkfaZOw=="
+ },
"@docusaurus/plugin-content-blog": {
"version": "2.0.0-beta.0",
"resolved": "https://registry.npmjs.org/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.0.0-beta.0.tgz",
@@ -19728,6 +19745,11 @@
"resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.1.1.tgz",
"integrity": "sha512-Z6DoceYb/1xSg5+e+ZlPZ9v0N16ZvZ+wYMraFue4HYrE4ttONKtsvruIRf6t9TBR0YvSOfi1hUU0fJfBLCDYow=="
},
+ "@tsconfig/docusaurus": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@tsconfig/docusaurus/-/docusaurus-1.0.2.tgz",
+ "integrity": "sha512-x4rRVb346vjyym6QbeB1Tv01XXwhbkujOmvDmtf0bT20oc2gbDhbmwpskKqZ5Of2Q/Vk4jNk1WMiLsZdJ9t7Dw=="
+ },
"@types/babel__core": {
"version": "7.1.14",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.14.tgz",
diff --git a/packages/docs/package.json b/packages/docs/package.json
index 84e27b9ab3..438c46519c 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -1,6 +1,6 @@
{
"name": "docs",
- "version": "2.1.9",
+ "version": "2.1.11",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@@ -17,9 +17,9 @@
"@docusaurus/core": "2.0.0-beta.0",
"@docusaurus/preset-classic": "2.0.0-beta.0",
"@mdx-js/react": "^1.6.21",
- "@remotion/media-utils": "2.1.9",
- "@remotion/player": "2.1.9",
- "@remotion/three": "2.1.9",
+ "@remotion/media-utils": "2.1.11",
+ "@remotion/player": "2.1.11",
+ "@remotion/three": "2.1.11",
"@splitbee/web": "^0.2.4",
"@types/color-namer": "^1.3.0",
"@types/hls.js": "^0.13.3",
@@ -32,8 +32,12 @@
"polished": "4.1.2",
"prism-react-renderer": "^1.2.1",
"react-player": "^2.9.0",
- "remotion": "2.1.9",
- "ts-jest": "^27.0.3"
+ "ts-jest": "^27.0.3",
+ "remotion": "2.1.11"
+ },
+ "devDependencies": {
+ "@docusaurus/module-type-aliases": "^2.0.0-beta.0",
+ "@tsconfig/docusaurus": "^1.0.2"
},
"browserslist": {
"production": [
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 705d8e56e5..919e2520ba 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -1,6 +1,7 @@
module.exports = {
someSidebar: [
{
+ collapsed: false,
type: "category",
label: "Getting started",
items: [
@@ -15,6 +16,7 @@ module.exports = {
{
type: "category",
label: "Techniques",
+ collapsed: false,
items: [
"assets",
"using-audio",
@@ -32,6 +34,7 @@ module.exports = {
"webpack",
"legacy-babel",
"env-variables",
+ "third-party",
],
},
"cli",
@@ -39,6 +42,7 @@ module.exports = {
{
type: "category",
label: "API - Core",
+ collapsed: false,
items: [
"continue-render",
"delay-render",
@@ -93,12 +97,14 @@ module.exports = {
{
type: "category",
label: "Troubleshooting",
+ collapsed: false,
items: [
"timeout",
"media-playback-error",
"performance",
"webpack-dynamic-imports",
"non-seekable-media",
+ "flickering",
],
},
"2-0-migration",
diff --git a/packages/docs/static/img/parallel-rendering.png b/packages/docs/static/img/parallel-rendering.png
new file mode 100644
index 0000000000..e115e60b86
Binary files /dev/null and b/packages/docs/static/img/parallel-rendering.png differ
diff --git a/packages/docs/tsconfig.json b/packages/docs/tsconfig.json
new file mode 100644
index 0000000000..4360f0da16
--- /dev/null
+++ b/packages/docs/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ "extends": "@tsconfig/docusaurus/tsconfig.json",
+ "include": ["src/"]
+}
diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json
index 685eda6c4a..7454fab404 100644
--- a/packages/eslint-config/package.json
+++ b/packages/eslint-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/eslint-config",
- "version": "2.1.9",
+ "version": "2.1.10",
"description": "",
"main": "dist/index.js",
"scripts": {
@@ -16,7 +16,7 @@
"author": "Jonny Burger <[email protected]>",
"license": "ISC",
"dependencies": {
- "@remotion/eslint-plugin": "2.1.9",
+ "@remotion/eslint-plugin": "2.1.10",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"eslint-config-prettier": "^8.2.0",
diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json
index 9ffa3b6f87..e3250f1089 100644
--- a/packages/eslint-plugin/package.json
+++ b/packages/eslint-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/eslint-plugin",
- "version": "2.1.9",
+ "version": "2.1.10",
"description": "A set of rules helping you avoid common pitfalls in Remotion.",
"scripts": {
"build": "tsc -d",
diff --git a/packages/example/package.json b/packages/example/package.json
index 7fc5dd91fa..91b97706a2 100644
--- a/packages/example/package.json
+++ b/packages/example/package.json
@@ -1,7 +1,7 @@
{
"name": "@remotion/example",
"private": true,
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "",
"license": "SEE LICENSE IN LICENSE.md",
"author": "Jonny Burger",
@@ -21,15 +21,15 @@
"@babel/preset-env": "7.12.13",
"@babel/preset-react": "7.12.13",
"@react-three/drei": "^4.3.3",
- "@remotion/babel-loader": "2.1.9",
- "@remotion/bundler": "2.1.9",
- "@remotion/cli": "2.1.9",
- "@remotion/eslint-config": "2.1.9",
- "@remotion/eslint-plugin": "2.1.9",
- "@remotion/gif": "2.1.9",
- "@remotion/media-utils": "2.1.9",
- "@remotion/renderer": "2.1.9",
- "@remotion/three": "2.1.9",
+ "@remotion/babel-loader": "2.1.11",
+ "@remotion/bundler": "2.1.11",
+ "@remotion/cli": "2.1.11",
+ "@remotion/eslint-config": "2.1.10",
+ "@remotion/eslint-plugin": "2.1.10",
+ "@remotion/gif": "2.1.11",
+ "@remotion/media-utils": "2.1.11",
+ "@remotion/renderer": "2.1.11",
+ "@remotion/three": "2.1.11",
"@types/express": "^4.17.11",
"@types/node": "^15.0.1",
"@types/styled-components": "^5.1.1",
@@ -38,7 +38,7 @@
"mdx-loader": "3.0.2",
"polished": "^4.0.5",
"prettier": "^2.0.5",
- "remotion": "2.1.9",
+ "remotion": "2.1.11",
"styled-components": "^5.1.1",
"svg-path-properties": "^1.0.4",
"three": ">=0.128.0",
diff --git a/packages/example/wow.ts b/packages/example/wow.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/gif/package.json b/packages/gif/package.json
index 9dcae514f8..cbf391a05f 100644
--- a/packages/gif/package.json
+++ b/packages/gif/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/gif",
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "Gif component for remotion",
"sideEffects": false,
"repository": {
@@ -20,7 +20,7 @@
"dependencies": {
"@react-gifs/tools": "^0.1.1",
"lru_map": "^0.4.1",
- "remotion": "2.1.9"
+ "remotion": "2.1.11"
},
"devDependencies": {
"@jonny/eslint-config": "^2.1.233",
diff --git a/packages/media-utils/package.json b/packages/media-utils/package.json
index 92a5fd28f2..3a4d6ccbd7 100644
--- a/packages/media-utils/package.json
+++ b/packages/media-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/media-utils",
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "Utility functions for audio and video",
"main": "dist/index.js",
"sideEffects": false,
@@ -15,7 +15,7 @@
"url": "https://github.com/remotion-dev/remotion"
},
"dependencies": {
- "remotion": "2.1.9"
+ "remotion": "2.1.11"
},
"peerDependencies": {
"react": "^17.0.1",
diff --git a/packages/media-utils/src/get-audio-duration.ts b/packages/media-utils/src/get-audio-duration.ts
index 1842342fed..4e89df9e52 100644
--- a/packages/media-utils/src/get-audio-duration.ts
+++ b/packages/media-utils/src/get-audio-duration.ts
@@ -2,8 +2,8 @@ export const getAudioDuration = (src: string): Promise<number> => {
const audio = document.createElement('audio');
audio.src = src;
return new Promise<number>((resolve, reject) => {
- const onError = (ev: ErrorEvent) => {
- reject(ev.error);
+ const onError = () => {
+ reject(audio.error);
cleanup();
};
diff --git a/packages/media-utils/src/get-video-metadata.ts b/packages/media-utils/src/get-video-metadata.ts
index c23fb1e6eb..623f6783c7 100644
--- a/packages/media-utils/src/get-video-metadata.ts
+++ b/packages/media-utils/src/get-video-metadata.ts
@@ -11,8 +11,8 @@ export const getVideoMetadata = async (src: string): Promise<VideoMetadata> => {
const video = document.createElement('video');
video.src = src;
return new Promise<VideoMetadata>((resolve, reject) => {
- const onError = (ev: ErrorEvent) => {
- reject(ev.error);
+ const onError = () => {
+ reject(video.error);
cleanup();
};
diff --git a/packages/player-example/package.json b/packages/player-example/package.json
index 3d76af85ae..37544f9501 100644
--- a/packages/player-example/package.json
+++ b/packages/player-example/package.json
@@ -1,6 +1,6 @@
{
"name": "player-example",
- "version": "2.1.9",
+ "version": "2.1.11",
"private": true,
"author": "Jonny Burger <[email protected]>",
"maintainers": [
@@ -9,7 +9,7 @@
],
"dependencies": {
"@craco/craco": "^6.1.1",
- "@remotion/player": "2.1.9",
+ "@remotion/player": "2.1.11",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
@@ -20,7 +20,7 @@
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
- "remotion": "2.1.9",
+ "remotion": "2.1.11",
"typescript": "^4.1.2"
},
"scripts": {
diff --git a/packages/player-example/src/App.tsx b/packages/player-example/src/App.tsx
index 0484eb70e6..755df1abe6 100644
--- a/packages/player-example/src/App.tsx
+++ b/packages/player-example/src/App.tsx
@@ -4,6 +4,8 @@ import CarSlideshow from './CarSlideshow';
export default function App() {
const [title, setTitle] = useState('Hello World');
+ const [color, setColor] = useState("#ffffff")
+ const [bgColor, setBgColor] = useState("#000000")
const [loop, setLoop] = useState(false);
const [doubleClickToFullscreen, setDoubleClickToFullscreen] = useState(true);
const [clickToPlay, setClickToPlay] = useState(true);
@@ -30,7 +32,7 @@ export default function App() {
}, []);
return (
- <div>
+ <div style={{margin: "2rem"}}>
<Player
ref={ref}
compositionWidth={500}
@@ -45,14 +47,39 @@ export default function App() {
clickToPlay={clickToPlay}
inputProps={{
title: String(title),
+ bgColor: String(bgColor),
+ color: String(color)
}}
/>
+ <div style={{paddingTop:"0.5rem"}}>
+ Enter Text {" "}
<input
value={title}
onChange={(e) => {
setTitle(e.target.value);
}}
/>
+ </div>
+
+ <div style={{paddingTop:"0.5rem"}}>
+ <div>
+ Select Text Color {" "}
+ <input
+ type="color"
+ value={color}
+ onChange={(e) => setColor(e.target.value)}
+ />
+ </div>
+ <div>
+ Select Background Color {" "}
+ <input
+ type="color"
+ value={bgColor}
+ onChange={(e) => setBgColor(e.target.value)}
+ />
+ </div>
+ </div>
+
<br />
<button type="button" onClick={() => ref.current?.play()}>
Play
@@ -66,6 +93,7 @@ export default function App() {
<button type="button" onClick={() => ref.current?.unmute()}>
Unmute
</button>
+
<button type="button" onClick={() => ref.current?.toggle()}>
toggle
</button>
diff --git a/packages/player-example/src/CarSlideshow.tsx b/packages/player-example/src/CarSlideshow.tsx
index 44be2baa94..fe6d70dcfe 100644
--- a/packages/player-example/src/CarSlideshow.tsx
+++ b/packages/player-example/src/CarSlideshow.tsx
@@ -2,16 +2,19 @@ import {interpolate, useCurrentFrame, useVideoConfig} from 'remotion';
type Props = {
title: string;
+ bgColor: string,
+ color: string
};
-const CarSlideshow = ({title}: Props) => {
+const CarSlideshow = ({title, bgColor, color}: Props) => {
const frame = useCurrentFrame();
const {width, height, durationInFrames} = useVideoConfig();
const left = interpolate(frame, [0, durationInFrames], [width, width * -1]);
+ console.log(bgColor, color)
return (
<div
style={{
- backgroundColor: 'hotpink',
+ backgroundColor: bgColor,
width: width,
height: height,
position: 'absolute',
@@ -26,7 +29,7 @@ const CarSlideshow = ({title}: Props) => {
position: 'absolute',
top: height / 2 - 100,
left,
- color: 'black',
+ color: color,
whiteSpace: 'nowrap',
}}
>
diff --git a/packages/player-example/src/index.tsx b/packages/player-example/src/index.tsx
index 010e577092..c30a033e21 100644
--- a/packages/player-example/src/index.tsx
+++ b/packages/player-example/src/index.tsx
@@ -4,7 +4,7 @@ import App from './App';
const rootElement = document.getElementById('root');
render(
- <div style={{display: 'flex', flexDirection: 'row'}}>
+ <div style={{display: 'flex', flexDirection: 'row', flexWrap:"wrap", justifyContent:"center"}}>
<App />
<App />
</div>,
diff --git a/packages/player/package.json b/packages/player/package.json
index c288c456f8..3bbd66dff2 100644
--- a/packages/player/package.json
+++ b/packages/player/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/player",
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "Remotion Player",
"main": "dist/index.js",
"sideEffects": false,
@@ -24,7 +24,7 @@
],
"license": "SEE LICENSE IN LICENSE.md",
"dependencies": {
- "remotion": "2.1.9"
+ "remotion": "2.1.11"
},
"peerDependencies": {
"react": ">=16.8.0",
diff --git a/packages/renderer/package.json b/packages/renderer/package.json
index a01c2eb036..d0083fa1d6 100644
--- a/packages/renderer/package.json
+++ b/packages/renderer/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/renderer",
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "Renderer for Remotion",
"main": "dist/index.js",
"sideEffects": false,
@@ -15,12 +15,12 @@
"url": "https://github.com/remotion-dev/remotion"
},
"dependencies": {
- "@remotion/bundler": "2.1.9",
+ "@remotion/bundler": "2.1.11",
"execa": "^4.0.2",
"got": "11.8.2",
"p-limit": "^3.1.0",
"puppeteer-core": "^8.0.0",
- "remotion": "2.1.9",
+ "remotion": "2.1.11",
"sanitize-filename": "^1.6.3",
"serve-handler": "^6.1.3",
"xns": "^2.0.7"
diff --git a/packages/renderer/src/assets-to-ffmpeg-inputs.ts b/packages/renderer/src/assets-to-ffmpeg-inputs.ts
new file mode 100644
index 0000000000..b1ed548a6a
--- /dev/null
+++ b/packages/renderer/src/assets-to-ffmpeg-inputs.ts
@@ -0,0 +1,21 @@
+export const assetsToFfmpegInputs = ({
+ assets,
+ isAudioOnly,
+ frameCount,
+ fps,
+}: {
+ assets: string[];
+ isAudioOnly: boolean;
+ frameCount: number;
+ fps: number;
+}): [string, string][] => {
+ if (isAudioOnly && assets.length === 0) {
+ return [
+ ['-f', 'lavfi'],
+ ['-i', 'anullsrc'],
+ ['-t', (frameCount / fps).toFixed(4)],
+ ];
+ }
+
+ return assets.map((path) => ['-i', path]);
+};
diff --git a/packages/renderer/src/get-audio-codec-name.ts b/packages/renderer/src/get-audio-codec-name.ts
index 14aa7d44f5..099db83d4e 100644
--- a/packages/renderer/src/get-audio-codec-name.ts
+++ b/packages/renderer/src/get-audio-codec-name.ts
@@ -2,6 +2,12 @@ import {Codec, Internals} from 'remotion';
export const getAudioCodecName = (codec: Codec): string | null => {
if (!Internals.isAudioCodec(codec)) {
+ // The mkv container supports WAV, but MP4 does only support
+ // AAC. Choose MKV codec for better quality because we can put in lossless audio
+ if (codec === 'h264-mkv') {
+ return 'pcm_s16le';
+ }
+
return 'aac';
}
diff --git a/packages/renderer/src/get-codec-name.ts b/packages/renderer/src/get-codec-name.ts
index d6b1da92b3..5ee433c4c6 100644
--- a/packages/renderer/src/get-codec-name.ts
+++ b/packages/renderer/src/get-codec-name.ts
@@ -5,7 +5,7 @@ export const getCodecName = (codec: Codec): string | null => {
return null;
}
- if (codec === 'h264') {
+ if (codec === 'h264' || codec === 'h264-mkv') {
return 'libx264';
}
diff --git a/packages/renderer/src/stitcher.ts b/packages/renderer/src/stitcher.ts
index d5b38a83d4..4e2d429b95 100644
--- a/packages/renderer/src/stitcher.ts
+++ b/packages/renderer/src/stitcher.ts
@@ -7,6 +7,7 @@ import {
ProResProfile,
RenderAssetInfo,
} from 'remotion';
+import {assetsToFfmpegInputs} from './assets-to-ffmpeg-inputs';
import {calculateAssetPositions} from './assets/calculate-asset-positions';
import {convertAssetsToFileUrls} from './assets/convert-assets-to-file-urls';
import {markAllAssetsAsDownloaded} from './assets/download-and-map-assets-to-file';
@@ -104,11 +105,6 @@ export const stitchFramesToVideo = async (options: {
const assetPositions = calculateAssetPositions(fileUrlAssets);
const assetPaths = assetPositions.map((asset) => resolveAssetSrc(asset.src));
- if (isAudioOnly && assetPaths.length === 0) {
- throw new Error(
- `Cannot render - you are trying to generate an audio file (${codec}) but your composition doesn't contain any audio.`
- );
- }
const assetAudioDetails = await getAssetAudioDetails({
assetPaths,
@@ -138,7 +134,12 @@ export const stitchFramesToVideo = async (options: {
frameInfo
? ['-i', `element-%0${frameInfo.numberLength}d.${imageFormat}`]
: null,
- ...assetPaths.map((path) => ['-i', path]),
+ ...assetsToFfmpegInputs({
+ assets: assetPaths,
+ isAudioOnly,
+ fps: options.fps,
+ frameCount: options.assetsInfo.assets.length,
+ }),
encoderName
? // -c:v is the same as -vcodec as -codec:video
// and specified the video codec.
diff --git a/packages/three/package.json b/packages/three/package.json
index df3b4b806b..0beb82ac70 100644
--- a/packages/three/package.json
+++ b/packages/three/package.json
@@ -1,6 +1,6 @@
{
"name": "@remotion/three",
- "version": "2.1.9",
+ "version": "2.1.11",
"description": "Utility functions for using react-three-fiber with remotion",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -17,7 +17,7 @@
"url": "https://github.com/remotion-dev/remotion"
},
"dependencies": {
- "remotion": "2.1.9"
+ "remotion": "2.1.11"
},
"peerDependencies": {
"@react-three/fiber": ">=6.0.14",
diff --git a/tests/rendering.test.ts b/tests/rendering.test.ts
index b1dd9acef8..328146b1b7 100644
--- a/tests/rendering.test.ts
+++ b/tests/rendering.test.ts
@@ -272,10 +272,12 @@ test("Should fail to render an audio file that doesn't have any audio inputs", a
reject: false,
}
);
- expect(task.exitCode).toBe(process.platform === "win32" ? 0 : 1);
- expect(task.stderr).toContain(
- "Cannot render - you are trying to generate an audio file (mp3) but your composition doesn't contain any audio."
- );
+ expect(task.exitCode).toBe(0);
+ const info = await execa("ffprobe", [out]);
+ const data = info.stderr;
+ expect(data).toContain("Duration: 00:00:00.37");
+ expect(data).toContain("Audio: mp3, 44100 Hz");
+ fs.unlinkSync(out);
});
test("Dynamic duration should work", async () => {