Skip to content

🎥 Make videos programmatically with React

Docusaurus: No need to specify `@module` anymore

Jonny Burger9cbd7b527342
diff --git a/packages/docs/blog/2021-08-11-remotion-2-3.mdx b/packages/docs/blog/2021-08-11-remotion-2-3.mdx
index 550d2716a9..40ffa56c66 100644
--- a/packages/docs/blog/2021-08-11-remotion-2-3.mdx
+++ b/packages/docs/blog/2021-08-11-remotion-2-3.mdx
@@ -17,7 +17,7 @@ So far we focused on streamlining the workflow for making videos. While it was a
[This new component](/docs/still) is the same as [`<Composition />`](/docs/composition) but is meant for defining a compositions that output a still image. Since it's already implied, you don't have to define the `fps` and `durationInFrames` properties.
```tsx twoslash
-import { Still } from "remotion";
+import {Still} from 'remotion';
const Thumbnail: React.FC = () => null;
// ---cut---
<Still
@@ -26,9 +26,9 @@ const Thumbnail: React.FC = () => null;
width={1200}
height={627}
defaultProps={{
- title: "Welcome to Remotion",
- description: "Edit Video.tsx to change template",
- slogan: "Write videos\nin React",
+ title: 'Welcome to Remotion',
+ description: 'Edit Video.tsx to change template',
+ slogan: 'Write videos\nin React',
}}
/>;
```
@@ -38,14 +38,16 @@ const Thumbnail: React.FC = () => null;
There are now icons in the sidebar for compositions, and those who are stills have an image icon.
<p align="center">
- <img style={{maxWidth: 300}} src="/img/still-thumbnail.png"/> <br/>
- <em><sub>Now still images (compositions with a duration of 1 frame) are marked with a special icon.</sub></em>
+ <img style={{maxWidth: 300}} src="/img/still-thumbnail.png" /> <br />
+ <em>
+ <sub>Now still images (compositions with a duration of 1 frame) are marked with a special icon.</sub>
+ </em>
</p>
For still images, you don't need the timeline, so it will hide itself and give you a bigger canvas.
<p align="center">
- <img style={{maxWidth: 600}} src="/img/notimeline.png"/> <br/>
+ <img style={{maxWidth: 600}} src="/img/notimeline.png" /> <br />
</p>
## New `remotion still` command
@@ -61,21 +63,19 @@ npx remotion still --props='{"custom": "data"}' my-comp out.png
If you render using the Node.JS APIs, we have a new equivalent API for rendering stills as well.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { bundle } from "@remotion/bundler";
-import { getCompositions, renderStill } from "@remotion/renderer";
+import {bundle} from '@remotion/bundler';
+import {getCompositions, renderStill} from '@remotion/renderer';
// The composition you want to render
-const compositionId = "HelloWorld";
+const compositionId = 'HelloWorld';
const bundleLocation = await bundle({
- entryPoint: require.resolve("./src/index.ts"),
+ entryPoint: require.resolve('./src/index.ts'),
});
const comps = await getCompositions(bundleLocation, {
inputProps: {
- custom: "data",
+ custom: 'data',
},
});
const composition = comps.find((c) => c.id === compositionId);
@@ -89,9 +89,9 @@ if (!composition) {
await renderStill({
composition,
serveUrl: bundleLocation,
- output: "/tmp/still.png",
+ output: '/tmp/still.png',
inputProps: {
- custom: "data",
+ custom: 'data',
},
});
```
@@ -115,7 +115,7 @@ We are also working on getting still image rendering working in a serverless env
When creating a new video, you now get to choose between different templates, that give you a great starting point for your usecase.
<p align="center">
- <img style={{maxWidth: 600}} src="/img/yarncreatetemplate.png"/> <br/>
+ <img style={{maxWidth: 600}} src="/img/yarncreatetemplate.png" /> <br />
</p>
In addition to the default template and the previously announced Three.JS template, there now is also a plain-JS template, a text-to-speech template and the above mentioned Stills template.
diff --git a/packages/docs/docs/4-0-migration.mdx b/packages/docs/docs/4-0-migration.mdx
index 985d6febe0..256c88b313 100644
--- a/packages/docs/docs/4-0-migration.mdx
+++ b/packages/docs/docs/4-0-migration.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-4-0-migration.png
id: 4-0-migration
title: v4.0 Migration
-crumb: "Version Upgrade"
+crumb: 'Version Upgrade'
---
When upgrading from Remotion 3 to Remotion 4, note the following changes and apply them to your project.
@@ -157,14 +157,9 @@ The [@remotion/renderer](/docs/renderer) `ImageFormat` Type got replaced by the
- `getParts()` has been removed. Use [`getSubpaths()`](/docs/paths/get-subpaths) instead:
```tsx twoslash title="paths.ts"
-import {
- getLength,
- getPointAtLength,
- getSubpaths,
- getTangentAtLength,
-} from "@remotion/paths";
-
-const path = "M 0 0 L 100 100";
+import {getLength, getPointAtLength, getSubpaths, getTangentAtLength} from '@remotion/paths';
+
+const path = 'M 0 0 L 100 100';
const parts = getSubpaths(path[0]);
const length = getLength(parts[0]);
const start = getPointAtLength(parts[0], 0);
@@ -205,7 +200,7 @@ Previously you were able to set a value for `crf` when rendering a GIF. This was
Previously, [`staticFile()`](/docs/staticfile) did not handle URI-unsafe characters contained in the provided path:
```tsx title="Before v4"
-staticFile("my-image#portrait.png"); //output: "my-image#portrait.png"
+staticFile('my-image#portrait.png'); //output: "my-image#portrait.png"
```
This could lead to problems, when unsafe characters such as `#`, `?` and `&` were part of the filename.
@@ -213,7 +208,7 @@ This could lead to problems, when unsafe characters such as `#`, `?` and `&` wer
Now, [`staticFile()`](/docs/staticfile) encodes the filename using `encodeURIComponent`:
```tsx title="Since v4.0.0"
-staticFile("my-image#portrait.png"); // "my-image%23portrait.png"
+staticFile('my-image#portrait.png'); // "my-image%23portrait.png"
```
## Type `WebpackOverrideFn` moved
@@ -230,7 +225,7 @@ Remotion no longer aliases `react-native` automatically to `react-native-web`.
If you are using `react-native-web`, override the Webpack config like this to restore the previous behavior:
```ts twoslash title="remotion.config.ts"
-import { Config } from "@remotion/cli/config";
+import {Config} from '@remotion/cli/config';
Config.overrideWebpackConfig((config) => {
return {
@@ -239,7 +234,7 @@ Config.overrideWebpackConfig((config) => {
...config.resolve,
alias: {
...config.resolve?.alias,
- "react-native$": "react-native-web",
+ 'react-native$': 'react-native-web',
},
},
};
@@ -259,7 +254,7 @@ export type TComposition<Schema extends AnyZodObject, Props> = {};
If you need a type for a generic composition, you can use the new `AnyComposition` type:
```ts
-import { AnyComposition } from "remotion";
+import {AnyComposition} from 'remotion';
const composition: AnyComposition = {
width: 1920,
@@ -293,13 +288,7 @@ const Hi = (props: MyProps) => {
return <div>{props.title}</div>;
};
-<Still
- component={Hi}
- id="interface-props"
- defaultProps={{ title: "hi" }}
- height={1080}
- width={1080}
-/>;
+<Still component={Hi} id="interface-props" defaultProps={{title: 'hi'}} height={1080} width={1080} />;
```
This is because props must now be an object and satisfy the shape `Record<string, unknown>`.
@@ -322,14 +311,11 @@ If you register a composition with a component that requires some props, you now
[`renderMedia()`](/docs/renderer/render-media) accepts a `VideoConfig` object for the `composition` option, which now has a `props` field:
```tsx twoslash {5-7}
-// @module: esnext
-// @target: es2022
-
-import { renderMedia } from "@remotion/renderer";
+import {renderMedia} from '@remotion/renderer';
const options = {
- codec: "h264",
- serveUrl: "https://example.com",
+ codec: 'h264',
+ serveUrl: 'https://example.com',
} as const;
const composition = {
@@ -337,7 +323,7 @@ const composition = {
height: 1080,
fps: 30,
durationInFrames: 30 * 5,
- id: "comp-name",
+ id: 'comp-name',
defaultProps: {},
defaultCodec: null,
} as const;
@@ -348,11 +334,11 @@ await renderMedia({
composition: {
...composition,
props: {
- title: "Hello world",
+ title: 'Hello world',
},
},
inputProps: {
- title: "Hi there",
+ title: 'Hi there',
},
});
```
diff --git a/packages/docs/docs/artifacts.mdx b/packages/docs/docs/artifacts.mdx
index 26ddfc9c14..42a309befb 100644
--- a/packages/docs/docs/artifacts.mdx
+++ b/packages/docs/docs/artifacts.mdx
@@ -36,27 +36,18 @@ import {generateSubtitles} from './subtitles';
export const MyComp: React.FC = () => {
const frame = useCurrentFrame();
- return (
- <>
- {frame === 0 ? (
- <Artifact filename="captions.srt" content={generateSubtitles()} />
- ) : null}
- </>
- );
+ return <>{frame === 0 ? <Artifact filename="captions.srt" content={generateSubtitles()} /> : null}</>;
};
```
## Rules of artifacts
-<Step>1</Step> The asset should only be rendered for one single frame of the video.
-Otherwise, the asset will get emitted multiple times. <br />
+<Step>1</Step> The asset should only be rendered for one single frame of the video. Otherwise, the asset will get emitted multiple times. <br />
-<Step>2</Step> It is possible to emit multiple assets, but they may not have the
-same filename.<br/>
+<Step>2</Step> It is possible to emit multiple assets, but they may not have the same filename.
+<br />
-<Step>3</Step> For the <code>content</code> prop it is possible to pass a <code>string</code>, or a <code>Uint8Array</code> for binary data. Passing an <code>
- Uint8Array
-</code> should not be considered faster due to it having to be serialized.
+<Step>3</Step> For the <code>content</code> prop it is possible to pass a <code>string</code>, or a <code>Uint8Array</code> for binary data. Passing an <code>Uint8Array</code> should not be considered faster due to it having to be serialized.
<br />
## Receiving artifacts
@@ -70,8 +61,6 @@ Artifacts get saved to `out/[composition-id]/[filename]` when rendering a video.
Use the [`onArtifact`](/docs/renderer/render-media#onartifact) callback to receive the artifacts.
```tsx twoslash title="render.mjs"
-// @module: es2022
-// @target: es2017
import type {VideoConfig} from 'remotion';
const composition: VideoConfig = {
@@ -122,8 +111,6 @@ When using [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda), artifact
You can obtain a list of currently received assets from [`getRenderProgress()`](/docs/lambda/getrenderprogress#artifacts).
```tsx twoslash title="progress.ts"
-// @module: es2022
-// @target: es2017
import {getRenderProgress} from '@remotion/lambda/client';
const renderProgress = await getRenderProgress({
@@ -157,8 +144,6 @@ const imageFormat = 'png' as const;
const region = 'eu-central-1' as const;
// ---cut---
-// @module: es2022
-// @target: es2017
import {renderStillOnLambda} from '@remotion/lambda/client';
const stillResponse = await renderStillOnLambda({
diff --git a/packages/docs/docs/bundle.mdx b/packages/docs/docs/bundle.mdx
index 14febff930..dad37ab120 100644
--- a/packages/docs/docs/bundle.mdx
+++ b/packages/docs/docs/bundle.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-bundle.png
id: bundle
title: bundle()
-crumb: "@remotion/bundler"
+crumb: '@remotion/bundler'
---
_Part of the `@remotion/bundler` package._
@@ -17,13 +17,11 @@ Calling `bundle()` for every video that you render is an anti-pattern.
## Example
```tsx twoslash title="render.mjs"
-import path from "path";
-// @module: ESNext
-// @target: ESNext
-import { bundle } from "@remotion/bundler";
+import path from 'path';
+import {bundle} from '@remotion/bundler';
const serveUrl = await bundle({
- entryPoint: path.join(process.cwd(), "./src/index.ts"),
+ entryPoint: path.join(process.cwd(), './src/index.ts'),
// If you have a webpack override in remotion.config.ts, pass it here as well.
webpackOverride: (config) => config,
});
@@ -52,7 +50,7 @@ _optional_
A function to override the webpack config reducer-style. Takes a function which gives you the current webpack config which you can transform and return a modified version of it. For example:
```ts twoslash
-import { WebpackOverrideFn } from "@remotion/bundler";
+import {WebpackOverrideFn} from '@remotion/bundler';
// ---cut---
const webpackOverride: WebpackOverrideFn = (webpackConfig) => {
return {
@@ -128,7 +126,7 @@ const bundle: (
Example:
```ts
-await bundle("src/index.ts", () => console.log(progress * 100 + "% done"), {
+await bundle('src/index.ts', () => console.log(progress * 100 + '% done'), {
webpackOverride,
});
```
diff --git a/packages/docs/docs/cloudrun/deleteservice.mdx b/packages/docs/docs/cloudrun/deleteservice.mdx
index a07846ef68..4f6b5fb033 100644
--- a/packages/docs/docs/cloudrun/deleteservice.mdx
+++ b/packages/docs/docs/cloudrun/deleteservice.mdx
@@ -3,11 +3,13 @@ image: /generated/articles-docs-cloudrun-deleteservice.png
id: deleteservice
title: deleteService()
slug: /cloudrun/deleteservice
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Deletes a deployed Cloud Run service based on its name.
@@ -17,18 +19,15 @@ To retrieve a list of services, call [`getServices()`](/docs/cloudrun/getservice
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { deleteService, getServices } from "@remotion/cloudrun";
+import {deleteService, getServices} from '@remotion/cloudrun';
const services = await getServices({
- region: "us-east1",
+ region: 'us-east1',
compatibleOnly: false,
});
for (const service of services) {
await deleteService({
- region: "us-east1",
+ region: 'us-east1',
serviceName: service.serviceName,
});
}
diff --git a/packages/docs/docs/cloudrun/deletesite.mdx b/packages/docs/docs/cloudrun/deletesite.mdx
index f8d5fc3595..1aedc8a876 100644
--- a/packages/docs/docs/cloudrun/deletesite.mdx
+++ b/packages/docs/docs/cloudrun/deletesite.mdx
@@ -3,11 +3,13 @@ image: /generated/articles-docs-cloudrun-deletesite.png
id: deletesite
title: deleteSite()
slug: /cloudrun/deletesite
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Removes a Remotion project from your Cloud Storage bucket.
@@ -19,13 +21,11 @@ Each project is located in the `sites/` subdirectory of your Cloud Storage bucke
Gets all sites and deletes them.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { GcpRegion, deleteSite, getSites } from "@remotion/cloudrun";
+import {GcpRegion, deleteSite, getSites} from '@remotion/cloudrun';
-const region: GcpRegion = "australia-southeast1";
+const region: GcpRegion = 'australia-southeast1';
-const { sites } = await getSites(region);
+const {sites} = await getSites(region);
for (const site of sites) {
await deleteSite({
diff --git a/packages/docs/docs/cloudrun/deployservice.mdx b/packages/docs/docs/cloudrun/deployservice.mdx
index 24551fafe0..6d034d5e5b 100644
--- a/packages/docs/docs/cloudrun/deployservice.mdx
+++ b/packages/docs/docs/cloudrun/deployservice.mdx
@@ -8,12 +8,7 @@ crumb: 'Cloud Run API'
<ExperimentalBadge>
<p>
- Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs
- may change in any version and documentation is not yet finished. See the{' '}
- <a href="https://remotion.dev/changelog">
- changelog to stay up to date with breaking changes
- </a>
- .
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
</p>
</ExperimentalBadge>
@@ -24,9 +19,6 @@ If a service with the same Remotion version, memory limit, cpu limit and timeout
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
import {deployService} from '@remotion/cloudrun';
const {shortName} = await deployService({
diff --git a/packages/docs/docs/cloudrun/deploysite.mdx b/packages/docs/docs/cloudrun/deploysite.mdx
index a9e704c0b0..f84bcef4e4 100644
--- a/packages/docs/docs/cloudrun/deploysite.mdx
+++ b/packages/docs/docs/cloudrun/deploysite.mdx
@@ -3,11 +3,13 @@ image: /generated/articles-docs-cloudrun-deploysite.png
id: deploysite
title: deploySite()
slug: /cloudrun/deploysite
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Takes a Remotion project, bundles it and uploads it to an Cloud Storage bucket. Once uploaded, a Cloud Run service can render any composition in the Remotion project by specifying the URL.
@@ -19,28 +21,19 @@ Takes a Remotion project, bundles it and uploads it to an Cloud Storage bucket.
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-import { deploySite } from "@remotion/cloudrun";
-import path from "path";
-
-const { serveUrl } = await deploySite({
- entryPoint: path.resolve(process.cwd(), "src/index.ts"),
- bucketName: "remotioncloudrun-c7fsl3d",
+import {deploySite} from '@remotion/cloudrun';
+import path from 'path';
+
+const {serveUrl} = await deploySite({
+ entryPoint: path.resolve(process.cwd(), 'src/index.ts'),
+ bucketName: 'remotioncloudrun-c7fsl3d',
options: {
onBundleProgress: (progress) => {
// Progress is between 0 and 100
console.log(`Bundle progress: ${progress}%`);
},
- onUploadProgress: ({
- totalFiles,
- filesUploaded,
- totalSize,
- sizeUploaded,
- }) => {
- console.log(
- `Upload progress: Total files ${totalFiles}, Files uploaded ${filesUploaded}, Total size ${totalSize}, Size uploaded ${sizeUploaded}`,
- );
+ onUploadProgress: ({totalFiles, filesUploaded, totalSize, sizeUploaded}) => {
+ console.log(`Upload progress: Total files ${totalFiles}, Files uploaded ${filesUploaded}, Total size ${totalSize}, Size uploaded ${sizeUploaded}`);
},
},
});
diff --git a/packages/docs/docs/cloudrun/getServiceinfo.mdx b/packages/docs/docs/cloudrun/getServiceinfo.mdx
index 6a3617d1c5..96e7760045 100644
--- a/packages/docs/docs/cloudrun/getServiceinfo.mdx
+++ b/packages/docs/docs/cloudrun/getServiceinfo.mdx
@@ -3,11 +3,13 @@ image: /generated/articles-docs-cloudrun-getServiceinfo.png
id: getserviceinfo
title: getServiceInfo()
slug: /cloudrun/getserviceinfo
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Gets information about a service given its name and region.
@@ -19,14 +21,11 @@ To deploy a service, use [`deployService()`](/docs/cloudrun/deployservice).
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { getServiceInfo } from "@remotion/cloudrun/client";
+import {getServiceInfo} from '@remotion/cloudrun/client';
const info = await getServiceInfo({
- region: "us-east1",
- serviceName: "remotion--3-3-82--mem512mi--cpu1-0--t-500",
+ region: 'us-east1',
+ serviceName: 'remotion--3-3-82--mem512mi--cpu1-0--t-500',
});
console.log(info.serviceName); // remotion--3-3-82--mem512mi--cpu1-0--t-500
console.log(info.timeoutInSeconds); // 500
diff --git a/packages/docs/docs/cloudrun/getorcreatebucket.mdx b/packages/docs/docs/cloudrun/getorcreatebucket.mdx
index 30a2589db2..ee20a2d3a4 100644
--- a/packages/docs/docs/cloudrun/getorcreatebucket.mdx
+++ b/packages/docs/docs/cloudrun/getorcreatebucket.mdx
@@ -3,11 +3,13 @@ image: /generated/articles-docs-cloudrun-getorcreatebucket.png
id: getorcreatebucket
title: getOrCreateBucket()
slug: /cloudrun/getorcreatebucket
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Creates a Cloud Storage bucket for Remotion Cloud Run in your GCP project. If one already exists, it will get returned instead.
@@ -15,12 +17,10 @@ Creates a Cloud Storage bucket for Remotion Cloud Run in your GCP project. If on
**Only 1 bucket per region** is necessary for Remotion Cloud Run to function.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { getOrCreateBucket } from "@remotion/cloudrun";
+import {getOrCreateBucket} from '@remotion/cloudrun';
-const { bucketName, alreadyExisted } = await getOrCreateBucket({
- region: "us-east1",
+const {bucketName, alreadyExisted} = await getOrCreateBucket({
+ region: 'us-east1',
});
console.log(bucketName); // "remotioncloudrun-32df3p"
diff --git a/packages/docs/docs/cloudrun/getregions.mdx b/packages/docs/docs/cloudrun/getregions.mdx
index 3bbf92f554..ec40d10c48 100644
--- a/packages/docs/docs/cloudrun/getregions.mdx
+++ b/packages/docs/docs/cloudrun/getregions.mdx
@@ -2,11 +2,13 @@
image: /generated/articles-docs-cloudrun-getregions.png
id: getregions
title: getRegions()
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Gets an array of all supported GCP regions of this release of Remotion Cloud Run.
@@ -14,9 +16,7 @@ Gets an array of all supported GCP regions of this release of Remotion Cloud Run
## Example
```tsx twoslash
-// @module: esnext
-// @target: es2017
-import { getRegions } from "@remotion/cloudrun/client";
+import {getRegions} from '@remotion/cloudrun/client';
// ---cut---
diff --git a/packages/docs/docs/cloudrun/getservices.mdx b/packages/docs/docs/cloudrun/getservices.mdx
index e184c6c2bb..ef93cad8f3 100644
--- a/packages/docs/docs/cloudrun/getservices.mdx
+++ b/packages/docs/docs/cloudrun/getservices.mdx
@@ -3,11 +3,13 @@ image: /generated/articles-docs-cloudrun-getservices.png
title: getServices()
id: getservices
slug: /cloudrun/getservices
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Retrieves a list of Remotion services deployed to GCP Cloud Run.
@@ -25,13 +27,10 @@ If you are sure that a service exists, you can also guess the name of it using [
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { getServices } from "@remotion/cloudrun/client";
+import {getServices} from '@remotion/cloudrun/client';
const info = await getServices({
- region: "us-east1",
+ region: 'us-east1',
compatibleOnly: true,
});
@@ -60,13 +59,10 @@ An object containing the following properties:
The [GCP region](/docs/cloudrun/region-selection) that you would like to query.
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { getServices } from "@remotion/cloudrun";
+import {getServices} from '@remotion/cloudrun';
const info = await getServices({
- region: "us-west1",
+ region: 'us-west1',
compatibleOnly: true,
});
diff --git a/packages/docs/docs/cloudrun/getsites.mdx b/packages/docs/docs/cloudrun/getsites.mdx
index 71860e8366..ef92399f80 100644
--- a/packages/docs/docs/cloudrun/getsites.mdx
+++ b/packages/docs/docs/cloudrun/getsites.mdx
@@ -3,11 +3,13 @@ image: /generated/articles-docs-cloudrun-getsites.png
id: getsites
title: getSites()
slug: /cloudrun/getsites
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Gets an array of Remotion projects in Cloud Storage, in your GCP project.
@@ -19,11 +21,9 @@ The projects are located in the `sites/` subdirectory of your Cloud Storage buck
Gets all sites and logs information about them.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { getSites } from "@remotion/cloudrun";
+import {getSites} from '@remotion/cloudrun';
-const { sites, buckets } = await getSites("europe-west4");
+const {sites, buckets} = await getSites('europe-west4');
for (const site of sites) {
console.log(site.id); // A unique ID for referring to that project
@@ -48,11 +48,9 @@ An object with the following properties:
The [GCP region](/docs/cloudrun/region-selection) which you want to query. Alternatively, you can pass 'all regions' to return sites across all regions.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { getSites } from "@remotion/cloudrun";
+import {getSites} from '@remotion/cloudrun';
-const { sites, buckets } = await getSites("all regions");
+const {sites, buckets} = await getSites('all regions');
```
## Return value
diff --git a/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx b/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx
index 645d9c6cc2..89674d6b48 100644
--- a/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx
+++ b/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx
@@ -7,12 +7,7 @@ crumb: 'Cloud Run API'
<ExperimentalBadge>
<p>
- Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs
- may change in any version and documentation is not yet finished. See the{' '}
- <a href="https://remotion.dev/changelog">
- changelog to stay up to date with breaking changes
- </a>
- .
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
</p>
</ExperimentalBadge>
@@ -24,8 +19,6 @@ A [site](/docs/cloudrun/deploysite) or a [Serve URL](/docs/terminology/serve-url
## Example
```tsx twoslash
-// @module: esnext
-// @target: es2017
// ---cut---
import {renderMediaOnCloudrun} from '@remotion/cloudrun/client';
@@ -33,8 +26,7 @@ const result = await renderMediaOnCloudrun({
region: 'us-east1',
serviceName: 'remotion-render-bds9aab',
composition: 'MyVideo',
- serveUrl:
- 'https://storage.googleapis.com/remotioncloudrun-123asd321/sites/abcdefgh',
+ serveUrl: 'https://storage.googleapis.com/remotioncloudrun-123asd321/sites/abcdefgh',
codec: 'h264',
});
@@ -135,7 +127,6 @@ Your webhook URL that will be called with the progress of the render. This will
- `data`: The data that you want to be sent alongside the progress data.
- `webhookProgressInterval (optional)`: The interval at which the webhook is called. Defaults to 0.1 (10%). (min: 0.01, max: 1)
-
```json title="Example Webhook URL Declaration"
{
"url": "https://example.com/webhook",
diff --git a/packages/docs/docs/cloudrun/renderstilloncloudrun.mdx b/packages/docs/docs/cloudrun/renderstilloncloudrun.mdx
index b408b51e93..d05e233868 100644
--- a/packages/docs/docs/cloudrun/renderstilloncloudrun.mdx
+++ b/packages/docs/docs/cloudrun/renderstilloncloudrun.mdx
@@ -7,12 +7,7 @@ crumb: 'Cloud Run API'
<ExperimentalBadge>
<p>
- Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs
- may change in any version and documentation is not yet finished. See the{' '}
- <a href="https://remotion.dev/changelog">
- changelog to stay up to date with breaking changes
- </a>
- .
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
</p>
</ExperimentalBadge>
@@ -24,8 +19,6 @@ A [site](/docs/cloudrun/deploysite) or a [Serve URL](/docs/terminology/serve-url
## Example
```tsx twoslash
-// @module: esnext
-// @target: es2017
// ---cut---
import {renderStillOnCloudrun} from '@remotion/cloudrun/client';
@@ -34,8 +27,7 @@ const result = await renderStillOnCloudrun({
serviceName: 'remotion-render-bds9aab',
composition: 'MyStill',
imageFormat: 'png',
- serveUrl:
- 'https://storage.googleapis.com/remotioncloudrun-123asd321/sites/abcdefgh',
+ serveUrl: 'https://storage.googleapis.com/remotioncloudrun-123asd321/sites/abcdefgh',
});
if (result.type === 'success') {
diff --git a/packages/docs/docs/cloudrun/setup.mdx b/packages/docs/docs/cloudrun/setup.mdx
index 2a874a62cc..990c298b87 100644
--- a/packages/docs/docs/cloudrun/setup.mdx
+++ b/packages/docs/docs/cloudrun/setup.mdx
@@ -3,19 +3,21 @@ image: /generated/articles-docs-cloudrun-setup.png
id: setup
title: Setup
slug: /cloudrun/setup
-crumb: "Cloud Run"
+crumb: 'Cloud Run'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
## 1. Install `@remotion/cloudrun`
-<Installation pkg="@remotion/cloudrun"/>
+<Installation pkg="@remotion/cloudrun" />
## 2. Create a GCP project
@@ -72,7 +74,7 @@ From within your code base, run the following command to validate the permission
npx remotion cloudrun permissions
```
-<hr/>
+<hr />
For the following steps, you may execute them on the CLI, or programmatically using the Node.JS APIs.
@@ -99,18 +101,17 @@ npx remotion cloudrun services deploy
You can deploy a service that can render videos into your GCP project using [`deployService()`](/docs/cloudrun/deployservice).
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { deployService } from "@remotion/cloudrun";
+import {deployService} from '@remotion/cloudrun';
// ---cut---
const deployResult = await deployService({
- projectID: "my-remotion-project",
- region: "us-east1",
+ projectID: 'my-remotion-project',
+ region: 'us-east1',
});
```
The object that is returned contains a name field, which you'll need for rendering.
+
</TabItem>
</Tabs>
@@ -145,32 +146,28 @@ When you update your Remotion code in the future, redeploy your site. Pass the s
First, you need to create a Cloud Storage bucket in your preferred region. If one already exists, it will be used instead:
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import path from "path";
-import { deploySite, getOrCreateBucket } from "@remotion/cloudrun";
+import path from 'path';
+import {deploySite, getOrCreateBucket} from '@remotion/cloudrun';
-const { bucketName } = await getOrCreateBucket({
- region: "us-east1",
+const {bucketName} = await getOrCreateBucket({
+ region: 'us-east1',
});
```
Next, upload your Remotion project to a Cloud Storage bucket. Specify the entry point of your Remotion project, this is the file where [`registerRoot()`](/docs/register-root) is called.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import path from "path";
-import { deploySite, getOrCreateBucket } from "@remotion/cloudrun";
+import path from 'path';
+import {deploySite, getOrCreateBucket} from '@remotion/cloudrun';
-const { bucketName } = await getOrCreateBucket({
- region: "us-east1",
+const {bucketName} = await getOrCreateBucket({
+ region: 'us-east1',
});
// ---cut---
-const { serveUrl } = await deploySite({
+const {serveUrl} = await deploySite({
bucketName,
- entryPoint: path.resolve(process.cwd(), "src/index.ts"),
- siteName: "my-video",
+ entryPoint: path.resolve(process.cwd(), 'src/index.ts'),
+ siteName: 'my-video',
});
```
@@ -293,12 +290,10 @@ values={[
You already have the service name from a previous step. But since you only need to deploy a service once, it's useful to retrieve the name of your deployed service programmatically before rendering a video in case your Node.JS program restarts. We can call [`getServices()`](/docs/cloudrun/getservices) with the `compatibleOnly` flag to get only services with a matching version.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { getServices, renderMediaOnCloudrun } from "@remotion/cloudrun/client";
+import {getServices, renderMediaOnCloudrun} from '@remotion/cloudrun/client';
const services = await getServices({
- region: "us-east1",
+ region: 'us-east1',
compatibleOnly: true,
});
@@ -308,26 +303,23 @@ const serviceName = services[0].serviceName;
We can now trigger a render of a video using the [`renderMediaOnCloudrun()`](/docs/cloudrun/rendermediaoncloudrun) function.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-
-import { renderMediaOnCloudrun } from "@remotion/cloudrun/client";
-const url = "string";
-const serviceName = "string";
+import {renderMediaOnCloudrun} from '@remotion/cloudrun/client';
+const url = 'string';
+const serviceName = 'string';
const updateRenderProgress = (progress: number) => {};
// ---cut---
const result = await renderMediaOnCloudrun({
serviceName,
- region: "us-east1",
+ region: 'us-east1',
serveUrl: url,
- composition: "HelloWorld",
+ composition: 'HelloWorld',
inputProps: {},
- codec: "h264",
+ codec: 'h264',
updateRenderProgress,
});
-if (result.type === "success") {
+if (result.type === 'success') {
console.log(result.bucketName);
console.log(result.renderId);
}
@@ -340,18 +332,17 @@ Import from [`@remotion/cloudrun/client`](/docs/cloudrun/light-client) to not im
The render will now run and after a while the video will be available in your cloud storage bucket. You can keep track of the render progress by passing a function to the [updateRenderProgress](/docs/cloudrun/rendermediaoncloudrun#updaterenderprogress) attribute, to receive progress as a number.
Congrats! [Check your Cloud Storage Bucket](https://console.cloud.google.com/storage/browser) - you just rendered your first video using Remotion Cloud Run 🚀
+
</TabItem>
<TabItem value="still">
You already have the service name from a previous step. But since you only need to deploy a service once, it's useful to retrieve the name of your deployed service programmatically before rendering a video in case your Node.JS program restarts. We can call [`getServices()`](/docs/cloudrun/getservices) with the `compatibleOnly` flag to get only services with a matching version.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { getServices, renderStillOnCloudrun } from "@remotion/cloudrun";
+import {getServices, renderStillOnCloudrun} from '@remotion/cloudrun';
const services = await getServices({
- region: "us-east1",
+ region: 'us-east1',
compatibleOnly: true,
});
@@ -361,24 +352,22 @@ const serviceName = services[0].serviceName;
We can now trigger a render of a still using the [`renderStillOnCloudrun()`](/docs/cloudrun/renderstilloncloudrun) function.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { renderStillOnCloudrun } from "@remotion/cloudrun/client";
+import {renderStillOnCloudrun} from '@remotion/cloudrun/client';
-const url = "string";
-const serviceName = "string";
+const url = 'string';
+const serviceName = 'string';
// ---cut---
const result = await renderStillOnCloudrun({
serviceName,
- region: "us-east1",
+ region: 'us-east1',
serveUrl: url,
- composition: "HelloWorld",
+ composition: 'HelloWorld',
inputProps: {},
- imageFormat: "jpeg",
+ imageFormat: 'jpeg',
});
-if (result.type === "success") {
+if (result.type === 'success') {
console.log(result.bucketName);
console.log(result.renderId);
}
diff --git a/packages/docs/docs/cloudrun/speculateservicename.mdx b/packages/docs/docs/cloudrun/speculateservicename.mdx
index c7b7b7dd7a..674ef6b01e 100644
--- a/packages/docs/docs/cloudrun/speculateservicename.mdx
+++ b/packages/docs/docs/cloudrun/speculateservicename.mdx
@@ -3,11 +3,13 @@ image: /generated/articles-docs-cloudrun-speculateservicename.png
id: speculateservicename
title: speculateServiceName()
slug: /cloudrun/speculateservicename
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Speculate the name of the Cloud Run service that will be created by [deployService()](/docs/cloudrun/deployservice) or its CLI equivalent, [`npx remotion cloudrun services deploy`](/docs/cloudrun/cli/services). This could be useful in cases when the configuration of the Cloud Run service is known in advance, and the name of the service is needed.
@@ -39,14 +41,11 @@ remotion--3-3-96--mem2gi--cpu1-0--t-1900
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { speculateServiceName } from "@remotion/cloudrun";
+import {speculateServiceName} from '@remotion/cloudrun';
const speculatedServiceName = speculateServiceName({
- memoryLimit: "2Gi",
- cpuLimit: "2",
+ memoryLimit: '2Gi',
+ cpuLimit: '2',
timeoutSeconds: 300,
});
diff --git a/packages/docs/docs/cloudrun/testpermissions.mdx b/packages/docs/docs/cloudrun/testpermissions.mdx
index 6e89a67521..ff591eebf2 100644
--- a/packages/docs/docs/cloudrun/testpermissions.mdx
+++ b/packages/docs/docs/cloudrun/testpermissions.mdx
@@ -3,11 +3,13 @@ image: /generated/articles-docs-cloudrun-testpermissions.png
id: testpermissions
title: testPermissions()
slug: /cloudrun/testpermissions
-crumb: "Cloud Run API"
+crumb: 'Cloud Run API'
---
<ExperimentalBadge>
-<p>Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.</p>
+ <p>
+ Cloud Run is in <a href="/docs/cloudrun-alpha">Alpha</a>, which means APIs may change in any version and documentation is not yet finished. See the <a href="https://remotion.dev/changelog">changelog to stay up to date with breaking changes</a>.
+ </p>
</ExperimentalBadge>
Makes a call to the [Test Iam Permissions](https://cloud.google.com/resource-manager/reference/rest/v3/projects/testIamPermissions) method of the Resource Manager API in GCP, which returns the list of permissions the Service Account has on the GCP Project. This is then validated against the list of permissions required for the version of Remotion.
@@ -19,12 +21,9 @@ The function does not reject with an error if a permission is missing, rather th
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
+import {testPermissions} from '@remotion/cloudrun';
-import { testPermissions } from "@remotion/cloudrun";
-
-const { results } = await testPermissions();
+const {results} = await testPermissions();
for (const result of results) {
console.log(result.decision); // "allowed"
@@ -43,12 +42,9 @@ _optional_
A callback function that gets called every time a new test has been executed. This allows you to react to new test results coming in much faster than waiting for the return value of the function. Example:
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { testPermissions } from "@remotion/cloudrun";
+import {testPermissions} from '@remotion/cloudrun';
-const { results } = await testPermissions({
+const {results} = await testPermissions({
onTest: (result) => {
console.log(result.decision); // "allowed"
console.log(result.permissionName); // "iam.serviceAccounts.actAs"
diff --git a/packages/docs/docs/dataset-render.mdx b/packages/docs/docs/dataset-render.mdx
index 44f7756bdd..5b190a7ee3 100644
--- a/packages/docs/docs/dataset-render.mdx
+++ b/packages/docs/docs/dataset-render.mdx
@@ -3,18 +3,18 @@ image: /generated/articles-docs-dataset-render.png
id: dataset-render
sidebar_label: Render a dataset
title: Render videos programmatically from a dataset
-crumb: "Tutorials"
+crumb: 'Tutorials'
---
-import { Player } from "@remotion/player";
-import { DatasetDemo } from "../components/Dataset/DatasetDemo";
+import {Player} from '@remotion/player';
+import {DatasetDemo} from '../components/Dataset/DatasetDemo';
You can use Remotion to do a batch render to create many videos based on a dataset. In the following example, we are going to turn a JSON dataset into a series of videos.
We'll start by creating a blank Remotion project:
-import Tabs from "@theme/Tabs";
-import TabItem from "@theme/TabItem";
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
<Tabs
defaultValue="npm"
@@ -63,14 +63,14 @@ JSON is the most convenient format to import in Remotion. If your dataset is in
```ts title="my-data.ts"
export const data = [
{
- name: "React",
- repo: "facebook/react",
- logo: "https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg",
+ name: 'React',
+ repo: 'facebook/react',
+ logo: 'https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg',
},
{
- name: "Remotion",
- repo: "remotion-dev/remotion",
- logo: "https://github.com/remotion-dev/logo/raw/main/withouttitle/element-0.png",
+ name: 'Remotion',
+ repo: 'remotion-dev/remotion',
+ logo: 'https://github.com/remotion-dev/logo/raw/main/withouttitle/element-0.png',
},
];
```
@@ -80,15 +80,8 @@ export const data = [
This component will animate a title, subtitle and image using Remotion. Replace the contents of the `src/Composition.tsx` file with the following:
```tsx title="Composition.tsx"
-import React from "react";
-import {
- AbsoluteFill,
- Img,
- interpolate,
- spring,
- useCurrentFrame,
- useVideoConfig,
-} from "remotion";
+import React from 'react';
+import {AbsoluteFill, Img, interpolate, spring, useCurrentFrame, useVideoConfig} from 'remotion';
type Props = {
name: string;
@@ -96,9 +89,9 @@ type Props = {
repo: string;
};
-export const MyComposition: React.FC<Props> = ({ name, repo, logo }) => {
+export const MyComposition: React.FC<Props> = ({name, repo, logo}) => {
const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
+ const {fps} = useVideoConfig();
const scale = spring({
fps,
@@ -109,29 +102,29 @@ export const MyComposition: React.FC<Props> = ({ name, repo, logo }) => {
});
const opacity = interpolate(frame, [30, 40], [0, 1], {
- extrapolateLeft: "clamp",
- extrapolateRight: "clamp",
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
});
const moveY = interpolate(frame, [20, 30], [10, 0], {
- extrapolateLeft: "clamp",
- extrapolateRight: "clamp",
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
});
return (
<AbsoluteFill
style={{
scale: String(scale),
- backgroundColor: "white",
- fontWeight: "bold",
- justifyContent: "center",
- alignItems: "center",
+ backgroundColor: 'white',
+ fontWeight: 'bold',
+ justifyContent: 'center',
+ alignItems: 'center',
}}
>
<div
style={{
- display: "flex",
- flexDirection: "row",
- alignItems: "center",
+ display: 'flex',
+ flexDirection: 'row',
+ alignItems: 'center',
gap: 20,
}}
>
@@ -143,8 +136,8 @@ export const MyComposition: React.FC<Props> = ({ name, repo, logo }) => {
/>
<div
style={{
- display: "flex",
- flexDirection: "column",
+ display: 'flex',
+ flexDirection: 'column',
}}
>
<div
@@ -181,17 +174,15 @@ This can be done by using the [`bundle()`](/docs/bundle) function from the [`@re
```ts twoslash
// @filename: webpack-override.ts
-import type { WebpackOverrideFn } from "@remotion/bundler";
+import type {WebpackOverrideFn} from '@remotion/bundler';
export const webpackOverride: WebpackOverrideFn = (f) => f;
// @filename: script.ts
-// @module: esnext
-// @target: es2022
// ---cut---
-import { bundle } from "@remotion/bundler";
-import { webpackOverride } from "./webpack-override";
+import {bundle} from '@remotion/bundler';
+import {webpackOverride} from './webpack-override';
const bundleLocation = await bundle({
- entryPoint: "./src/index.ts",
+ entryPoint: './src/index.ts',
// If you have a webpack override, don't forget to add it
webpackOverride: webpackOverride,
});
@@ -206,28 +197,26 @@ Fetch the composition metadata for each render using [`selectComposition()`](/do
Trigger a render using [`renderMedia()`](/docs/renderer/render-media) and pass the data entry as [`inputProps`](/docs/renderer/render-media#inputprops). This will pass the object as React props to the component above.
```ts twoslash
-// @module: esnext
-// @target: es2022
// @filename: dataset.ts
export const data = [
{
- name: "React",
- repo: "facebook/react",
- logo: "https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg",
+ name: 'React',
+ repo: 'facebook/react',
+ logo: 'https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg',
},
{
- name: "Remotion",
- repo: "remotion-dev/remotion",
- logo: "https://github.com/remotion-dev/logo/raw/main/withouttitle/element-0.png",
+ name: 'Remotion',
+ repo: 'remotion-dev/remotion',
+ logo: 'https://github.com/remotion-dev/logo/raw/main/withouttitle/element-0.png',
},
];
// @filename: render.ts
-const compositionId = "MyComp";
-const bundleLocation = "xxx";
+const compositionId = 'MyComp';
+const bundleLocation = 'xxx';
// ---cut---
-import { renderMedia, selectComposition } from "@remotion/renderer";
-import { data } from "./dataset";
+import {renderMedia, selectComposition} from '@remotion/renderer';
+import {data} from './dataset';
for (const entry of data) {
const composition = await selectComposition({
@@ -239,7 +228,7 @@ for (const entry of data) {
await renderMedia({
composition,
serveUrl: bundleLocation,
- codec: "h264",
+ codec: 'h264',
outputLocation: `out/${entry.name}.mp4`,
inputProps: entry,
});
@@ -256,34 +245,32 @@ It is not recommended to render more than one video at once.
// @filename: dataset.ts
export const data = [
{
- name: "React",
- repo: "facebook/react",
- logo: "https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg",
+ name: 'React',
+ repo: 'facebook/react',
+ logo: 'https://upload.wikimedia.org/wikipedia/commons/a/a7/React-icon.svg',
},
{
- name: "Remotion",
- repo: "remotion-dev/remotion",
- logo: "https://github.com/remotion-dev/logo/raw/main/withouttitle/element-0.png",
+ name: 'Remotion',
+ repo: 'remotion-dev/remotion',
+ logo: 'https://github.com/remotion-dev/logo/raw/main/withouttitle/element-0.png',
},
];
// @filename: webpack-override.ts
-import type { WebpackOverrideFn } from "@remotion/bundler";
+import type {WebpackOverrideFn} from '@remotion/bundler';
export const webpackOverride: WebpackOverrideFn = (f) => f;
// @filename: render.ts
// ---cut---
-// @module: ESNext
-// @target: ESNext
-import { selectComposition, renderMedia } from "@remotion/renderer";
-import { webpackOverride } from "./webpack-override";
-import { bundle } from "@remotion/bundler";
-import { data } from "./dataset";
+import {selectComposition, renderMedia} from '@remotion/renderer';
+import {webpackOverride} from './webpack-override';
+import {bundle} from '@remotion/bundler';
+import {data} from './dataset';
-const compositionId = "MyComp";
+const compositionId = 'MyComp';
const bundleLocation = await bundle({
- entryPoint: "./src/index.ts",
+ entryPoint: './src/index.ts',
// If you have a webpack override in remotion.config.ts, pass it here as well.
webpackOverride: webpackOverride,
});
@@ -298,7 +285,7 @@ for (const entry of data) {
await renderMedia({
composition,
serveUrl: bundleLocation,
- codec: "h264",
+ codec: 'h264',
outputLocation: `out/${entry.name}.mp4`,
inputProps: entry,
});
@@ -345,16 +332,16 @@ Use a package like [`csv2json`](https://www.npmjs.com/package/csv2json) to conve
<Credits
contributors={[
{
- username: "alexfernandez803",
- contribution: "Author",
+ username: 'alexfernandez803',
+ contribution: 'Author',
},
{
- username: "ThePerfectSystem",
- contribution: "Author",
+ username: 'ThePerfectSystem',
+ contribution: 'Author',
},
{
- username: "JonnyBurger",
- contribution: "Editor",
+ username: 'JonnyBurger',
+ contribution: 'Editor',
},
]}
/>
diff --git a/packages/docs/docs/docker.mdx b/packages/docs/docs/docker.mdx
index fbc8c6fda4..794a9ce507 100644
--- a/packages/docs/docs/docker.mdx
+++ b/packages/docs/docs/docker.mdx
@@ -54,8 +54,7 @@ CMD ["node", "render.mjs"]
## Line-by-line
<p>
- <Step>1</Step> Specify the base image for the Dockerfile. In this case, we use
- Debian.
+ <Step>1</Step> Specify the base image for the Dockerfile. In this case, we use Debian.
</p>
```docker
@@ -63,9 +62,7 @@ FROM node:22-bookworm-slim
```
<p>
- <Step>2</Step> Update the package lists on the Debian system and install the
- needed [shared libraries](/docs/miscellaneous/linux-dependencies) for Chrome
- Headless Shell.
+ <Step>2</Step> Update the package lists on the Debian system and install the needed [shared libraries](/docs/miscellaneous/linux-dependencies) for Chrome Headless Shell.
</p>
```docker
@@ -86,12 +83,8 @@ RUN apt install -y \
```
<p>
- <Step>3</Step> Copy the files from your project. If you have additional source
- files, add them here. If some files do not exist, remove them. The{' '}
- <code>COPY</code> syntax allows multiple files, but at least one file must
- exist. It is assumed <code>package.json</code>, <code>src</code> and{' '}
- <code>public</code> exist in your project, but you can adjust this to your
- needs.
+ <Step>3</Step> Copy the files from your project. If you have additional source files, add them here. If some files do not exist, remove them. The <code>COPY</code> syntax allows multiple files, but at least one file must exist. It is assumed <code>package.json</code>, <code>src</code> and{' '}
+ <code>public</code> exist in your project, but you can adjust this to your needs.
</p>
```docker
@@ -123,8 +116,7 @@ COPY public ./public
```
<p>
- <Step>5</Step> Install [Chrome Headless
- Shell](/docs/miscellaneous/chrome-headless-shell).
+ <Step>5</Step> Install [Chrome Headless Shell](/docs/miscellaneous/chrome-headless-shell).
</p>
```docker
@@ -145,8 +137,6 @@ CMD ["node", "render.mjs"]
Assuming you want to render the composition `MyComp`:
```tsx twoslash title="render.mjs"
-// @module: ESNext
-// @target: ESNext
import {bundle} from '@remotion/bundler';
import {renderMedia, selectComposition} from '@remotion/renderer';
import {createRequire} from 'node:module';
diff --git a/packages/docs/docs/get-audio-data.mdx b/packages/docs/docs/get-audio-data.mdx
index 9b20cd484c..7027caa624 100644
--- a/packages/docs/docs/get-audio-data.mdx
+++ b/packages/docs/docs/get-audio-data.mdx
@@ -16,8 +16,7 @@ Remote audio files need to support [CORS](https://developer.mozilla.org/en-US/do
<summary>More info</summary>
<ul>
<li>
- Remotion's origin is usually <code>http://localhost:3000</code>, but it
- may be different if rendering on Lambda or the port is busy.
+ Remotion's origin is usually <code>http://localhost:3000</code>, but it may be different if rendering on Lambda or the port is busy.
</li>
<li>
You can use{' '}
@@ -27,9 +26,7 @@ Remote audio files need to support [CORS](https://developer.mozilla.org/en-US/do
without the audio needing CORS.
</li>
<li>
- You can{' '}
- <a href="/docs/chromium-flags#--disable-web-security">disable CORS</a>{' '}
- during renders.
+ You can <a href="/docs/chromium-flags#--disable-web-security">disable CORS</a> during renders.
</li>
</ul>
</details>
@@ -96,8 +93,6 @@ Whether the audio was imported locally or from a different origin.
## Example
```ts twoslash
-// @module: ESNext
-// @target: ESNext
import {Audio, staticFile} from 'remotion';
// ---cut---
import {getAudioData} from '@remotion/media-utils';
diff --git a/packages/docs/docs/get-audio-duration-in-seconds.mdx b/packages/docs/docs/get-audio-duration-in-seconds.mdx
index e4de49e496..c5d7266c7c 100644
--- a/packages/docs/docs/get-audio-duration-in-seconds.mdx
+++ b/packages/docs/docs/get-audio-duration-in-seconds.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-get-audio-duration-in-seconds.png
title: getAudioDurationInSeconds()
id: get-audio-duration-in-seconds
-crumb: "@remotion/media-utils"
+crumb: '@remotion/media-utils'
---
_Part of the `@remotion/media-utils` package of helper functions._
@@ -24,23 +24,17 @@ A string pointing to an audio asset
## Example
```tsx twoslash
-// @module: ESNext
-// @target: ESNext
-import { useCallback, useEffect } from "react";
-import { staticFile } from "remotion";
+import {useCallback, useEffect} from 'react';
+import {staticFile} from 'remotion';
// ---cut---
-import { getAudioDurationInSeconds } from "@remotion/media-utils";
-import music from "./music.mp3";
+import {getAudioDurationInSeconds} from '@remotion/media-utils';
+import music from './music.mp3';
const MyComp: React.FC = () => {
const getDuration = useCallback(async () => {
- const publicFile = await getAudioDurationInSeconds(
- staticFile("voiceover.wav"),
- ); // 33.221
+ const publicFile = await getAudioDurationInSeconds(staticFile('voiceover.wav')); // 33.221
const imported = await getAudioDurationInSeconds(music); // 127.452
- const remote = await getAudioDurationInSeconds(
- "https://example.com/remote-audio.aac",
- ); // 50.24
+ const remote = await getAudioDurationInSeconds('https://example.com/remote-audio.aac'); // 50.24
}, []);
useEffect(() => {
diff --git a/packages/docs/docs/get-image-dimensions.mdx b/packages/docs/docs/get-image-dimensions.mdx
index e68c62a924..8949973941 100644
--- a/packages/docs/docs/get-image-dimensions.mdx
+++ b/packages/docs/docs/get-image-dimensions.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-get-image-dimensions.png
title: getImageDimensions()
id: get-image-dimensions
-crumb: "@remotion/media-utils"
+crumb: '@remotion/media-utils'
---
_Part of the `@remotion/media-utils` package of helper functions. Available from v4.0.143._
@@ -36,13 +36,9 @@ The image height, in pixels (px).
## Example
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { getImageDimensions } from "@remotion/media-utils";
+import {getImageDimensions} from '@remotion/media-utils';
-const { width, height } = await getImageDimensions(
- "https://example.com/remote-image.png",
-);
+const {width, height} = await getImageDimensions('https://example.com/remote-image.png');
console.log(width, height);
```
diff --git a/packages/docs/docs/get-video-metadata.mdx b/packages/docs/docs/get-video-metadata.mdx
index 079dc8933e..952953f169 100644
--- a/packages/docs/docs/get-video-metadata.mdx
+++ b/packages/docs/docs/get-video-metadata.mdx
@@ -43,8 +43,6 @@ Ensure handling for `Infinity` for user-provided videos and re-encode videos wit
## Example
```tsx twoslash
-// @module: ESNext
-// @target: ESNext
import {staticFile} from 'remotion';
// ---cut---
import {getVideoMetadata} from '@remotion/media-utils';
diff --git a/packages/docs/docs/get-waveform-portion.mdx b/packages/docs/docs/get-waveform-portion.mdx
index 14db3c2e9e..04f5664643 100644
--- a/packages/docs/docs/get-waveform-portion.mdx
+++ b/packages/docs/docs/get-waveform-portion.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-get-waveform-portion.png
title: getWaveformPortion()
id: get-waveform-portion
-crumb: "@remotion/media-utils"
+crumb: '@remotion/media-utils'
---
_Part of the `@remotion/media-utils` package of helper functions._
@@ -56,14 +56,11 @@ A value describing the amplitude / volume / loudness of the audio. Values range
## Example
```tsx twoslash
-// @module: ESNext
-// @target: ESNext
-
// ---cut---
-import { getAudioData, getWaveformPortion } from "@remotion/media-utils";
-import { staticFile } from "remotion";
+import {getAudioData, getWaveformPortion} from '@remotion/media-utils';
+import {staticFile} from 'remotion';
-const audioData = await getAudioData(staticFile("music.mp3")); /* {
+const audioData = await getAudioData(staticFile('music.mp3')); /* {
channelWaveforms: [Float32Array(4410000), Float32Array(4410000)],
sampleRate: 44100,
durationInSeconds: 100.0000,
diff --git a/packages/docs/docs/gif/get-gif-duration-in-seconds.mdx b/packages/docs/docs/gif/get-gif-duration-in-seconds.mdx
index 314be8342b..52c2868b5c 100644
--- a/packages/docs/docs/gif/get-gif-duration-in-seconds.mdx
+++ b/packages/docs/docs/gif/get-gif-duration-in-seconds.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-gif-get-gif-duration-in-seconds.png
title: getGifDurationInSeconds()
id: get-gif-duration-in-seconds
-crumb: "@remotion/gif"
+crumb: '@remotion/gif'
---
_Part of the [`@remotion/gif`](/docs/gif) package_
@@ -15,15 +15,15 @@ Gets the duration in seconds of a GIF.
Remote GIFs need to support [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
<details>
-<summary>More info</summary>
-<ul>
-<li>
-Remotion's origin is usually <code>http://localhost:3000</code>, but it may be different if rendering on Lambda or the port is busy.
-</li>
-<li>
-You can <a href="/docs/chromium-flags#--disable-web-security">disable CORS</a> during renders.
-</li>
-</ul>
+ <summary>More info</summary>
+ <ul>
+ <li>
+ Remotion's origin is usually <code>http://localhost:3000</code>, but it may be different if rendering on Lambda or the port is busy.
+ </li>
+ <li>
+ You can <a href="/docs/chromium-flags#--disable-web-security">disable CORS</a> during renders.
+ </li>
+ </ul>
</details>
:::
@@ -40,21 +40,17 @@ A string pointing to a GIF asset
## Example
```tsx twoslash
-// @module: ESNext
-// @target: ESNext
-import { useCallback, useEffect } from "react";
-import { staticFile } from "remotion";
+import {useCallback, useEffect} from 'react';
+import {staticFile} from 'remotion';
// ---cut---
-import { getGifDurationInSeconds } from "@remotion/gif";
-import gif from "./cat.gif";
+import {getGifDurationInSeconds} from '@remotion/gif';
+import gif from './cat.gif';
const MyComp: React.FC = () => {
const getDuration = useCallback(async () => {
const imported = await getGifDurationInSeconds(gif); // 127.452
- const publicFile = await getGifDurationInSeconds(staticFile("giphy.gif")); // 2.10
- const remote = await getGifDurationInSeconds(
- "https://media.giphy.com/media/xT0GqH01ZyKwd3aT3G/giphy.gif"
- ); // 3.23
+ const publicFile = await getGifDurationInSeconds(staticFile('giphy.gif')); // 2.10
+ const remote = await getGifDurationInSeconds('https://media.giphy.com/media/xT0GqH01ZyKwd3aT3G/giphy.gif'); // 3.23
}, []);
useEffect(() => {
diff --git a/packages/docs/docs/hardware-acceleration.mdx b/packages/docs/docs/hardware-acceleration.mdx
index b3ccb1acfe..b4d26842b7 100644
--- a/packages/docs/docs/hardware-acceleration.mdx
+++ b/packages/docs/docs/hardware-acceleration.mdx
@@ -26,8 +26,6 @@ If you want the render to fail if hardware acceleration is not possible, set the
Use the [`hardwareAcceleration`](/docs/renderer/render-media#hardwareacceleration) option in the [`renderMedia()`](/docs/renderer/render-media) function.
```tsx twoslash {8}
-// @module: esnext
-// @target: es2017
const serveUrl = '/path/to/bundle';
const outputLocation = '/path/to/frames';
diff --git a/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx b/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx
index 09119d25f1..877a24fd9d 100644
--- a/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx
+++ b/packages/docs/docs/install-whisper-cpp/download-whisper-model.mdx
@@ -10,8 +10,6 @@ Downloads a Whisper.cpp model to a folder.
You should first install Whisper.cpp, for example through [`installWhisperCpp()`](/docs/install-whisper-cpp/install-whisper-cpp).
```tsx twoslash title="install-whisper.mjs"
-// @module: esnext
-// @target: es2022
import path from 'path';
import {downloadWhisperModel} from '@remotion/install-whisper-cpp';
@@ -38,10 +36,7 @@ Act upon download progress. This is the function signature:
```tsx twoslash
import type {OnProgress} from '@remotion/install-whisper-cpp';
-const onProgress: OnProgress = (
- downloadedBytes: number,
- totalBytes: number,
-) => {
+const onProgress: OnProgress = (downloadedBytes: number, totalBytes: number) => {
const progress = downloadedBytes / totalBytes;
};
```
diff --git a/packages/docs/docs/install-whisper-cpp/index.mdx b/packages/docs/docs/install-whisper-cpp/index.mdx
index cfca2878c3..b6187bd43b 100644
--- a/packages/docs/docs/install-whisper-cpp/index.mdx
+++ b/packages/docs/docs/install-whisper-cpp/index.mdx
@@ -18,15 +18,8 @@ import {TableOfContents} from './install-whisper-cpp';
Install Whisper `1.5.5` (the latest version at the time of writing that we find works well and supports token-level timestamps) and the `medium.en` model to the `whisper.cpp` folder.
```tsx twoslash title="install-whisper.cpp"
-// @module: esnext
-// @target: es2022
import path from 'path';
-import {
- downloadWhisperModel,
- installWhisperCpp,
- transcribe,
- convertToCaptions,
-} from '@remotion/install-whisper-cpp';
+import {downloadWhisperModel, installWhisperCpp, transcribe, convertToCaptions} from '@remotion/install-whisper-cpp';
const to = path.join(process.cwd(), 'whisper.cpp');
diff --git a/packages/docs/docs/install-whisper-cpp/install-whisper-cpp.mdx b/packages/docs/docs/install-whisper-cpp/install-whisper-cpp.mdx
index 50a9187347..6f283f3ba0 100644
--- a/packages/docs/docs/install-whisper-cpp/install-whisper-cpp.mdx
+++ b/packages/docs/docs/install-whisper-cpp/install-whisper-cpp.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-install-whisper-cpp-install-whisper-cpp.png
slug: install-whisper-cpp
title: installWhisperCpp()
-crumb: "@remotion/install-whisper-cpp"
+crumb: '@remotion/install-whisper-cpp'
---
# installWhisperCpp()<AvailableFrom v="4.0.115"/>
@@ -10,14 +10,12 @@ crumb: "@remotion/install-whisper-cpp"
Installs a Whisper.cpp version into a folder.
```tsx twoslash title="install-whisper.mjs"
-// @module: esnext
-// @target: es2022
-import path from "path";
-import { installWhisperCpp } from "@remotion/install-whisper-cpp";
-
-const { alreadyExisted } = await installWhisperCpp({
- to: path.join(process.cwd(), "whisper.cpp"),
- version: "1.5.5", // A Whisper.cpp semver or git tag
+import path from 'path';
+import {installWhisperCpp} from '@remotion/install-whisper-cpp';
+
+const {alreadyExisted} = await installWhisperCpp({
+ to: path.join(process.cwd(), 'whisper.cpp'),
+ version: '1.5.5', // A Whisper.cpp semver or git tag
});
```
diff --git a/packages/docs/docs/install-whisper-cpp/to-captions.mdx b/packages/docs/docs/install-whisper-cpp/to-captions.mdx
index d71312a4bd..081ff868e8 100644
--- a/packages/docs/docs/install-whisper-cpp/to-captions.mdx
+++ b/packages/docs/docs/install-whisper-cpp/to-captions.mdx
@@ -9,8 +9,6 @@ crumb: '@remotion/install-whisper-cpp'
Converts the output from [`transcribe()`](/docs/install-whisper-cpp/transcribe) into an array of [`Caption`](/docs/captions/caption) objects, so you can use the functions from [`@remotion/captions`](/docs/captions).
```tsx twoslash title="generate-captions.mjs"
-// @module: esnext
-// @target: es2022
import {toCaptions, transcribe} from '@remotion/install-whisper-cpp';
import path from 'path';
diff --git a/packages/docs/docs/install-whisper-cpp/transcribe.mdx b/packages/docs/docs/install-whisper-cpp/transcribe.mdx
index e5300b3109..bef26550a6 100644
--- a/packages/docs/docs/install-whisper-cpp/transcribe.mdx
+++ b/packages/docs/docs/install-whisper-cpp/transcribe.mdx
@@ -14,8 +14,6 @@ This function only works with Whisper.cpp 1.5.5 or later, unless `tokenLevelTime
:::
```tsx twoslash title="transcribe.mjs"
-// @module: esnext
-// @target: es2022
import path from 'path';
import {transcribe} from '@remotion/install-whisper-cpp';
@@ -209,9 +207,7 @@ export type TranscriptionJson<WithTokenLevelTimestamp extends boolean> = {
model: Model;
params: Params;
result: Result;
- transcription: true extends WithTokenLevelTimestamp
- ? TranscriptionItemWithTimestamp[]
- : TranscriptionItem[];
+ transcription: true extends WithTokenLevelTimestamp ? TranscriptionItemWithTimestamp[] : TranscriptionItem[];
};
```
diff --git a/packages/docs/docs/lambda/autodelete.mdx b/packages/docs/docs/lambda/autodelete.mdx
index db71171a9f..275c7a0cbd 100644
--- a/packages/docs/docs/lambda/autodelete.mdx
+++ b/packages/docs/docs/lambda/autodelete.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-autodelete.png
title: Auto-delete renders
id: autodelete
slug: /lambda/autodelete
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
import Tabs from '@theme/Tabs';
@@ -13,7 +13,7 @@ _available from v4.0.32_
To automatically delete renders and associated files after some time, you need to:
-<Step>1</Step> Enable the lifecycle rules on the AWS bucket. <br/>
+<Step>1</Step> Enable the lifecycle rules on the AWS bucket. <br />
<Step>2</Step> Render a video with the <code>deleteAfter</code> option.
## Apply the lifecycle rules
@@ -32,7 +32,7 @@ To put a lifecycle rule on the bucket, you need to have the `s3:PutLifecycleConf
6. Under the `"Sid": "Storage"` section, add `"s3:PutLifecycleConfiguration"` to the `"Action"` array.
7. Save.
-<br/>
+<br />
<Step>2</Step> <strong>Enable the lifecycle rules</strong>
Redeploy the site with the `--enable-folder-expiry` option. This operation will modify the S3 bucket to apply [AWS Lifecycle Rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html).
@@ -55,20 +55,18 @@ npx remotion lambda sites create --site-name=my-site-name --enable-folder-expiry
<TabItem value="bucket">
```ts twoslash title="deploy.mjs" {6}
-// @module: esnext
-// @target: es2017
-import { deploySite, getOrCreateBucket } from "@remotion/lambda";
-import path from "path";
+import {deploySite, getOrCreateBucket} from '@remotion/lambda';
+import path from 'path';
-const { bucketName } = await getOrCreateBucket({
- region: "us-east-1",
+const {bucketName} = await getOrCreateBucket({
+ region: 'us-east-1',
enableFolderExpiry: true,
});
-const { serveUrl } = await deploySite({
- entryPoint: path.resolve(process.cwd(), "src/index.ts"),
+const {serveUrl} = await deploySite({
+ entryPoint: path.resolve(process.cwd(), 'src/index.ts'),
bucketName, // use the bucket with lifecyle rules
- region: "us-east-1",
+ region: 'us-east-1',
});
console.log(serveUrl);
```
@@ -78,14 +76,12 @@ console.log(serveUrl);
</Tabs>
<details>
-<summary>
-Verify that it worked
-</summary>
-<p>In your S3 bucket, under "Management", you should see 4 lifecycle rules.</p>
-<img src="/img/lambda/applied-lc-rules.png" />
+ <summary>Verify that it worked</summary>
+ <p>In your S3 bucket, under "Management", you should see 4 lifecycle rules.</p>
+ <img src="/img/lambda/applied-lc-rules.png" />
</details>
-<br/>
+<br />
## Trigger a render with expiration
@@ -110,19 +106,16 @@ npx remotion lambda render testbed-v6 react-svg --delete-after="1-day"
<TabItem value="rendermedia">
```tsx twoslash title="render.ts" {10}
-// @module: esnext
-// @target: es2017
// ---cut---
-import { renderMediaOnLambda } from "@remotion/lambda/client";
-
-const { bucketName, renderId } = await renderMediaOnLambda({
- region: "us-east-1",
- functionName: "remotion-render-bds9aab",
- composition: "MyVideo",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
- codec: "h264",
- deleteAfter: "1-day",
+import {renderMediaOnLambda} from '@remotion/lambda/client';
+
+const {bucketName, renderId} = await renderMediaOnLambda({
+ region: 'us-east-1',
+ functionName: 'remotion-render-bds9aab',
+ composition: 'MyVideo',
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
+ codec: 'h264',
+ deleteAfter: '1-day',
});
```
@@ -130,21 +123,18 @@ const { bucketName, renderId } = await renderMediaOnLambda({
<TabItem value="renderstill">
```tsx twoslash title="render.ts" {12}
-// @module: esnext
-// @target: es2017
// ---cut---
-import { renderStillOnLambda } from "@remotion/lambda/client";
-
-const { bucketName, renderId } = await renderStillOnLambda({
- region: "us-east-1",
- functionName: "remotion-render-bds9aab",
- composition: "MyVideo",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
+import {renderStillOnLambda} from '@remotion/lambda/client';
+
+const {bucketName, renderId} = await renderStillOnLambda({
+ region: 'us-east-1',
+ functionName: 'remotion-render-bds9aab',
+ composition: 'MyVideo',
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
inputProps: {},
- privacy: "public",
- imageFormat: "png",
- deleteAfter: "1-day",
+ privacy: 'public',
+ imageFormat: 'png',
+ deleteAfter: '1-day',
});
```
@@ -157,15 +147,13 @@ Verify that it worked
</summary>
-<p>
-All files should have an expiration rule and expiration date set when viewing the object properties.
-</p>
+<p>All files should have an expiration rule and expiration date set when viewing the object properties.</p>
<img src="/img/lambda/rendered-file-path.png" />
<img src="/img/lambda/rendered-file-management.png" />
-<br/>
-<br/>
+<br />
+<br />
AWS does not delete the file at the exact time, but the deletion will happen.
diff --git a/packages/docs/docs/lambda/cli/functions.mdx b/packages/docs/docs/lambda/cli/functions.mdx
index a80254337b..17bb5cd203 100644
--- a/packages/docs/docs/lambda/cli/functions.mdx
+++ b/packages/docs/docs/lambda/cli/functions.mdx
@@ -96,10 +96,6 @@ Use a custom role for the function instead of the default (`arn:aws:iam::[aws-ac
Only logs the function name.
-### `--enable-v5-runtime`<AvailableFrom v="4.0.148" />
-
-Enable the [upcoming v5 runtime](/docs/lambda/runtime#runtime-changes-in-remotion-50) with newer Chrome and Node versions early.
-
### `--vpc-subnet-ids`<AvailableFrom v="4.0.160" />
Comma separated list of VPC subnet IDs to use for the Lambda function VPC configuration.
diff --git a/packages/docs/docs/lambda/custom-destination.mdx b/packages/docs/docs/lambda/custom-destination.mdx
index df4465f649..094b17f2e0 100644
--- a/packages/docs/docs/lambda/custom-destination.mdx
+++ b/packages/docs/docs/lambda/custom-destination.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-custom-destination.png
id: custom-destination
sidebar_label: Custom output destination
title: Customizing Lambda output destination
-crumb: "Lambda"
+crumb: 'Lambda'
---
By default a render artifact is saved into the same S3 bucket as where the site is located under the key `renders/${renderId}/out.{extension}` (for example: `renders/hy0k2siao8/out.mp4`)
@@ -23,25 +23,22 @@ The output name must match `/^([0-9a-zA-Z-!_.*'()/]+)$/g`.
To render into a different bucket, specify the `outName` option to [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) or [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda) and pass an object with the `key` and `bucketName` values:
```tsx twoslash {13-16}
-// @module: esnext
-// @target: es2017
-import { renderMediaOnLambda } from "@remotion/lambda";
+import {renderMediaOnLambda} from '@remotion/lambda';
// ---cut---
-const { bucketName, renderId } = await renderMediaOnLambda({
- region: "us-east-1",
- functionName: "remotion-render-bds9aab",
- composition: "MyVideo",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
+const {bucketName, renderId} = await renderMediaOnLambda({
+ region: 'us-east-1',
+ functionName: 'remotion-render-bds9aab',
+ composition: 'MyVideo',
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
inputProps: {},
- codec: "h264",
- imageFormat: "jpeg",
+ codec: 'h264',
+ imageFormat: 'jpeg',
maxRetries: 1,
- privacy: "public",
+ privacy: 'public',
outName: {
- key: "my-output",
- bucketName: "output-bucket",
+ key: 'my-output',
+ bucketName: 'output-bucket',
},
});
```
@@ -68,29 +65,26 @@ You can upload the file to another S3-compatible provider.
You must pass an `outName` [as specified above](#customizing-the-output-bucket) and also provide an `s3OutputProvider` like in the example below.
```tsx twoslash {13-21}
-// @module: esnext
-// @target: es2017
-import { renderMediaOnLambda } from "@remotion/lambda";
+import {renderMediaOnLambda} from '@remotion/lambda';
// ---cut---
-const { bucketName, renderId } = await renderMediaOnLambda({
- region: "us-east-1",
- functionName: "remotion-render-bds9aab",
- composition: "MyVideo",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
+const {bucketName, renderId} = await renderMediaOnLambda({
+ region: 'us-east-1',
+ functionName: 'remotion-render-bds9aab',
+ composition: 'MyVideo',
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
inputProps: {},
- codec: "h264",
- imageFormat: "jpeg",
+ codec: 'h264',
+ imageFormat: 'jpeg',
maxRetries: 1,
- privacy: "no-acl",
+ privacy: 'no-acl',
outName: {
- key: "my-output",
- bucketName: "output-bucket",
+ key: 'my-output',
+ bucketName: 'output-bucket',
s3OutputProvider: {
- endpoint: "https://fra1.digitaloceanspaces.com",
- accessKeyId: "<DIGITAL_OCEAN_ACCESS_KEY_ID>",
- secretAccessKey: "<DIGITAL_OCEAN_SECRET_ACCESS_KEY>",
+ endpoint: 'https://fra1.digitaloceanspaces.com',
+ accessKeyId: '<DIGITAL_OCEAN_ACCESS_KEY_ID>',
+ secretAccessKey: '<DIGITAL_OCEAN_SECRET_ACCESS_KEY>',
},
},
});
diff --git a/packages/docs/docs/lambda/deletefunction.mdx b/packages/docs/docs/lambda/deletefunction.mdx
index 3b452bc40e..a275989c31 100644
--- a/packages/docs/docs/lambda/deletefunction.mdx
+++ b/packages/docs/docs/lambda/deletefunction.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-deletefunction.png
id: deletefunction
title: deleteFunction()
slug: /lambda/deletefunction
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Deletes a deployed Lambda function based on its name.
@@ -13,18 +13,15 @@ To retrieve a list of functions, call [`getFunctions()`](/docs/lambda/getfunctio
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { deleteFunction, getFunctions } from "@remotion/lambda";
+import {deleteFunction, getFunctions} from '@remotion/lambda';
const functions = await getFunctions({
- region: "us-east-1",
+ region: 'us-east-1',
compatibleOnly: false,
});
for (const fn of functions) {
await deleteFunction({
- region: "us-east-1",
+ region: 'us-east-1',
functionName: fn.functionName,
});
}
diff --git a/packages/docs/docs/lambda/deleterender.mdx b/packages/docs/docs/lambda/deleterender.mdx
index 21323c0fd5..f4b912380d 100644
--- a/packages/docs/docs/lambda/deleterender.mdx
+++ b/packages/docs/docs/lambda/deleterender.mdx
@@ -3,20 +3,18 @@ image: /generated/articles-docs-lambda-deleterender.png
id: deleterender
title: deleteRender()
slug: /lambda/deleterender
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Deletes a rendered video, audio or still and its associated metada.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { deleteRender } from "@remotion/lambda";
-
-const { freedBytes } = await deleteRender({
- bucketName: "remotionlambda-r42fs9fk",
- region: "us-east-1",
- renderId: "8hfxlw",
+import {deleteRender} from '@remotion/lambda';
+
+const {freedBytes} = await deleteRender({
+ bucketName: 'remotionlambda-r42fs9fk',
+ region: 'us-east-1',
+ renderId: '8hfxlw',
});
console.log(freedBytes); // 21249541
@@ -48,7 +46,6 @@ If the render was saved to a [different cloud](/docs/lambda/custom-destination#s
Passes `forcePathStyle` to the AWS S3 client. If you don't know what this is, you probably don't need it.
-
## Return value
Returns a promise resolving to an object with the following properties:
diff --git a/packages/docs/docs/lambda/deletesite.mdx b/packages/docs/docs/lambda/deletesite.mdx
index daf7fc61d8..631940e729 100644
--- a/packages/docs/docs/lambda/deletesite.mdx
+++ b/packages/docs/docs/lambda/deletesite.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-deletesite.png
id: deletesite
title: deleteSite()
slug: /lambda/deletesite
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Removes a Remotion project from your S3 bucket.
@@ -15,13 +15,11 @@ Each project is located in the `sites/` subdirectory of your S3 bucket. Calling
Gets all sites and deletes them.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { AwsRegion, deleteSite, getSites } from "@remotion/lambda";
+import {AwsRegion, deleteSite, getSites} from '@remotion/lambda';
-const region: AwsRegion = "eu-central-1";
+const region: AwsRegion = 'eu-central-1';
-const { sites } = await getSites({
+const {sites} = await getSites({
region,
});
diff --git a/packages/docs/docs/lambda/deployfunction.mdx b/packages/docs/docs/lambda/deployfunction.mdx
index a70e96d3d3..6bd0ec218f 100644
--- a/packages/docs/docs/lambda/deployfunction.mdx
+++ b/packages/docs/docs/lambda/deployfunction.mdx
@@ -13,9 +13,6 @@ If a function with the same version, memory size and timeout already existed, it
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
import {deployFunction} from '@remotion/lambda';
const {functionName} = await deployFunction({
diff --git a/packages/docs/docs/lambda/deploysite.mdx b/packages/docs/docs/lambda/deploysite.mdx
index ce23e19f2f..5a4a559a39 100644
--- a/packages/docs/docs/lambda/deploysite.mdx
+++ b/packages/docs/docs/lambda/deploysite.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-deploysite.png
id: deploysite
title: deploySite()
slug: /lambda/deploysite
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Takes a Remotion project, bundles it and uploads it to an S3 bucket. Once uploaded, a Lambda function can render any composition in the Remotion project by specifying the URL.
@@ -15,29 +15,20 @@ Takes a Remotion project, bundles it and uploads it to an S3 bucket. Once upload
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-import { deploySite } from "@remotion/lambda";
-import path from "path";
-
-const { serveUrl } = await deploySite({
- entryPoint: path.resolve(process.cwd(), "src/index.ts"),
- bucketName: "remotionlambda-c7fsl3d",
- region: "us-east-1",
+import {deploySite} from '@remotion/lambda';
+import path from 'path';
+
+const {serveUrl} = await deploySite({
+ entryPoint: path.resolve(process.cwd(), 'src/index.ts'),
+ bucketName: 'remotionlambda-c7fsl3d',
+ region: 'us-east-1',
options: {
onBundleProgress: (progress) => {
// Progress is between 0 and 100
console.log(`Bundle progress: ${progress}%`);
},
- onUploadProgress: ({
- totalFiles,
- filesUploaded,
- totalSize,
- sizeUploaded,
- }) => {
- console.log(
- `Upload progress: Total files ${totalFiles}, Files uploaded ${filesUploaded}, Total size ${totalSize}, Size uploaded ${sizeUploaded}`,
- );
+ onUploadProgress: ({totalFiles, filesUploaded, totalSize, sizeUploaded}) => {
+ console.log(`Upload progress: Total files ${totalFiles}, Files uploaded ${filesUploaded}, Total size ${totalSize}, Size uploaded ${sizeUploaded}`);
},
},
});
diff --git a/packages/docs/docs/lambda/downloadmedia.mdx b/packages/docs/docs/lambda/downloadmedia.mdx
index 66d87fe2a9..49b025afe9 100644
--- a/packages/docs/docs/lambda/downloadmedia.mdx
+++ b/packages/docs/docs/lambda/downloadmedia.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-downloadmedia.png
id: downloadmedia
title: downloadMedia()
slug: /lambda/downloadmedia
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Downloads a rendered video, audio or still to the disk of the machine this API is called from.
@@ -11,21 +11,15 @@ Downloads a rendered video, audio or still to the disk of the machine this API i
If you want to let the user download a result to their machine, use [`renderMediaOnLambda()` -> `downloadBehavior`](/docs/lambda/rendermediaonlambda#downloadbehavior) instead.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { downloadMedia } from "@remotion/lambda";
-
-const { outputPath, sizeInBytes } = await downloadMedia({
- bucketName: "remotionlambda-r42fs9fk",
- region: "us-east-1",
- renderId: "8hfxlw",
- outPath: "out.mp4",
- onProgress: ({ totalSize, downloaded, percent }) => {
- console.log(
- `Download progress: ${totalSize}/${downloaded} bytes (${(
- percent * 100
- ).toFixed(0)}%)`
- );
+import {downloadMedia} from '@remotion/lambda';
+
+const {outputPath, sizeInBytes} = await downloadMedia({
+ bucketName: 'remotionlambda-r42fs9fk',
+ region: 'us-east-1',
+ renderId: '8hfxlw',
+ outPath: 'out.mp4',
+ onProgress: ({totalSize, downloaded, percent}) => {
+ console.log(`Download progress: ${totalSize}/${downloaded} bytes (${(percent * 100).toFixed(0)}%)`);
},
});
diff --git a/packages/docs/docs/lambda/feb-2022-outage.mdx b/packages/docs/docs/lambda/feb-2022-outage.mdx
index a4a1051b91..7050844081 100644
--- a/packages/docs/docs/lambda/feb-2022-outage.mdx
+++ b/packages/docs/docs/lambda/feb-2022-outage.mdx
@@ -28,17 +28,14 @@ Via Node.JS:
## Example
```ts
-// @module: esnext
-// @target: es2017
+import {deployFunction} from '@remotion/lambda';
-import { deployFunction } from "@remotion/lambda";
-
-const { functionName } = await deployFunction({
- region: "us-east-1",
+const {functionName} = await deployFunction({
+ region: 'us-east-1',
timeoutInSeconds: 120,
memorySizeInMb: 1024,
createCloudWatchLogGroup: true,
- architecture: "x86_64",
+ architecture: 'x86_64',
});
console.log(functionName);
```
diff --git a/packages/docs/docs/lambda/getcompositionsonlambda.mdx b/packages/docs/docs/lambda/getcompositionsonlambda.mdx
index 1e7144b500..6339abb9d5 100644
--- a/packages/docs/docs/lambda/getcompositionsonlambda.mdx
+++ b/packages/docs/docs/lambda/getcompositionsonlambda.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-getcompositionsonlambda.png
id: getcompositionsonlambda
title: getCompositionsOnLambda()
slug: /lambda/getcompositionsonlambda
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
_available from v3.3.2_
@@ -17,15 +17,12 @@ You should use `getCompositionsOnLambda()` if you cannot use [`getCompositions()
## Example
```tsx twoslash
-// @module: esnext
-// @target: es2017
-import { getCompositionsOnLambda } from "@remotion/lambda/client";
+import {getCompositionsOnLambda} from '@remotion/lambda/client';
const compositions = await getCompositionsOnLambda({
- region: "us-east-1",
- functionName: "remotion-render-bds9aab",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
+ region: 'us-east-1',
+ functionName: 'remotion-render-bds9aab',
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
inputProps: {},
});
@@ -88,7 +85,7 @@ Results in invalid SSL certificates, such as self-signed ones, being ignored.
#### `gl`
-<Options id="gl" />
+<Options id="gl" />
#### `userAgent`<AvailableFrom v="3.3.83"/>
@@ -102,7 +99,7 @@ Specify a specific bucket name to be used. [This is not recommended](/docs/lambd
### `logLevel?`
-<Options id="log"/>
+<Options id="log" />
Logs can be read through the CloudWatch URL that this function returns.
@@ -123,17 +120,17 @@ Returns a promise that resolves to an array of available compositions. Example v
```ts twoslash
[
{
- id: "HelloWorld",
+ id: 'HelloWorld',
width: 1920,
height: 1080,
fps: 30,
durationInFrames: 120,
defaultProps: {
- title: "Hello World",
+ title: 'Hello World',
},
},
{
- id: "Title",
+ id: 'Title',
width: 1080,
height: 1080,
fps: 30,
diff --git a/packages/docs/docs/lambda/getfunctioninfo.mdx b/packages/docs/docs/lambda/getfunctioninfo.mdx
index fc951debb1..1490ca7e6a 100644
--- a/packages/docs/docs/lambda/getfunctioninfo.mdx
+++ b/packages/docs/docs/lambda/getfunctioninfo.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-getfunctioninfo.png
id: getfunctioninfo
title: getFunctionInfo()
slug: /lambda/getfunctioninfo
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Gets information about a function given its name and region.
@@ -15,14 +15,11 @@ To deploy a function, use [`deployFunction()`](/docs/lambda/deployfunction).
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { getFunctionInfo } from "@remotion/lambda";
+import {getFunctionInfo} from '@remotion/lambda';
const info = await getFunctionInfo({
- functionName: "remotion-render-d7nd2a9f",
- region: "eu-central-1",
+ functionName: 'remotion-render-d7nd2a9f',
+ region: 'eu-central-1',
});
console.log(info.functionName); // remotion-render-d7nd2a9f
console.log(info.memorySizeInMb); // 1500
@@ -45,7 +42,7 @@ The name of the function.
### `logLevel?`<AvailableFrom v="4.0.115"/>
-<Options id="log"/>
+<Options id="log" />
## Return value
diff --git a/packages/docs/docs/lambda/getfunctions.mdx b/packages/docs/docs/lambda/getfunctions.mdx
index 22fa49124d..ad565e6fc9 100644
--- a/packages/docs/docs/lambda/getfunctions.mdx
+++ b/packages/docs/docs/lambda/getfunctions.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-getfunctions.png
title: getFunctions()
id: getfunctions
slug: /lambda/getfunctions
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Retrieves a list of functions that Remotion deployed to AWS Lambda in a certain region.
@@ -21,13 +21,10 @@ If you are sure that a function exists, you can also guess the name of it using
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { getFunctions } from "@remotion/lambda/client";
+import {getFunctions} from '@remotion/lambda/client';
const info = await getFunctions({
- region: "eu-central-1",
+ region: 'eu-central-1',
compatibleOnly: true,
});
@@ -54,7 +51,7 @@ The [AWS region](/docs/lambda/region-selection) that you would like to query.
### `logLevel?`<AvailableFrom v="4.0.115"/>
-<Options id="log"/>
+<Options id="log" />
### `compatibleOnly`
diff --git a/packages/docs/docs/lambda/getorcreatebucket.mdx b/packages/docs/docs/lambda/getorcreatebucket.mdx
index 3c84df0129..f6bc83e134 100644
--- a/packages/docs/docs/lambda/getorcreatebucket.mdx
+++ b/packages/docs/docs/lambda/getorcreatebucket.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-getorcreatebucket.png
id: getorcreatebucket
title: getOrCreateBucket()
slug: /lambda/getorcreatebucket
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Creates a bucket for Remotion Lambda in your S3 account. If one already exists, it will get returned instead.
@@ -11,11 +11,9 @@ Creates a bucket for Remotion Lambda in your S3 account. If one already exists,
**Only 1 bucket per region** is necessary for Remotion Lambda to function.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { getOrCreateBucket } from "@remotion/lambda";
+import {getOrCreateBucket} from '@remotion/lambda';
-const { bucketName } = await getOrCreateBucket({ region: "us-east-1" });
+const {bucketName} = await getOrCreateBucket({region: 'us-east-1'});
console.log(bucketName); // "remotionlambda-32df3p"
```
@@ -30,7 +28,7 @@ The [AWS region](/docs/lambda/region-selection) which you want to create a bucke
### `enableFolderExpiry`<AvailableFrom v="4.0.32" />
-<Options id="enable-folder-expiry"/>
+<Options id="enable-folder-expiry" />
### ~~`onBucketEnsured?`~~
diff --git a/packages/docs/docs/lambda/getregions.mdx b/packages/docs/docs/lambda/getregions.mdx
index 112f3f06a6..b9a0291fb2 100644
--- a/packages/docs/docs/lambda/getregions.mdx
+++ b/packages/docs/docs/lambda/getregions.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-lambda-getregions.png
id: getregions
title: getRegions()
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Gets an array of all supported AWS regions of this release of Remotion Lambda.
@@ -10,9 +10,7 @@ Gets an array of all supported AWS regions of this release of Remotion Lambda.
## Example
```tsx twoslash
-// @module: esnext
-// @target: es2017
-import { getRegions } from "@remotion/lambda";
+import {getRegions} from '@remotion/lambda';
// ---cut---
diff --git a/packages/docs/docs/lambda/getrenderprogress.mdx b/packages/docs/docs/lambda/getrenderprogress.mdx
index a22b407ef8..b7cda239b8 100644
--- a/packages/docs/docs/lambda/getrenderprogress.mdx
+++ b/packages/docs/docs/lambda/getrenderprogress.mdx
@@ -14,9 +14,6 @@ For renders initiated via [`renderStillOnLambda()`](/docs/lambda/renderstillonla
## Example
```tsx twoslash
-// @module: esnext
-// @target: es2017
-
import {getRenderProgress} from '@remotion/lambda/client';
const progress = await getRenderProgress({
diff --git a/packages/docs/docs/lambda/getsites.mdx b/packages/docs/docs/lambda/getsites.mdx
index a287a1b198..73cc429ce0 100644
--- a/packages/docs/docs/lambda/getsites.mdx
+++ b/packages/docs/docs/lambda/getsites.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-getsites.png
id: getsites
title: getSites()
slug: /lambda/getsites
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Gets an array of Remotion projects in your S3 account.
@@ -15,12 +15,10 @@ The projects are located in the `sites/` subdirectory of your S3 bucket. Remembe
Gets all sites and logs information about them.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { getSites } from "@remotion/lambda/client";
+import {getSites} from '@remotion/lambda/client';
-const { sites, buckets } = await getSites({
- region: "eu-central-1",
+const {sites, buckets} = await getSites({
+ region: 'eu-central-1',
});
for (const site of sites) {
diff --git a/packages/docs/docs/lambda/insights.mdx b/packages/docs/docs/lambda/insights.mdx
index dc078a4db2..a87eec22b5 100644
--- a/packages/docs/docs/lambda/insights.mdx
+++ b/packages/docs/docs/lambda/insights.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-lambda-insights.png
sidebar_label: Insights
title: Enable Lambda Insights
-crumb: "Lambda"
+crumb: 'Lambda'
---
# Enable Lambda Insights<AvailableFrom v="4.0.61"/>
@@ -11,7 +11,7 @@ You may enable [AWS Lambda Insights](https://docs.aws.amazon.com/AmazonCloudWatc
## Prerequisites
-<Step>1</Step> Ensure you are on at least Remotion v4.0.61. <br/>
+<Step>1</Step> Ensure you are on at least Remotion v4.0.61. <br />
<Step>2</Step> If you started using Remotion before v4.0.61, update both your <a href="/docs/lambda/permissions#user-permissions">AWS user permission</a> and <a href="/docs/lambda/permissions#role-permissions">AWS role permission</a>, since now more permissions are needed.
## Enable Lambda Insights
@@ -27,15 +27,13 @@ If the function already existed before, you need to delete it beforehand.
**Via Node.js APIs:**
```tsx twoslash title="deploy.ts" {8, 11-13}
-// @module: ESNext
-// @target: ESNext
-import assert from "assert";
+import assert from 'assert';
// ---cut---
-import { deployFunction } from "@remotion/lambda";
+import {deployFunction} from '@remotion/lambda';
-const { alreadyExisted } = await deployFunction({
+const {alreadyExisted} = await deployFunction({
createCloudWatchLogGroup: true,
- region: "us-east-1",
+ region: 'us-east-1',
timeoutInSeconds: 120,
memorySizeInMb: 3009,
enableLambdaInsights: true,
diff --git a/packages/docs/docs/lambda/presignurl.mdx b/packages/docs/docs/lambda/presignurl.mdx
index aac3fe6b0a..34759f0a3b 100644
--- a/packages/docs/docs/lambda/presignurl.mdx
+++ b/packages/docs/docs/lambda/presignurl.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-lambda-presignurl.png
id: presignurl
title: presignUrl()
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Takes a private S3 object and turns it into a public URL by signing with your AWS credentials.
@@ -10,14 +10,12 @@ Takes a private S3 object and turns it into a public URL by signing with your AW
## Example
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { presignUrl } from "@remotion/lambda/client";
+import {presignUrl} from '@remotion/lambda/client';
const url = await presignUrl({
- region: "us-east-1",
- bucketName: "remotionlambda-c7fsl3d",
- objectKey: "assets/sample.png",
+ region: 'us-east-1',
+ bucketName: 'remotionlambda-c7fsl3d',
+ objectKey: 'assets/sample.png',
expiresInSeconds: 900,
checkIfObjectExists: true,
});
@@ -25,9 +23,9 @@ const url = await presignUrl({
console.log(url); // `string` - or `null` if object doesn't exist
const url2 = await presignUrl({
- region: "us-east-1",
- bucketName: "remotionlambda-c7fsl3d",
- objectKey: "assets/sample.png",
+ region: 'us-east-1',
+ bucketName: 'remotionlambda-c7fsl3d',
+ objectKey: 'assets/sample.png',
expiresInSeconds: 900,
checkIfObjectExists: false,
});
diff --git a/packages/docs/docs/lambda/rendermediaonlambda.mdx b/packages/docs/docs/lambda/rendermediaonlambda.mdx
index 4488bebe10..01c7ec4721 100644
--- a/packages/docs/docs/lambda/rendermediaonlambda.mdx
+++ b/packages/docs/docs/lambda/rendermediaonlambda.mdx
@@ -15,8 +15,6 @@ A [site](/docs/lambda/deploysite) or a [Serve URL](/docs/terminology/serve-url)
## Example
```tsx twoslash
-// @module: esnext
-// @target: es2017
// ---cut---
import {renderMediaOnLambda} from '@remotion/lambda/client';
@@ -24,8 +22,7 @@ const {bucketName, renderId} = await renderMediaOnLambda({
region: 'us-east-1',
functionName: 'remotion-render-bds9aab',
composition: 'MyVideo',
- serveUrl:
- 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
codec: 'h264',
});
```
diff --git a/packages/docs/docs/lambda/renderstillonlambda.mdx b/packages/docs/docs/lambda/renderstillonlambda.mdx
index 67fd334666..5ab0d1a518 100644
--- a/packages/docs/docs/lambda/renderstillonlambda.mdx
+++ b/packages/docs/docs/lambda/renderstillonlambda.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-renderstillonlambda.png
id: renderstillonlambda
title: renderStillOnLambda()
slug: /lambda/renderstillonlambda
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Renders a still image inside a lambda function and writes it to the specified output location.
@@ -15,20 +15,17 @@ If you want to render a still locally instead, use [`renderStill()`](/docs/rende
## Example
```tsx twoslash
-// @module: esnext
-// @target: es2017
-import { renderStillOnLambda } from "@remotion/lambda/client";
-
-const { estimatedPrice, url, sizeInBytes } = await renderStillOnLambda({
- region: "us-east-1",
- functionName: "remotion-render-bds9aab",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
- composition: "MyVideo",
+import {renderStillOnLambda} from '@remotion/lambda/client';
+
+const {estimatedPrice, url, sizeInBytes} = await renderStillOnLambda({
+ region: 'us-east-1',
+ functionName: 'remotion-render-bds9aab',
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
+ composition: 'MyVideo',
inputProps: {},
- imageFormat: "png",
+ imageFormat: 'png',
maxRetries: 1,
- privacy: "public",
+ privacy: 'public',
envVariables: {},
frame: 10,
});
@@ -101,30 +98,23 @@ It receives an object with the following properties:
Example usage:
```tsx twoslash
-// @module: esnext
-// @target: es2022
-
-import {
- renderStillOnLambda,
- RenderStillOnLambdaInput,
-} from "@remotion/lambda/client";
+import {renderStillOnLambda, RenderStillOnLambdaInput} from '@remotion/lambda/client';
const otherParameters: RenderStillOnLambdaInput = {
- region: "us-east-1",
- functionName: "remotion-render-bds9aab",
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
- composition: "MyVideo",
+ region: 'us-east-1',
+ functionName: 'remotion-render-bds9aab',
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
+ composition: 'MyVideo',
inputProps: {},
- imageFormat: "png",
+ imageFormat: 'png',
maxRetries: 1,
- privacy: "public",
+ privacy: 'public',
envVariables: {},
frame: 10,
};
await renderStillOnLambda({
...otherParameters,
- onInit: ({ cloudWatchLogs, renderId, lambdaInsightsUrl }) => {
+ onInit: ({cloudWatchLogs, renderId, lambdaInsightsUrl}) => {
console.log(console.log(`Render invoked with ID = ${renderId}`));
console.log(`CloudWatch logs (if enabled): ${cloudWatchLogs}`);
console.log(`Lambda Insights (if enabled): ${lambdaInsightsUrl}`);
@@ -262,7 +252,6 @@ _optional - default `false`, deprecated in v4.0_
Deprecated in favor of [`logLevel`](#loglevel).
-
## Return value
Returns a promise resolving to an object with the following properties:
diff --git a/packages/docs/docs/lambda/setup.mdx b/packages/docs/docs/lambda/setup.mdx
index a195ff398f..da2651eb6b 100644
--- a/packages/docs/docs/lambda/setup.mdx
+++ b/packages/docs/docs/lambda/setup.mdx
@@ -9,12 +9,7 @@ crumb: 'Lambda'
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
-<YouTube
- minutes={18}
- href="https://www.youtube.com/watch?v=kFVd3KnfwYY"
- thumb="https://i.ytimg.com/vi/kFVd3KnfwYY/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLCJOz2mu_A24NvjFQGm6GjUVssnUQ"
- title="How to set up Remotion Lambda"
-/>
+<YouTube minutes={18} href="https://www.youtube.com/watch?v=kFVd3KnfwYY" thumb="https://i.ytimg.com/vi/kFVd3KnfwYY/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLCJOz2mu_A24NvjFQGm6GjUVssnUQ" title="How to set up Remotion Lambda" />
## 1. Install `@remotion/lambda`
@@ -111,8 +106,6 @@ npx remotion lambda functions deploy
You can deploy a function that can render videos into your AWS account using [`deployFunction()`](/docs/lambda/deployfunction).
```ts twoslash
-// @module: ESNext
-// @target: ESNext
import {deployFunction} from '@remotion/lambda';
// ---cut---
@@ -158,8 +151,6 @@ When you update your Remotion code in the future, redeploy your site. Pass the s
First, you need to create an S3 bucket in your preferred region. If one already exists, it will be used instead:
```ts twoslash
-// @module: ESNext
-// @target: ESNext
import path from 'path';
import {deploySite, getOrCreateBucket} from '@remotion/lambda';
@@ -171,8 +162,6 @@ const {bucketName} = await getOrCreateBucket({
Next, upload your Remotion project to an S3 bucket. Specify the entry point of your Remotion project, this is the file where [`registerRoot()`](/docs/register-root) is called.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
import path from 'path';
import {deploySite, getOrCreateBucket} from '@remotion/lambda';
@@ -228,13 +217,7 @@ Progress will be printed until the video finished rendering. Congrats! You rende
You already have the function name from a previous step. But since you only need to deploy a function once, it's useful to retrieve the name of your deployed function programmatically before rendering a video in case your Node.JS program restarts. We can call [`getFunctions()`](/docs/lambda/getfunctions) with the `compatibleOnly` flag to get only functions with a matching version.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import {
- getFunctions,
- renderMediaOnLambda,
- getRenderProgress,
-} from '@remotion/lambda';
+import {getFunctions, renderMediaOnLambda, getRenderProgress} from '@remotion/lambda';
const functions = await getFunctions({
region: 'us-east-1',
@@ -247,13 +230,7 @@ const functionName = functions[0].functionName;
We can now trigger a render using the [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) function.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import {
- getFunctions,
- renderMediaOnLambda,
- getRenderProgress,
-} from '@remotion/lambda';
+import {getFunctions, renderMediaOnLambda, getRenderProgress} from '@remotion/lambda';
const url = 'string';
const functions = await getFunctions({
@@ -281,13 +258,7 @@ const {renderId, bucketName} = await renderMediaOnLambda({
The render will now run and after a while the video will be available in your S3 bucket. You can at any time get the status of the video render by calling [`getRenderProgress()`](/docs/lambda/getrenderprogress).
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import {
- getFunctions,
- renderMediaOnLambda,
- getRenderProgress,
-} from '@remotion/lambda/client';
+import {getFunctions, renderMediaOnLambda, getRenderProgress} from '@remotion/lambda/client';
const url = 'string';
const functions = await getFunctions({
diff --git a/packages/docs/docs/lambda/simulatepermissions.mdx b/packages/docs/docs/lambda/simulatepermissions.mdx
index fe0d116953..765f95ee14 100644
--- a/packages/docs/docs/lambda/simulatepermissions.mdx
+++ b/packages/docs/docs/lambda/simulatepermissions.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-lambda-simulatepermissions.png
id: simulatepermissions
title: simulatePermissions()
slug: /lambda/simulatepermissions
-crumb: "Lambda API"
+crumb: 'Lambda API'
---
Runs tests through the AWS Simulator ensuring that all the necessary permissions are set for the authenticated user.
@@ -17,13 +17,10 @@ This function does only validate the validity of the **user policy**, not the **
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
+import {simulatePermissions} from '@remotion/lambda';
-import { simulatePermissions } from "@remotion/lambda";
-
-const { results } = await simulatePermissions({
- region: "us-east-1",
+const {results} = await simulatePermissions({
+ region: 'us-east-1',
});
for (const result of results) {
@@ -47,13 +44,10 @@ _optional_
A callback function that gets called every time a new simulation has been executed. This allows you to react to new simulation results coming in much faster than waiting for the return value of the function. Example:
```ts twoslash
-// @module: esnext
-// @target: es2017
-
-import { simulatePermissions } from "@remotion/lambda";
+import {simulatePermissions} from '@remotion/lambda';
-const { results } = await simulatePermissions({
- region: "us-east-1",
+const {results} = await simulatePermissions({
+ region: 'us-east-1',
onSimulation: (result) => {
console.log(result.decision); // "allowed"
console.log(result.name); // "iam:SimulatePrincipalPolicy"
diff --git a/packages/docs/docs/lambda/speculateFunctionName.mdx b/packages/docs/docs/lambda/speculateFunctionName.mdx
index 262d8b6ccc..dda321d31b 100644
--- a/packages/docs/docs/lambda/speculateFunctionName.mdx
+++ b/packages/docs/docs/lambda/speculateFunctionName.mdx
@@ -32,9 +32,6 @@ remotion-render-3-3-63-mem2048mb-disk2048mb-240sec
## Example
```ts twoslash
-// @module: esnext
-// @target: es2017
-
import {speculateFunctionName} from '@remotion/lambda/client';
const speculatedFunctionName = speculateFunctionName({
diff --git a/packages/docs/docs/lambda/without-iam/index.mdx b/packages/docs/docs/lambda/without-iam/index.mdx
index 3593cbaa3b..1cabd77604 100644
--- a/packages/docs/docs/lambda/without-iam/index.mdx
+++ b/packages/docs/docs/lambda/without-iam/index.mdx
@@ -34,9 +34,7 @@ The steps below provide authorization for the Lambda function to execute `render
- Click on JSON
- Copy the JSON policy template below:
<details>
- <summary>
- Show full role permissions JSON file for latest Remotion Lambda version
- </summary>
+ <summary>Show full role permissions JSON file for latest Remotion Lambda version</summary>
<UserPolicy />
</details>
- Click next. On the tags page, you don't need to fill in anything. Click next again.
@@ -75,18 +73,13 @@ Optionally, if you want to move the video to another S3 bucket after it is rende
Use the `outName` property to select a different bucket. See: [Custom output destination](/docs/lambda/custom-destination)
```ts twoslash title="my-function.ts"
-// @module: esnext
-// @target: es2017
-// ---cut---
-
import {renderMediaOnLambda} from '@remotion/lambda/client';
const {bucketName, renderId} = await renderMediaOnLambda({
region: 'us-east-1',
functionName: 'remotion-render-bds9aab',
composition: 'MyVideo',
- serveUrl:
- 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
codec: 'h264',
outName: {
key: 'my-output',
diff --git a/packages/docs/docs/licensing/get-usage.mdx b/packages/docs/docs/licensing/get-usage.mdx
index 7ecdecf0a7..eab6d9d892 100644
--- a/packages/docs/docs/licensing/get-usage.mdx
+++ b/packages/docs/docs/licensing/get-usage.mdx
@@ -12,8 +12,6 @@ This requires your secret key that you can obtain from the remotion.pro dashboar
You should only call this API from the backend to avoid exposing your secret key to the client.
```tsx twoslash title="Get the current usage of your license"
-// @module: es2022
-// @target: es2017
import {getUsage} from '@remotion/licensing';
const usage = await getUsage({
diff --git a/packages/docs/docs/licensing/register-usage-point.mdx b/packages/docs/docs/licensing/register-usage-point.mdx
index 02e251c1b1..fb1ae52ec5 100644
--- a/packages/docs/docs/licensing/register-usage-point.mdx
+++ b/packages/docs/docs/licensing/register-usage-point.mdx
@@ -15,9 +15,6 @@ You do not need to call this function if you are using `@remotion/webcodecs`.
:::
```tsx twoslash title="Register a usage point"
-// @module: es2022
-// @target: es2017
-
import {registerUsageEvent} from '@remotion/licensing';
await registerUsageEvent({
diff --git a/packages/docs/docs/media-parser/download-and-parse-media.mdx b/packages/docs/docs/media-parser/download-and-parse-media.mdx
index c57ccc6ab1..f1e7e4caca 100644
--- a/packages/docs/docs/media-parser/download-and-parse-media.mdx
+++ b/packages/docs/docs/media-parser/download-and-parse-media.mdx
@@ -44,10 +44,10 @@ Throw an error to stop the download.
```tsx title="Stop the download if the video is too long"
import {downloadAndParseMedia} from '@remotion/media-parser';
-const {duration} = await downloadAndParseMedia({
+const {durationInSeconds} = await downloadAndParseMedia({
src: 'https://s3.amazonaws.com/bucket/uploaded-asset.mp4',
writer: nodeWriter('output.mp4'),
- onDuration: (duration) => {
+ onDurationInSeconds: (duration) => {
if (duration && duration > 600) {
throw new Error('Video is too long');
}
@@ -60,7 +60,7 @@ If an error occurs (including one you've thrown yourself), you can decide what t
```tsx title="Continue download despite error"
import {downloadAndParseMedia} from '@remotion/media-parser';
-const {duration} = await downloadAndParseMedia({
+await downloadAndParseMedia({
src: 'https://s3.amazonaws.com/bucket/uploaded-asset.mp4',
writer: nodeWriter('output.mp4'),
onError: (error) => {
diff --git a/packages/docs/docs/media-parser/fast-and-slow.mdx b/packages/docs/docs/media-parser/fast-and-slow.mdx
index 1afc912400..528e6e6b1c 100644
--- a/packages/docs/docs/media-parser/fast-and-slow.mdx
+++ b/packages/docs/docs/media-parser/fast-and-slow.mdx
@@ -50,7 +50,7 @@ The following [`fields`](/docs/media-parser#fields) require only the metadata se
- [`rotation`](/docs/media-parser/parse-media#rotation)
- [`location`](/docs/media-parser/parse-media#location)
- [`keyframes`](/docs/media-parser/parse-media#keyframes)
-- [`sampleRate`](/docs/media-parser/parse-media#sampleRate)
+- [`sampleRate`](/docs/media-parser/parse-media#samplerate)
- [`numberOfAudioChannels`](/docs/media-parser/parse-media#numberofaudiochannels)
Also, if an [`onVideoTrack`](/docs/media-parser/parse-media#onvideotrack) or [`onAudioTrack`](/docs/media-parser/parse-media#onvideotrack) handler is passed, only the parsing of the metadata section is required if `null` is returned from the handler function.
@@ -72,8 +72,6 @@ Otherwise, `@remotion/media-parser` has no choice but to read the full file if t
## Example
```tsx twoslash title="Reading header only"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
// ---cut---
diff --git a/packages/docs/docs/media-parser/fetch-reader.mdx b/packages/docs/docs/media-parser/fetch-reader.mdx
index 52c71042b2..73c2edadac 100644
--- a/packages/docs/docs/media-parser/fetch-reader.mdx
+++ b/packages/docs/docs/media-parser/fetch-reader.mdx
@@ -18,8 +18,6 @@ This is the default reader for `@remotion/media-parser`, so you don't need to ex
## Example
```tsx twoslash title="Reading a local file"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
import {fetchReader} from '@remotion/media-parser/fetch';
diff --git a/packages/docs/docs/media-parser/foreign-file-types.mdx b/packages/docs/docs/media-parser/foreign-file-types.mdx
index 65fddbfe52..911ac979e1 100644
--- a/packages/docs/docs/media-parser/foreign-file-types.mdx
+++ b/packages/docs/docs/media-parser/foreign-file-types.mdx
@@ -12,8 +12,6 @@ Sometimes this error can contain useful information about the file type nonethel
This is useful if you allow users to upload an arbitrary file and want to get information about it with just one pass.
```tsx twoslash title="Get information about a video, or get the file type if it's not a video"
-// @module: es2022
-// @target: es2017
import {parseMedia, IsAnImageError, IsAGifError, IsAPdfError, IsAnUnsupportedFileTypeError, IsAnUnsupportedAudioTypeError} from '@remotion/media-parser';
try {
diff --git a/packages/docs/docs/media-parser/metadata.mdx b/packages/docs/docs/media-parser/metadata.mdx
index 3193d6e4cc..5475fa48c4 100644
--- a/packages/docs/docs/media-parser/metadata.mdx
+++ b/packages/docs/docs/media-parser/metadata.mdx
@@ -15,8 +15,6 @@ Specify the [`fields`](/docs/media-parser/parse-media#fields) you would like to
This works in the browser as well as in Node.js and Bun.
```tsx twoslash title="Parsing a hosted video"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
const result = await parseMedia({
@@ -37,8 +35,6 @@ Use [`nodeReader`](/docs/media-parser/node-reader) to read a file from a filesys
This can be used in Node.js and Bun.
```tsx twoslash title="Parsing a video from a file path"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
import {nodeReader} from '@remotion/media-parser/node';
@@ -61,8 +57,6 @@ If you take user uploads in the browser, they will be in the form of a [`File`](
Use [`webFileReader`](/docs/media-parser/web-file-reader) to read a video from a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
```tsx twoslash title="Parsing a video from a file path"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
import {webFileReader} from '@remotion/media-parser/web-file';
@@ -91,8 +85,6 @@ See [Fields](/docs/media-parser/parse-media#fields) for a complete list.
## Getting metadata as soon as possible
```tsx twoslash title="Parsing a video from a File"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
const result = await parseMedia({
diff --git a/packages/docs/docs/media-parser/node-reader.mdx b/packages/docs/docs/media-parser/node-reader.mdx
index c245a59de7..4b3630aa4f 100644
--- a/packages/docs/docs/media-parser/node-reader.mdx
+++ b/packages/docs/docs/media-parser/node-reader.mdx
@@ -17,8 +17,6 @@ It also works with Bun.
## Example
```tsx twoslash title="Reading a local file"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
import {nodeReader} from '@remotion/media-parser/node';
diff --git a/packages/docs/docs/media-parser/parse-media.mdx b/packages/docs/docs/media-parser/parse-media.mdx
index 390c5429eb..cc33cc1dd2 100644
--- a/packages/docs/docs/media-parser/parse-media.mdx
+++ b/packages/docs/docs/media-parser/parse-media.mdx
@@ -17,8 +17,6 @@ The API for getting video metadata is stable and may be used in production.
## Examples
```tsx twoslash title="Parsing a hosted video"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
const result = await parseMedia({
@@ -34,8 +32,6 @@ console.log(result.dimensions); // {width: 1920, height: 1080}
```
```tsx twoslash title="Parsing a local file"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
import {nodeReader} from '@remotion/media-parser/node';
@@ -85,8 +81,6 @@ You must return either `null` or a callback that is called for each sample that
The `sample` has the type `VideoSample` and while not all fields are stable, it has all the mandatory fields for the [`EncodedVideoChunk`](https://developer.mozilla.org/en-US/docs/Web/API/EncodedVideoChunk) constructor.
```tsx twoslash title="Reading video frames"
-// @module: es2022
-// @target: es2017
import {parseMedia, OnVideoTrack} from '@remotion/media-parser';
const onVideoTrack: OnVideoTrack = ({track}) => {
@@ -107,8 +101,6 @@ You must return either `null` or a callback that is called for each sample that
The `sample` has the type `AudioSample` and while not all fields are stable, it has all the mandatory fields for the [`EncodedAudioChunk`](https://developer.mozilla.org/en-US/docs/Web/API/EncodedAudioChunk) constructor.
```tsx twoslash title="Reading audio frames"
-// @module: es2022
-// @target: es2017
// @noErrors
import {parseMedia, OnAudioTrack} from '@remotion/media-parser';
@@ -354,9 +346,6 @@ You do not have to add the field to the [`fields`](#fields) object if you use th
However, just like with [`fields`](#fields), adding a callback for a [slow field](/docs/media-parser/fast-and-slow) may require reading more of the file.
```tsx twoslash title="Using a callback"
-// @module: es2022
-// @target: es2017
-
import {parseMedia} from '@remotion/media-parser';
const result = await parseMedia({
diff --git a/packages/docs/docs/media-parser/tags.mdx b/packages/docs/docs/media-parser/tags.mdx
index be0ac5c9a7..e64ef68e49 100644
--- a/packages/docs/docs/media-parser/tags.mdx
+++ b/packages/docs/docs/media-parser/tags.mdx
@@ -10,8 +10,6 @@ crumb: '@remotion/media-parser'
[`@remotion/media-parser`](/docs/media-parser) allows you to extract metadata that is embedded in video files, such as ID3 tags or EXIF data.
```tsx twoslash title="Extracting metadata"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
const {metadata} = await parseMedia({
diff --git a/packages/docs/docs/media-parser/web-file-reader.mdx b/packages/docs/docs/media-parser/web-file-reader.mdx
index ddee1dd6b8..e87ce69966 100644
--- a/packages/docs/docs/media-parser/web-file-reader.mdx
+++ b/packages/docs/docs/media-parser/web-file-reader.mdx
@@ -18,8 +18,6 @@ Useful if you want to parse a video from a `<input type="file">` element.
## Example
```tsx twoslash title="Reading a local file"
-// @module: es2022
-// @target: es2017
import React, {useCallback} from 'react';
import {parseMedia} from '@remotion/media-parser';
import {webFileReader} from '@remotion/media-parser/web-file';
diff --git a/packages/docs/docs/media-parser/webcodecs.mdx b/packages/docs/docs/media-parser/webcodecs.mdx
index 3e9fa69d0c..3d99435ce2 100644
--- a/packages/docs/docs/media-parser/webcodecs.mdx
+++ b/packages/docs/docs/media-parser/webcodecs.mdx
@@ -27,8 +27,6 @@ It is a higher-level API that is easier to use than `@remotion/media-parser`.
`@remotion/media-parser` is a lower-level API that allows you to interface with WebCodecs directly.
```tsx twoslash title="Reading video frames"
-// @module: es2022
-// @target: es2017
import {parseMedia, OnAudioTrack, OnVideoTrack} from '@remotion/media-parser';
const onVideoTrack: OnVideoTrack = ({track}) => {
diff --git a/packages/docs/docs/openai-whisper/openai-whisper-api-to-captions.mdx b/packages/docs/docs/openai-whisper/openai-whisper-api-to-captions.mdx
index 1877fb9ed0..ba4f768435 100644
--- a/packages/docs/docs/openai-whisper/openai-whisper-api-to-captions.mdx
+++ b/packages/docs/docs/openai-whisper/openai-whisper-api-to-captions.mdx
@@ -13,9 +13,6 @@ This package performs processing on the captions in order to retain the punctuat
This function can be used in any JavaScript environment, but you should not use the OpenAI API in the browser because your API key will be exposed to the browser.
```tsx twoslash title="Example usage"
-// @module: ESNext
-// @target: ESNext
-
import fs from 'fs';
import {OpenAI} from 'openai';
import {openAiWhisperApiToCaptions} from '@remotion/openai-whisper';
diff --git a/packages/docs/docs/passing-props.mdx b/packages/docs/docs/passing-props.mdx
index 3a4a76897d..8a152595f7 100644
--- a/packages/docs/docs/passing-props.mdx
+++ b/packages/docs/docs/passing-props.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-passing-props.png
id: passing-props
title: Passing props to a composition
sidebar_label: Passing props
-crumb: "How To"
+crumb: 'How To'
---
```twoslash include example
@@ -38,7 +38,7 @@ When registering a component that takes props as a composition, you must define
// organize-imports-ignore
// @filename: MyComponent.tsx
-import React from "react";
+import React from 'react';
export const MyComponent: React.FC<{
propOne: string;
propTwo: number;
@@ -47,9 +47,9 @@ export const MyComponent: React.FC<{
// @filename: Root.tsx
// ---cut---
-import React from "react";
-import { Composition } from "remotion";
-import { MyComponent } from "./MyComponent";
+import React from 'react';
+import {Composition} from 'remotion';
+import {MyComponent} from './MyComponent';
export const Root: React.FC = () => {
return (
@@ -62,7 +62,7 @@ export const Root: React.FC = () => {
durationInFrames={30}
component={MyComponent}
defaultProps={{
- propOne: "Hi",
+ propOne: 'Hi',
propTwo: 10,
}}
/>
@@ -102,27 +102,25 @@ npx remotion render HelloWorld out/helloworld.mp4 --props=./path/to/props.json
When server-rendering using [`renderMedia()`](/docs/renderer/render-media) or [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda), you can pass props using the [`inputProps`](/docs/renderer/render-media#inputprops) option:
```tsx twoslash {3-5, 10, 18}
-// @module: esnext
-// @target: es2017
-const serveUrl = "/path/to/bundle";
-const outputLocation = "/path/to/frames";
+const serveUrl = '/path/to/bundle';
+const outputLocation = '/path/to/frames';
// ---cut---
-import { renderMedia, selectComposition } from "@remotion/renderer";
+import {renderMedia, selectComposition} from '@remotion/renderer';
const inputProps = {
- titleText: "Hello World",
+ titleText: 'Hello World',
};
const composition = await selectComposition({
serveUrl,
- id: "my-video",
+ id: 'my-video',
inputProps,
});
await renderMedia({
composition,
serveUrl,
- codec: "h264",
+ codec: 'h264',
outputLocation,
inputProps,
});
@@ -140,13 +138,13 @@ When using GitHub Actions, you need to adjust the file at `.github/workflows/ren
workflow_dispatch:
inputs:
titleText:
- description: "Which text should it say?"
+ description: 'Which text should it say?'
required: true
- default: "Welcome to Remotion"
+ default: 'Welcome to Remotion'
titleColor:
- description: "Which color should it be in?"
+ description: 'Which color should it be in?'
required: true
- default: "black"
+ default: 'black'
```
### Retrieve input props
@@ -173,7 +171,7 @@ const AnotherComponent: React.FC = () => {
return null;
};
// ---cut---
-import { Series } from "remotion";
+import {Series} from 'remotion';
const ChainedScenes = () => {
return (
diff --git a/packages/docs/docs/player/player-integration.mdx b/packages/docs/docs/player/player-integration.mdx
index 34f4a2701d..534a7aa9cd 100644
--- a/packages/docs/docs/player/player-integration.mdx
+++ b/packages/docs/docs/player/player-integration.mdx
@@ -106,15 +106,7 @@ import {MyComp} from './MyComp';
export const MyVideo = () => {
return (
<>
- <Composition
- component={MyComp}
- durationInFrames={120}
- width={1920}
- height={1080}
- fps={30}
- id="my-comp"
- defaultProps={{text: 'World'}}
- />
+ <Composition component={MyComp} durationInFrames={120} width={1920} height={1080} fps={30} id="my-comp" defaultProps={{text: 'World'}} />
</>
);
};
@@ -201,15 +193,10 @@ If everything worked, you can now run your webapp and preview your video.
In any Node.JS context, you can call [`bundle()`](/docs/bundle) to bundle your video using Webpack and to server-side render the video. You need to add `@remotion/bundler` to your package.json for this.
```ts twoslash title="server.tsx"
-// @module: ESNext
-// @target: ESNext
-
import path from 'path';
import {bundle} from '@remotion/bundler';
-const bundled = await bundle(
- path.join(process.cwd(), 'src', 'remotion', 'index.ts'),
-);
+const bundled = await bundle(path.join(process.cwd(), 'src', 'remotion', 'index.ts'));
```
See [Server-side rendering](/docs/ssr) for a full example.
diff --git a/packages/docs/docs/presigned-urls.mdx b/packages/docs/docs/presigned-urls.mdx
index 78fe717a97..937b743f33 100644
--- a/packages/docs/docs/presigned-urls.mdx
+++ b/packages/docs/docs/presigned-urls.mdx
@@ -57,8 +57,6 @@ Your AWS user policy must at least have the ability to put an object and make it
First, accept a file in your frontend, for example using `<input type="file">`. You should get a `File`, from which you can determine the content type and content length:
```ts twoslash title="App.tsx"
-// @module: ESNext
-// @target: ESNext
import {interpolate} from 'remotion';
const file: File = {} as unknown as File;
// ---cut---
@@ -76,17 +74,9 @@ This example uses [`@aws-sdk/s3-request-presigner`](https://github.com/aws/aws-s
import {getSignedUrl} from '@aws-sdk/s3-request-presigner';
import {AwsRegion, getAwsClient} from '@remotion/lambda/client';
-export const generatePresignedUrl = async (
- contentType: string,
- contentLength: number,
- expiresIn: number,
- bucketName: string,
- region: AwsRegion,
-): Promise<{presignedUrl: string; readUrl: string}> => {
+export const generatePresignedUrl = async (contentType: string, contentLength: number, expiresIn: number, bucketName: string, region: AwsRegion): Promise<{presignedUrl: string; readUrl: string}> => {
if (contentLength > 1024 * 1024 * 200) {
- throw new Error(
- `File may not be over 200MB. Yours is ${contentLength} bytes.`,
- );
+ throw new Error(`File may not be over 200MB. Yours is ${contentLength} bytes.`);
}
const {client, sdk} = getAwsClient({
@@ -132,23 +122,9 @@ import {NextResponse} from 'next/server';
import {getSignedUrl} from '@aws-sdk/s3-request-presigner';
import {AwsRegion, getAwsClient} from '@remotion/lambda/client';
-const generatePresignedUrl = async ({
- contentType,
- contentLength,
- expiresIn,
- bucketName,
- region,
-}: {
- contentType: string;
- contentLength: number;
- expiresIn: number;
- bucketName: string;
- region: AwsRegion;
-}): Promise<{presignedUrl: string; readUrl: string}> => {
+const generatePresignedUrl = async ({contentType, contentLength, expiresIn, bucketName, region}: {contentType: string; contentLength: number; expiresIn: number; bucketName: string; region: AwsRegion}): Promise<{presignedUrl: string; readUrl: string}> => {
if (contentLength > 1024 * 1024 * 200) {
- throw new Error(
- `File may not be over 200MB. Yours is ${contentLength} bytes.`,
- );
+ throw new Error(`File may not be over 200MB. Yours is ${contentLength} bytes.`);
}
const {client, sdk} = getAwsClient({
@@ -208,8 +184,6 @@ export const POST = async (request: Request) => {
This is how you can call it in the frontend:
```tsx twoslash title="Uploader.tsx"
-// @module: es2022
-// @target: es2017
const file: File = {} as unknown as File;
// ---cut---
const presignedResponse = await fetch('/api/upload', {
@@ -238,8 +212,6 @@ This example does not implement any rate limiting or authentication.
Send the presigned URL back to the client. Afterwards, you can now perform an upload using the built-in [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) function:
```ts twoslash title="upload-with-fetch.ts"
-// @module: ESNext
-// @target: ESNext
import {interpolate} from 'remotion';
const presignedUrl = 'hi';
const file: File = {} as unknown as File;
@@ -270,15 +242,7 @@ export type UploadProgress = {
export type OnUploadProgress = (options: UploadProgress) => void;
-export const uploadWithProgress = ({
- file,
- url,
- onProgress,
-}: {
- file: File;
- url: string;
- onProgress: OnUploadProgress;
-}): Promise<void> => {
+export const uploadWithProgress = ({file, url, onProgress}: {file: File; url: string; onProgress: OnUploadProgress}): Promise<void> => {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
diff --git a/packages/docs/docs/render-all.mdx b/packages/docs/docs/render-all.mdx
index d601036914..6e75b3a159 100644
--- a/packages/docs/docs/render-all.mdx
+++ b/packages/docs/docs/render-all.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-render-all.png
id: render-all
title: Render all compositions
-crumb: "Techniques"
+crumb: 'Techniques'
---
In some scenarios, you might find it useful to render all compositions.
@@ -35,18 +35,16 @@ This only works on UNIX-based systems (Linux, macOS) and on WSL in Windows.
You can create a script that fits you using the [Node.JS APIs](/docs/renderer). Below is an example
```ts twoslash title="render-all.mjs"
-// @module: esnext
-// @target: es2022
// ---cut---
-import { bundle } from "@remotion/bundler";
-import { getCompositions, renderMedia } from "@remotion/renderer";
-import { createRequire } from "module";
+import {bundle} from '@remotion/bundler';
+import {getCompositions, renderMedia} from '@remotion/renderer';
+import {createRequire} from 'module';
const require = createRequire(import.meta.url);
const bundled = await bundle({
- entryPoint: require.resolve("./src/index.ts"),
+ entryPoint: require.resolve('./src/index.ts'),
// If you have a Webpack override, make sure to add it here
webpackOverride: (config) => config,
});
@@ -56,7 +54,7 @@ const compositions = await getCompositions(bundled);
for (const composition of compositions) {
console.log(`Rendering ${composition.id}...`);
await renderMedia({
- codec: "h264",
+ codec: 'h264',
composition,
serveUrl: bundled,
outputLocation: `out/${composition.id}.mp4`,
diff --git a/packages/docs/docs/renderer/ensure-browser.mdx b/packages/docs/docs/renderer/ensure-browser.mdx
index d5e06ec0b3..8068cc3675 100644
--- a/packages/docs/docs/renderer/ensure-browser.mdx
+++ b/packages/docs/docs/renderer/ensure-browser.mdx
@@ -10,16 +10,12 @@ crumb: '@remotion/renderer'
Ensures a browser is locally installed so a Remotion render can be executed.
```tsx twoslash title="Simple usage"
-// @module: ESNext
-// @target: ESNext
import {ensureBrowser} from '@remotion/renderer';
await ensureBrowser();
```
```tsx twoslash title="Setting a specific Chrome version and listening to progress"
-// @module: ESNext
-// @target: ESNext
import {ensureBrowser} from '@remotion/renderer';
await ensureBrowser({
@@ -60,8 +56,6 @@ Specify a specific version of Chrome that should be used and hook into the downl
See the example below for the function signature.
```tsx twoslash title="init.ts"
-// @module: ESNext
-// @target: ESNext
import {ensureBrowser, OnBrowserDownload, DownloadBrowserProgressFn} from '@remotion/renderer';
const onProgress: DownloadBrowserProgressFn = ({percent, downloadedBytes, totalSizeInBytes}) => {
diff --git a/packages/docs/docs/renderer/extract-audio.mdx b/packages/docs/docs/renderer/extract-audio.mdx
index f51a7af3ce..74f8383507 100644
--- a/packages/docs/docs/renderer/extract-audio.mdx
+++ b/packages/docs/docs/renderer/extract-audio.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-renderer-extract-audio.png
id: extract-audio
title: extractAudio()
-crumb: "@remotion/renderer"
+crumb: '@remotion/renderer'
---
# extractAudio()<AvailableFrom v="4.0.49" />
@@ -16,18 +16,13 @@ Extracts the audio from a video source and saves it to the specified output path
## Example
```ts twoslash
-// @module: ESNext
-// @target: ESNext
-import { resolve } from "node:path";
-import { extractAudio, getVideoMetadata } from "@remotion/renderer";
+import {resolve} from 'node:path';
+import {extractAudio, getVideoMetadata} from '@remotion/renderer';
-const videoSource = resolve(process.cwd(), "/Users/john/path-to-video.mp4");
+const videoSource = resolve(process.cwd(), '/Users/john/path-to-video.mp4');
const videoMetadata = await getVideoMetadata(videoSource);
-const audioOutput = resolve(
- process.cwd(),
- `./output-audio-path.${videoMetadata.audioFileExtension}`,
-);
+const audioOutput = resolve(process.cwd(), `./output-audio-path.${videoMetadata.audioFileExtension}`);
await extractAudio({
videoSource,
@@ -57,7 +52,7 @@ The path where the extracted audio will be saved. The file extension must match
### `logLevel?`
-<Options id="log"/>
+<Options id="log" />
### `binariesDirectory?`<AvailableFrom v="4.0.120" />
diff --git a/packages/docs/docs/renderer/get-can-extract-frames-fast.mdx b/packages/docs/docs/renderer/get-can-extract-frames-fast.mdx
index 0ce054fd17..fb59aeb91a 100644
--- a/packages/docs/docs/renderer/get-can-extract-frames-fast.mdx
+++ b/packages/docs/docs/renderer/get-can-extract-frames-fast.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-renderer-get-can-extract-frames-fast.png
title: getCanExtractFramesFast()
id: get-can-extract-frames-fast
-crumb: "@remotion/renderer"
+crumb: '@remotion/renderer'
---
:::warning
@@ -14,12 +14,10 @@ _Available since v3.3.2, removed in v4.0 - Part of the `@remotion/renderer` pack
Probes whether frames of a video can be efficiently extracted when using [`<OffthreadVideo>`](/docs/offthreadvideo).
```ts
-// @module: ESNext
-// @target: ESNext
-import { getCanExtractFramesFast } from "@remotion/renderer";
+import {getCanExtractFramesFast} from '@remotion/renderer';
const result = await getCanExtractFramesFast({
- src: "/var/path/to/video.mp4",
+ src: '/var/path/to/video.mp4',
});
console.log(result.canExtractFramesFast); // false
diff --git a/packages/docs/docs/renderer/get-silent-parts.mdx b/packages/docs/docs/renderer/get-silent-parts.mdx
index d73569b044..bbea5fde3b 100644
--- a/packages/docs/docs/renderer/get-silent-parts.mdx
+++ b/packages/docs/docs/renderer/get-silent-parts.mdx
@@ -2,15 +2,10 @@
image: /generated/articles-docs-renderer-get-silent-parts.png
id: get-silent-parts
title: getSilentParts()
-crumb: "@remotion/renderer"
+crumb: '@remotion/renderer'
---
-<YouTube
- minutes={2}
- href="https://www.youtube.com/watch?v=OHrvTMgiXWc"
- thumb="https://i.ytimg.com/vi/OHrvTMgiXWc/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLC35vhR28KkxA7Bxr5XRqbIsMxe3g"
- title="Remove silence from videos programmatically"
-/>
+<YouTube minutes={2} href="https://www.youtube.com/watch?v=OHrvTMgiXWc" thumb="https://i.ytimg.com/vi/OHrvTMgiXWc/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLC35vhR28KkxA7Bxr5XRqbIsMxe3g" title="Remove silence from videos programmatically" />
# getSilentParts()<AvailableFrom v="4.0.18" />
@@ -23,12 +18,10 @@ Gets the silent parts of a video or audio in Node.js. Useful for cutting out sil
## Example
```ts twoslash title="silent-parts.mjs"
-// @module: ESNext
-// @target: ESNext
-import { getSilentParts } from "@remotion/renderer";
+import {getSilentParts} from '@remotion/renderer';
-const { silentParts, durationInSeconds } = await getSilentParts({
- src: "/Users/john/Documents/bunny.mp4",
+const {silentParts, durationInSeconds} = await getSilentParts({
+ src: '/Users/john/Documents/bunny.mp4',
noiseThresholdInDecibels: -20,
minDurationInSeconds: 1,
});
@@ -64,7 +57,7 @@ The minimum duration of a silent part in seconds. The default is `1`.
### `logLevel?`
-<Options id="log"/>
+<Options id="log" />
### `binariesDirectory?`<AvailableFrom v="4.0.120" />
diff --git a/packages/docs/docs/renderer/get-video-metadata.mdx b/packages/docs/docs/renderer/get-video-metadata.mdx
index c4e3de6419..fb323920ea 100644
--- a/packages/docs/docs/renderer/get-video-metadata.mdx
+++ b/packages/docs/docs/renderer/get-video-metadata.mdx
@@ -20,8 +20,6 @@ Gets metadata about a video file in Node.js. Useful for calculating metadata on
## Example
```ts twoslash
-// @module: ESNext
-// @target: ESNext
import {getVideoMetadata, VideoMetadata} from '@remotion/renderer';
const videoMetadata: VideoMetadata = await getVideoMetadata('/Users/john/Documents/bunny.mp4');
diff --git a/packages/docs/docs/renderer/make-cancel-signal.mdx b/packages/docs/docs/renderer/make-cancel-signal.mdx
index 31a74887c2..494a0366c2 100644
--- a/packages/docs/docs/renderer/make-cancel-signal.mdx
+++ b/packages/docs/docs/renderer/make-cancel-signal.mdx
@@ -2,7 +2,7 @@
image: /generated/articles-docs-renderer-make-cancel-signal.png
id: make-cancel-signal
title: makeCancelSignal()
-crumb: "@remotion/renderer"
+crumb: '@remotion/renderer'
---
_Available from v3.0.15_
@@ -13,30 +13,28 @@ This function returns a signal and a cancel function that allows to you cancel a
## Example
```tsx twoslash
-// @module: ESNext
-// @target: ESNext
-import { VideoConfig } from "remotion";
+import {VideoConfig} from 'remotion';
const composition: VideoConfig = {
durationInFrames: 1000000,
fps: 30,
height: 720,
- id: "react-svg",
+ id: 'react-svg',
width: 1280,
defaultProps: {},
props: {},
defaultCodec: null,
};
// ---cut---
-import { makeCancelSignal, renderMedia } from "@remotion/renderer";
+import {makeCancelSignal, renderMedia} from '@remotion/renderer';
-const { cancelSignal, cancel } = makeCancelSignal();
+const {cancelSignal, cancel} = makeCancelSignal();
// Note that no `await` is used yet
const render = renderMedia({
composition,
- codec: "h264",
- serveUrl: "https://silly-crostata-c4c336.netlify.app/",
- outputLocation: "out/render.mp4",
+ codec: 'h264',
+ serveUrl: 'https://silly-crostata-c4c336.netlify.app/',
+ outputLocation: 'out/render.mp4',
cancelSignal,
});
diff --git a/packages/docs/docs/renderer/render-media.mdx b/packages/docs/docs/renderer/render-media.mdx
index 05268d7b9d..324985bf73 100644
--- a/packages/docs/docs/renderer/render-media.mdx
+++ b/packages/docs/docs/renderer/render-media.mdx
@@ -10,8 +10,6 @@ _Available since v3.0 - Part of the `@remotion/renderer` package._
Render a video or an audio programmatically.
```tsx twoslash title="render.mjs"
-// @module: esnext
-// @target: es2017
const serveUrl = '/path/to/bundle';
const outputLocation = '/path/to/frames';
diff --git a/packages/docs/docs/renderer/render-still.mdx b/packages/docs/docs/renderer/render-still.mdx
index f456e34181..db2ae0c99a 100644
--- a/packages/docs/docs/renderer/render-still.mdx
+++ b/packages/docs/docs/renderer/render-still.mdx
@@ -16,8 +16,6 @@ If you want to render a video, use [renderMedia()](/docs/renderer/render-media)
You first need to bundle the project and fetch the compositions. Read [the code snippet on the site for server-side rendering](/docs/ssr) for an example how to come up with the `bundleLocation` and `composition` variables.
```ts twoslash
-// @module: ESNext
-// @target: ESNext
import {bundle} from '@remotion/bundler';
import {getCompositions, renderStill} from '@remotion/renderer';
diff --git a/packages/docs/docs/renderer/select-composition.mdx b/packages/docs/docs/renderer/select-composition.mdx
index ee4f009059..6c22dde846 100644
--- a/packages/docs/docs/renderer/select-composition.mdx
+++ b/packages/docs/docs/renderer/select-composition.mdx
@@ -14,8 +14,6 @@ If you want to get a list of all compositions, use [`getCompositions()`](/docs/r
If no composition with the specified [ID](/docs/terminology/composition#composition-id) exists, then this function will throw.
```tsx twoslash title="Example"
-// @module: ESNext
-// @target: ESNext
// ---cut---
import {bundle} from '@remotion/bundler';
import {selectComposition} from '@remotion/renderer';
diff --git a/packages/docs/docs/ssr-node.mdx b/packages/docs/docs/ssr-node.mdx
index b69412255a..58e07e4ebc 100644
--- a/packages/docs/docs/ssr-node.mdx
+++ b/packages/docs/docs/ssr-node.mdx
@@ -12,8 +12,7 @@ These functions can be used in Node.js and Bun.
Rendering a video takes three steps:
<div>
- <Step>1</Step> Creating a{' '}
- <a href="/docs/terminology/bundle">Remotion Bundle</a>
+ <Step>1</Step> Creating a <a href="/docs/terminology/bundle">Remotion Bundle</a>
<br />
<Step>2</Step> Select the composition to render and calculate its metadata
<br />
@@ -25,8 +24,6 @@ Rendering a video takes three steps:
Follow this commented example to see how to render a video:
```tsx twoslash title="render.mjs"
-// @module: ESNext
-// @target: ESNext
import {bundle} from '@remotion/bundler';
import {renderMedia, selectComposition} from '@remotion/renderer';
import path from 'path';
diff --git a/packages/docs/docs/studio/deploy-static.mdx b/packages/docs/docs/studio/deploy-static.mdx
index c21866311a..311ac041b5 100644
--- a/packages/docs/docs/studio/deploy-static.mdx
+++ b/packages/docs/docs/studio/deploy-static.mdx
@@ -121,8 +121,6 @@ npx remotion render https://remotion-helloworld.vercel.app HelloWorld --props '{
<TabItem value="ssr">
```tsx twoslash title="render.mjs"
-// @module: esnext
-// @target: es2017
const outputLocation = '/path/to/frames';
import {renderMedia, selectComposition} from '@remotion/renderer';
@@ -159,8 +157,6 @@ npx remotion lambda render https://remotion-helloworld.vercel.app HelloWorld --p
```
```tsx twoslash title="Node.js/Bun"
-// @module: esnext
-// @target: es2017
// ---cut---
import {renderMediaOnLambda} from '@remotion/lambda/client';
@@ -187,8 +183,6 @@ npx remotion cloudrun render https://remotion-helloworld.vercel.app HelloWorld -
```
```tsx twoslash title="Node.js/Bun"
-// @module: esnext
-// @target: es2017
// ---cut---
import {renderMediaOnCloudrun} from '@remotion/cloudrun/client';
diff --git a/packages/docs/docs/using-audio.mdx b/packages/docs/docs/using-audio.mdx
index e28a716e5e..5bc34266df 100644
--- a/packages/docs/docs/using-audio.mdx
+++ b/packages/docs/docs/using-audio.mdx
@@ -3,7 +3,7 @@ image: /generated/articles-docs-using-audio.png
title: Using audio
sidebar_label: Audio
id: using-audio
-crumb: "Techniques"
+crumb: 'Techniques'
---
import Tabs from '@theme/Tabs';
@@ -15,12 +15,12 @@ import TabItem from '@theme/TabItem';
Add an [`<Audio/>`](/docs/audio) tag to your component to add sound to it.
```tsx twoslash
-import { AbsoluteFill, Audio, staticFile } from "remotion";
+import {AbsoluteFill, Audio, staticFile} from 'remotion';
export const MyComposition = () => {
return (
<AbsoluteFill>
- <Audio src={staticFile("audio.mp3")} />
+ <Audio src={staticFile('audio.mp3')} />
</AbsoluteFill>
);
};
@@ -29,7 +29,7 @@ export const MyComposition = () => {
You can also add remote audio by passing a URL:
```tsx twoslash
-import { AbsoluteFill, Audio } from "remotion";
+import {AbsoluteFill, Audio} from 'remotion';
export const MyComposition = () => {
return (
@@ -48,12 +48,12 @@ You can mix multiple tracks together by adding more audio tags.
The `<Audio />` tag supports the `startFrom` and `endAt` props. In the following example, we assume that the [`fps`](/docs/composition#fps) of the composition is `30`.
```tsx twoslash {6}
-import { AbsoluteFill, Audio, staticFile } from "remotion";
+import {AbsoluteFill, Audio, staticFile} from 'remotion';
export const MyComposition = () => {
return (
<AbsoluteFill>
- <Audio src={staticFile("audio.mp3")} startFrom={60} endAt={120} />
+ <Audio src={staticFile('audio.mp3')} startFrom={60} endAt={120} />
</AbsoluteFill>
);
};
@@ -70,13 +70,13 @@ Use a `<Sequence>` with a positive `from` value to delay the audio from playing.
In the following example, the audio will start playing (from the beginning) after 100 frames.
```tsx twoslash {6-8}
-import { AbsoluteFill, Audio, Sequence, staticFile } from "remotion";
+import {AbsoluteFill, Audio, Sequence, staticFile} from 'remotion';
export const MyComposition = () => {
return (
<AbsoluteFill>
<Sequence from={100}>
- <Audio src={staticFile("audio.mp3")} />
+ <Audio src={staticFile('audio.mp3')} />
</Sequence>
</AbsoluteFill>
);
@@ -90,8 +90,8 @@ You can use the [`volume`](/docs/audio#volume) prop to control the volume.
The simplest way is to pass a number between 0 and 1. `1` is the maximum volume and `0` mutes the audio.
```tsx twoslash {8}
-import { Audio } from "remotion";
-import audio from "./audio.mp3";
+import {Audio} from 'remotion';
+import audio from './audio.mp3';
export const MyComposition = () => {
return (
@@ -106,17 +106,12 @@ export const MyComposition = () => {
You can also change volume over time by passing in a function that takes a frame number and returns the volume.
```tsx twoslash {8-10}
-import { AbsoluteFill, Audio, interpolate, staticFile } from "remotion";
+import {AbsoluteFill, Audio, interpolate, staticFile} from 'remotion';
export const MyComposition = () => {
return (
<AbsoluteFill>
- <Audio
- src={staticFile("audio.mp3")}
- volume={(f) =>
- interpolate(f, [0, 30], [0, 1], { extrapolateLeft: "clamp" })
- }
- />
+ <Audio src={staticFile('audio.mp3')} volume={(f) => interpolate(f, [0, 30], [0, 1], {extrapolateLeft: 'clamp'})} />
</AbsoluteFill>
);
};
@@ -137,14 +132,14 @@ When using the [`<Player>`](/docs/player), note that Mobile Safari [does not sup
You may pass in the `muted` and it may change over time. When `muted` is true, audio will be omitted at that time. In the following example, we are muting the track between frame 40 and 60.
```tsx twoslash {8}
-import { AbsoluteFill, Audio, staticFile, useCurrentFrame } from "remotion";
+import {AbsoluteFill, Audio, staticFile, useCurrentFrame} from 'remotion';
export const MyComposition = () => {
const frame = useCurrentFrame();
return (
<AbsoluteFill>
- <Audio src={staticFile("audio.mp3")} muted={frame >= 40 && frame <= 60} />
+ <Audio src={staticFile('audio.mp3')} muted={frame >= 40 && frame <= 60} />
</AbsoluteFill>
);
};
@@ -199,16 +194,14 @@ npx remotion render src/index.ts my-comp --codec=mp3
To render only the audio via Node.JS, use [`renderMedia()`](/docs/renderer/render-media) and set the [`codec`](/docs/renderer/render-media#codec) to an audio codec.
```tsx twoslash
-// @module: ESNext
-// @target: ESNext
-import { bundle } from "@remotion/bundler";
-import { getCompositions, renderMedia } from "@remotion/renderer"; // The composition you want to render
-import path from "path";
-const compositionId = "HelloWorld";
+import {bundle} from '@remotion/bundler';
+import {getCompositions, renderMedia} from '@remotion/renderer'; // The composition you want to render
+import path from 'path';
+const compositionId = 'HelloWorld';
// You only have to do this once, you can reuse the bundle.
-const entry = "./src/index";
-console.log("Creating a Webpack bundle of the video");
+const entry = './src/index';
+console.log('Creating a Webpack bundle of the video');
const bundleLocation = await bundle(path.resolve(entry), () => undefined, {
// If you have a Webpack override, make sure to add it here
webpackOverride: (config) => config,
@@ -216,7 +209,7 @@ const bundleLocation = await bundle(path.resolve(entry), () => undefined, {
// Parametrize the video by passing arbitrary props to your component.
const inputProps = {
- foo: "bar",
+ foo: 'bar',
};
// Extract all the compositions you have defined in your project
@@ -242,7 +235,7 @@ const outputLocation = `out/${compositionId}.mp4`;
await renderMedia({
composition,
serveUrl: bundleLocation,
- codec: "mp3",
+ codec: 'mp3',
outputLocation,
inputProps,
});
@@ -254,23 +247,20 @@ await renderMedia({
To render only the audio via Lambda, use [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) and set the [`codec`](/docs/lambda/rendermediaonlambda#codec) to an audio codec and [`imageFormat`](/docs/lambda/rendermediaonlambda#imageformat) to `none`.
```tsx twoslash
-// @module: esnext
-// @target: es2017
-import { renderMediaOnLambda } from "@remotion/lambda";
+import {renderMediaOnLambda} from '@remotion/lambda';
// ---cut---
-const { bucketName, renderId } = await renderMediaOnLambda({
- region: "us-east-1",
- functionName: "remotion-render-bds9aab",
- composition: "MyVideo",
+const {bucketName, renderId} = await renderMediaOnLambda({
+ region: 'us-east-1',
+ functionName: 'remotion-render-bds9aab',
+ composition: 'MyVideo',
framesPerLambda: 20,
- serveUrl:
- "https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
+ serveUrl: 'https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw',
inputProps: {},
- codec: "mp3",
- imageFormat: "none",
+ codec: 'mp3',
+ imageFormat: 'none',
maxRetries: 1,
- privacy: "public",
+ privacy: 'public',
});
```
diff --git a/packages/docs/docs/videos/sequence.mdx b/packages/docs/docs/videos/sequence.mdx
index fb37f642da..4ea2a12f92 100644
--- a/packages/docs/docs/videos/sequence.mdx
+++ b/packages/docs/docs/videos/sequence.mdx
@@ -37,10 +37,7 @@ export const VideosInSequence: React.FC<Props> = ({videos}) => {
}
return (
- <Series.Sequence
- key={vid.src}
- durationInFrames={vid.durationInFrames}
- >
+ <Series.Sequence key={vid.src} durationInFrames={vid.durationInFrames}>
<OffthreadVideo src={vid.src} />
</Series.Sequence>
);
@@ -52,23 +49,15 @@ export const VideosInSequence: React.FC<Props> = ({videos}) => {
In the same file, create a function that calculates the metadata for the composition:
-<Step>1</Step> Calls [`parseMedia()`](/docs/media-parser) to get the duration of
-each video.
+<Step>1</Step> Calls [`parseMedia()`](/docs/media-parser) to get the duration of each video.
<div style={{marginTop: -14}} />
-<Step>2</Step> Create a [`calculateMetadata()`](/docs/calculate-metadata)
-function that fetches the duration of each video.
+<Step>2</Step> Create a [`calculateMetadata()`](/docs/calculate-metadata) function that fetches the duration of each video.
<div style={{marginTop: -14}} />
-<Step>3</Step> Sums up all durations to get the total duration of the
-composition.
+<Step>3</Step> Sums up all durations to get the total duration of the composition.
```tsx twoslash title="VideosInSequence.tsx"
import React from 'react';
-import {
- OffthreadVideo,
- staticFile,
- Series,
- CalculateMetadataFunction,
-} from 'remotion';
+import {OffthreadVideo, staticFile, Series, CalculateMetadataFunction} from 'remotion';
import {parseMedia} from '@remotion/media-parser';
type VideoToEmbed = {
@@ -81,9 +70,7 @@ type Props = {
};
// ---cut---
-export const calculateMetadata: CalculateMetadataFunction<Props> = async ({
- props,
-}) => {
+export const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
const fps = 30;
const videos = await Promise.all([
...props.videos.map(async (video): Promise<VideoToEmbed> => {
@@ -101,10 +88,7 @@ export const calculateMetadata: CalculateMetadataFunction<Props> = async ({
}),
]);
- const totalDurationInFrames = videos.reduce(
- (acc, video) => acc + (video.durationInFrames ?? 0),
- 0,
- );
+ const totalDurationInFrames = videos.reduce((acc, video) => acc + (video.durationInFrames ?? 0), 0);
return {
props: {
@@ -122,12 +106,7 @@ In your [root file](/docs/terminology/root-file), create a [`<Composition>`](/do
```tsx twoslash title="Root.tsx"
// @filename: VideosInSequence.tsx
import React from 'react';
-import {
- OffthreadVideo,
- staticFile,
- Series,
- CalculateMetadataFunction,
-} from 'remotion';
+import {OffthreadVideo, staticFile, Series, CalculateMetadataFunction} from 'remotion';
import {parseMedia} from '@remotion/media-parser';
type VideoToEmbed = {
@@ -139,9 +118,7 @@ type Props = {
videos: VideoToEmbed[];
};
-export const calculateMetadata: CalculateMetadataFunction<Props> = async ({
- props,
-}) => {
+export const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
const fps = 30;
const videos = await Promise.all([
...props.videos.map(async (video): Promise<VideoToEmbed> => {
@@ -159,10 +136,7 @@ export const calculateMetadata: CalculateMetadataFunction<Props> = async ({
}),
]);
- const totalDurationInFrames = videos.reduce(
- (acc, video) => acc + video.durationInFrames!,
- 0,
- );
+ const totalDurationInFrames = videos.reduce((acc, video) => acc + video.durationInFrames!, 0);
return {
props: {
@@ -183,10 +157,7 @@ export const VideosInSequence: React.FC<Props> = ({videos}) => {
}
return (
- <Series.Sequence
- key={vid.src}
- durationInFrames={vid.durationInFrames}
- >
+ <Series.Sequence key={vid.src} durationInFrames={vid.durationInFrames}>
<OffthreadVideo src={staticFile('video.mp4')} />
</Series.Sequence>
);
@@ -238,7 +209,7 @@ To create a smoother preview playback, we should do two things to all videos:
<Step>1</Step> Add a [`premountFor`](/docs/series#premountfor) prop to [`<Series.Sequence>`](/docs/series). This will
invisibly mount the video tag before it is played, giving it some time to load.{' '}
<div style={{marginTop: -14}} />
-<Step>2</Step> Add the [`pauseWhenBuffering`](/docs/series#premount) prop. This will transition the Player into a [buffering state](/docs/player/buffer-state), should the video still need to load.
+<Step>2</Step> Add the [`pauseWhenBuffering`](/docs/offthreadvideo#pausewhenbuffering) prop. This will transition the Player into a [buffering state](/docs/player/buffer-state), should the video still need to load.
```tsx twoslash title="VideosInSequence.tsx" {14, 17}
import React from 'react';
@@ -265,11 +236,7 @@ export const VideosInSequence: React.FC<Props> = ({videos}) => {
}
return (
- <Series.Sequence
- key={vid.src}
- premountFor={4 * fps}
- durationInFrames={vid.durationInFrames}
- >
+ <Series.Sequence key={vid.src} premountFor={4 * fps} durationInFrames={vid.durationInFrames}>
<OffthreadVideo pauseWhenBuffering src={vid.src} />
</Series.Sequence>
);
diff --git a/packages/docs/docs/webcodecs/can-copy-audio-track.mdx b/packages/docs/docs/webcodecs/can-copy-audio-track.mdx
index b40671164d..22873b7972 100644
--- a/packages/docs/docs/webcodecs/can-copy-audio-track.mdx
+++ b/packages/docs/docs/webcodecs/can-copy-audio-track.mdx
@@ -19,9 +19,6 @@ You can obtain an `AudioTrack` using [`parseMedia()`](/docs/media-parser/parse-m
## Examples
```tsx twoslash title="Check if an audio track can be copied"
-// @module: es2022
-// @target: es2017
-
import {parseMedia} from '@remotion/media-parser';
import {canCopyAudioTrack} from '@remotion/webcodecs';
@@ -43,9 +40,6 @@ for (const track of tracks.audioTracks) {
```
```tsx twoslash title="Copy an audio track to Opus, otherwise drop it"
-// @module: es2022
-// @target: es2017
-
import {convertMedia, canCopyAudioTrack} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/can-copy-video-track.mdx b/packages/docs/docs/webcodecs/can-copy-video-track.mdx
index a42c587d7a..6d831cefc3 100644
--- a/packages/docs/docs/webcodecs/can-copy-video-track.mdx
+++ b/packages/docs/docs/webcodecs/can-copy-video-track.mdx
@@ -22,8 +22,6 @@ You can obtain a `VideoTrack` using [`parseMedia()`](/docs/media-parser/parse-me
## Examples
```tsx twoslash title="Check if a video tracks can be copied"
-// @module: es2022
-// @target: es2017
import {parseMedia} from '@remotion/media-parser';
import {canCopyVideoTrack} from '@remotion/webcodecs';
@@ -47,9 +45,6 @@ for (const track of tracks.videoTracks) {
```
```tsx twoslash title="Copy a video track to VP8, otherwise drop it"
-// @module: es2022
-// @target: es2017
-
import {convertMedia, canCopyVideoTrack} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/can-reencode-audio-track.mdx b/packages/docs/docs/webcodecs/can-reencode-audio-track.mdx
index 34845c24da..212958abd9 100644
--- a/packages/docs/docs/webcodecs/can-reencode-audio-track.mdx
+++ b/packages/docs/docs/webcodecs/can-reencode-audio-track.mdx
@@ -19,9 +19,6 @@ You can obtain an `AudioTrack` using [`parseMedia()`](/docs/media-parser/parse-m
## Examples
```tsx twoslash title="Check if audio tracks can be re-encoded to Opus"
-// @module: es2022
-// @target: es2017
-
import {parseMedia} from '@remotion/media-parser';
import {canReencodeAudioTrack} from '@remotion/webcodecs';
@@ -42,8 +39,6 @@ for (const track of tracks.audioTracks) {
```
```tsx twoslash title="Convert an audio track to Opus, otherwise drop it"
-// @module: es2022
-// @target: es2017
import {convertMedia, canReencodeAudioTrack} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/can-reencode-video-track.mdx b/packages/docs/docs/webcodecs/can-reencode-video-track.mdx
index f1df178249..57f3a91476 100644
--- a/packages/docs/docs/webcodecs/can-reencode-video-track.mdx
+++ b/packages/docs/docs/webcodecs/can-reencode-video-track.mdx
@@ -19,9 +19,6 @@ You can obtain a `VideoTrack` using [`parseMedia()`](/docs/media-parser/parse-me
## Examples
```tsx twoslash title="Check if video tracks can be re-encoded to VP8"
-// @module: es2022
-// @target: es2017
-
import {parseMedia} from '@remotion/media-parser';
import {canReencodeVideoTrack} from '@remotion/webcodecs';
@@ -43,8 +40,6 @@ for (const track of tracks.videoTracks) {
```
```tsx twoslash title="Convert a video track to VP8, otherwise drop it"
-// @module: es2022
-// @target: es2017
import {convertMedia, canReencodeVideoTrack} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/convert-a-video.mdx b/packages/docs/docs/webcodecs/convert-a-video.mdx
index 9c09e94051..ab758cc7e7 100644
--- a/packages/docs/docs/webcodecs/convert-a-video.mdx
+++ b/packages/docs/docs/webcodecs/convert-a-video.mdx
@@ -63,8 +63,6 @@ Install the `@remotion/webcodecs` and `@remotion/media-parser` packages:
(needs to be CORS-enabled)
```tsx twoslash title="Converting an MP4 to a WebM"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
@@ -76,9 +74,6 @@ await convertMedia({
### Converting from a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File):
```tsx twoslash title="Converting a file"
-// @module: es2022
-// @target: es2017
-
import {convertMedia} from '@remotion/webcodecs';
import {webFileReader} from '@remotion/media-parser/web-file';
@@ -97,9 +92,6 @@ await convertMedia({
You can specify the output codec by passing the [`videoCodec`](/docs/webcodecs/convert-media#videocodec) and [`audioCodec`](/docs/webcodecs/convert-media#audiocodec) options:
```tsx twoslash title="Converting to VP9"
-// @module: es2022
-// @target: es2017
-
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/convert-media.mdx b/packages/docs/docs/webcodecs/convert-media.mdx
index 7c2340ce12..2a8cfd582e 100644
--- a/packages/docs/docs/webcodecs/convert-media.mdx
+++ b/packages/docs/docs/webcodecs/convert-media.mdx
@@ -25,8 +25,6 @@ import {UnstableDisclaimer} from './UnstableDisclaimer';
Re-encodes a video using [WebCodecs](https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API) and [`@remotion/media-parser`](/docs/media-parser).
```tsx twoslash title="Converting a video"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
@@ -211,8 +209,6 @@ import {bufferWriter} from '@remotion/webcodecs/buffer';
Write to a resizable Array Buffer.
```tsx twoslash title="Web File System writer"
-// @module: es2022
-// @target: es2017
import {canUseWebFsWriter, webFsWriter} from '@remotion/webcodecs/web-fs';
// ^?
@@ -251,8 +247,6 @@ You can obtain information about the video file while you are converting it.
This feature is inherited from [`parseMedia()`](/docs/media-parser/parse-media), but only the callback-style API is available.
```tsx twoslash title="Converting a video"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/default-on-audio-track-handler.mdx b/packages/docs/docs/webcodecs/default-on-audio-track-handler.mdx
index 3ffff28824..a0441c3527 100644
--- a/packages/docs/docs/webcodecs/default-on-audio-track-handler.mdx
+++ b/packages/docs/docs/webcodecs/default-on-audio-track-handler.mdx
@@ -10,8 +10,6 @@ This is the default function if no [`onAudioTrack`](/docs/webcodecs/convert-medi
You may use this function if you want to customize part of the track transformation logic, but fall back to the default behavior for the rest.
```tsx twoslash title="Falling back to the default behavior"
-// @module: es2022
-// @target: es2017
import {convertMedia, defaultOnVideoTrackHandler} from '@remotion/webcodecs';
await convertMedia({
@@ -40,52 +38,39 @@ The default behavior is as follows:
This is the source code for the default function. You may use this as a reference to create your own custom handler.
```tsx twoslash title="Source code for defaultOnAudioTrackHandler"
-import {
- canReencodeAudioTrack,
- AudioOperation,
- ConvertMediaOnAudioTrackHandler,
- getDefaultAudioCodec,
-} from '@remotion/webcodecs';
+import {canReencodeAudioTrack, AudioOperation, ConvertMediaOnAudioTrackHandler, getDefaultAudioCodec} from '@remotion/webcodecs';
const DEFAULT_BITRATE = 128_000;
-export const defaultOnAudioTrackHandler: ConvertMediaOnAudioTrackHandler =
- async ({
+export const defaultOnAudioTrackHandler: ConvertMediaOnAudioTrackHandler = async ({track, defaultAudioCodec, logLevel, inputContainer, outputContainer, canCopyTrack}): Promise<AudioOperation> => {
+ const bitrate = DEFAULT_BITRATE;
+
+ if (canCopyTrack) {
+ return Promise.resolve({type: 'copy'});
+ }
+
+ // In the future, we might support containers that don't support audio
+ // (like GIF, animated WebP, etc.) - in that case, we should drop the audio
+ if (defaultAudioCodec === null) {
+ return Promise.resolve({type: 'drop'});
+ }
+
+ const canReencode = await canReencodeAudioTrack({
+ audioCodec: defaultAudioCodec,
track,
- defaultAudioCodec,
- logLevel,
- inputContainer,
- outputContainer,
- canCopyTrack,
- }): Promise<AudioOperation> => {
- const bitrate = DEFAULT_BITRATE;
-
- if (canCopyTrack) {
- return Promise.resolve({type: 'copy'});
- }
-
- // In the future, we might support containers that don't support audio
- // (like GIF, animated WebP, etc.) - in that case, we should drop the audio
- if (defaultAudioCodec === null) {
- return Promise.resolve({type: 'drop'});
- }
-
- const canReencode = await canReencodeAudioTrack({
- audioCodec: defaultAudioCodec,
- track,
+ bitrate,
+ });
+
+ if (canReencode) {
+ return Promise.resolve({
+ type: 'reencode',
bitrate,
+ audioCodec: defaultAudioCodec,
});
+ }
- if (canReencode) {
- return Promise.resolve({
- type: 'reencode',
- bitrate,
- audioCodec: defaultAudioCodec,
- });
- }
-
- return Promise.resolve({type: 'fail'});
- };
+ return Promise.resolve({type: 'fail'});
+};
```
## See also
diff --git a/packages/docs/docs/webcodecs/default-on-video-track-handler.mdx b/packages/docs/docs/webcodecs/default-on-video-track-handler.mdx
index 7acf261f5d..309a6e2fb3 100644
--- a/packages/docs/docs/webcodecs/default-on-video-track-handler.mdx
+++ b/packages/docs/docs/webcodecs/default-on-video-track-handler.mdx
@@ -10,8 +10,6 @@ This is the default function if no [`onVideoTrack`](/docs/webcodecs/convert-medi
You may use this function if you want to customize part of the track transformation logic, but fall back to the default behavior for the rest.
```tsx twoslash title="Falling back to the default behavior"
-// @module: es2022
-// @target: es2017
import {convertMedia, defaultOnAudioTrackHandler} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/fix-a-mediarecorder-video.mdx b/packages/docs/docs/webcodecs/fix-a-mediarecorder-video.mdx
index c5a70b3f76..81093d1daa 100644
--- a/packages/docs/docs/webcodecs/fix-a-mediarecorder-video.mdx
+++ b/packages/docs/docs/webcodecs/fix-a-mediarecorder-video.mdx
@@ -47,9 +47,6 @@ ffmpeg -i input.webm -c copy output.webm
You can also re-encode the video in the browser using the new and experimental [`@remotion/webcodecs`](/docs/webcodecs) package.
```tsx twoslash title="Re-encoding a video"
-// @module: es2022
-// @target: es2017
-
import {convertMedia} from '@remotion/webcodecs';
import {webFileReader} from '@remotion/media-parser/web-file';
@@ -82,9 +79,6 @@ import {UnstableDisclaimer} from './UnstableDisclaimer';
Instead of re-encoding to an MP4, you can also re-mux the video to a new WebM file:
```tsx twoslash title="Re-muxing a video"
-// @module: es2022
-// @target: es2017
-
import {convertMedia} from '@remotion/webcodecs';
import {webFileReader} from '@remotion/media-parser/web-file';
diff --git a/packages/docs/docs/webcodecs/resizing.mdx b/packages/docs/docs/webcodecs/resizing.mdx
index 4dbe1a7359..c313e4e78b 100644
--- a/packages/docs/docs/webcodecs/resizing.mdx
+++ b/packages/docs/docs/webcodecs/resizing.mdx
@@ -24,8 +24,6 @@ import {UnstableDisclaimer} from './UnstableDisclaimer';
## Simple Example
```tsx twoslash title="Scale a video down to 480p"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/rotation.mdx b/packages/docs/docs/webcodecs/rotation.mdx
index c7c12f21bf..6257a79b67 100644
--- a/packages/docs/docs/webcodecs/rotation.mdx
+++ b/packages/docs/docs/webcodecs/rotation.mdx
@@ -24,8 +24,6 @@ import {UnstableDisclaimer} from './UnstableDisclaimer';
## Simple Example
```tsx twoslash title="Rotate 90 degrees clockwise"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
@@ -50,8 +48,6 @@ If you want the video to not automatically be rotated, you need to re-apply the
The rotations will negate each other, and [`convertMedia()`](/docs/webcodecs/convert-media) will not execute any code to apply rotation.
```tsx twoslash title="Prevent automatic video rotation"
-// @module: es2022
-// @target: es2017
import {convertMedia, defaultOnVideoTrackHandler} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/telemetry.mdx b/packages/docs/docs/webcodecs/telemetry.mdx
index 619950c497..1477128389 100644
--- a/packages/docs/docs/webcodecs/telemetry.mdx
+++ b/packages/docs/docs/webcodecs/telemetry.mdx
@@ -36,8 +36,6 @@ Remotion will not share any telemetry data with others.
You may add an API key that you obtained from [`remotion.pro`](https://remotion.pro) to the [`convertMedia()`](/docs/webcodecs/convert-media) function.
```tsx twoslash title="Adding an API key"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docs/docs/webcodecs/track-transformation.mdx b/packages/docs/docs/webcodecs/track-transformation.mdx
index 2f9f4572e6..6952e8764b 100644
--- a/packages/docs/docs/webcodecs/track-transformation.mdx
+++ b/packages/docs/docs/webcodecs/track-transformation.mdx
@@ -19,8 +19,6 @@ When transforming media, there are multiple thing that can be done for each audi
The minimum amount of configuration is to only specify a [`src`](/docs/webcodecs/convert-media#src) and an output [`container`](/docs/webcodecs/convert-media#container).
```tsx twoslash title="Using the default codecs"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
@@ -36,8 +34,6 @@ The default codecs are defined by [`getDefaultAudioCodec()`](/docs/webcodecs/get
You can use the [`videoCodec`](/docs/webcodecs/convert-media#videocodec) and [`audioCodec`](/docs/webcodecs/convert-media#audiocodec) options to transform all tracks to the codecs you specify.
```tsx twoslash title="Choosing video and audio codecs"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
@@ -53,8 +49,6 @@ await convertMedia({
With the [`onVideoTrack`](/docs/webcodecs/convert-media#onvideotrack) and [`onAudioTrack`](/docs/webcodecs/convert-media#onaudiotrack) callbacks, you can decide for each track what to do with it.
```tsx twoslash title="Using the onVideoTrack() API"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
@@ -94,8 +88,6 @@ The enums `ConvertMediaVideoCodec` and `ConvertMediaAudioCodec` can be imported
To check if it is possible to return `{"type": "copy"}`, you can use `canCopyTrack` property you get from `onVideoTrack`.
```tsx twoslash title="Using the canCopyVideoTrack() API"
-// @module: es2022
-// @target: es2017
import {convertMedia} from '@remotion/webcodecs';
await convertMedia({
@@ -119,8 +111,6 @@ To check outside of a `onVideoTrack` handler, you can also use the the [`canCopy
To check if it is possible to return `{"type": "reencode"}`, you can use the [`canReencodeVideoTrack()`](/docs/webcodecs/can-reencode-video-track) and [`canReencodeAudioTrack()`](/docs/webcodecs/can-reencode-audio-track) APIs.
```tsx twoslash title="Using the canReencodeVideoTrack() API"
-// @module: es2022
-// @target: es2017
import {convertMedia, canReencodeVideoTrack} from '@remotion/webcodecs';
await convertMedia({
@@ -156,9 +146,6 @@ If you want to display a UI letting the user choose codec settings before the co
Use [`parseMedia()`](/docs/media-parser/parse-media) to get video and audio tracks respectively:
```tsx twoslash title="Using parseMedia() to get tracks upfront."
-// @module: es2022
-// @target: es2017
-
import {parseMedia} from '@remotion/media-parser';
const {tracks} = await parseMedia({
@@ -183,8 +170,6 @@ The default values for [`onVideoTrack`](/docs/webcodecs/convert-media#onvideotra
If you only want to override part of the logic, you can return the default resolver functions at the end of your logic.
```tsx twoslash title="Falling back to the default behavior"
-// @module: es2022
-// @target: es2017
import {convertMedia, defaultOnAudioTrackHandler} from '@remotion/webcodecs';
await convertMedia({
diff --git a/packages/docusaurus-plugin/src/caching.ts b/packages/docusaurus-plugin/src/caching.ts
index 9599a93a61..bd1f8f66aa 100644
--- a/packages/docusaurus-plugin/src/caching.ts
+++ b/packages/docusaurus-plugin/src/caching.ts
@@ -2,6 +2,7 @@
import type {TwoSlashReturn} from '@typescript/twoslash';
import type {UserConfigSettings} from 'shiki-twoslash';
import {runTwoSlash} from 'shiki-twoslash';
+import {ModuleKind, ScriptTarget} from 'typescript';
/**
* Keeps a cache of the JSON responses to a twoslash call in node_modules/.cache/twoslash
@@ -13,21 +14,6 @@ export const cachedTwoslashCall = (
lang: string,
settings: UserConfigSettings,
): TwoSlashReturn => {
- const isWebWorker =
- typeof self !== 'undefined' &&
- // @ts-expect-error
- typeof self.WorkerGlobalScope !== 'undefined';
- const isBrowser =
- isWebWorker ||
- (typeof window !== 'undefined' &&
- typeof window.document !== 'undefined' &&
- typeof fetch !== 'undefined');
-
- if (isBrowser) {
- // Not in Node, run un-cached
- return runTwoSlash(code, lang, settings);
- }
-
const {createHash} = require('crypto');
const {readFileSync, existsSync, mkdirSync, writeFileSync} = require('fs');
const {join} = require('path');
@@ -56,7 +42,14 @@ export const cachedTwoslashCall = (
return JSON.parse(readFileSync(cachePath, 'utf8'));
}
- const results = runTwoSlash(code, lang, settings);
+ const results = runTwoSlash(code, lang, {
+ ...settings,
+ defaultCompilerOptions: {
+ ...settings.defaultCompilerOptions,
+ target: ScriptTarget.ESNext,
+ module: ModuleKind.ESNext,
+ },
+ });
if (!existsSync(cacheRoot)) mkdirSync(cacheRoot, {recursive: true});
writeFileSync(cachePath, JSON.stringify(results), 'utf8');
return results;
diff --git a/packages/docusaurus-plugin/src/shiki.ts b/packages/docusaurus-plugin/src/shiki.ts
index 25128095ac..da4abdc1de 100644
--- a/packages/docusaurus-plugin/src/shiki.ts
+++ b/packages/docusaurus-plugin/src/shiki.ts
@@ -90,14 +90,6 @@ export const runTwoSlashOnNode = (
{lang, meta}: {lang: string; meta: Record<string, string>},
settings = {},
) => {
- // Offer a way to do high-perf iterations, this is less useful
- // given that we cache the results of twoslash in the file-system
- const shouldDisableTwoslash =
- typeof process !== 'undefined' &&
- process.env &&
- Boolean(process.env.TWOSLASH_DISABLE);
- if (shouldDisableTwoslash) return undefined;
-
// Only run twoslash when the meta has the attribute twoslash
if (meta.twoslash) {
const importedCode = replaceIncludesInCode(includes, code);