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 550d2716a92..40ffa56c66f 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 [``](/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--- 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.

-
- Now still images (compositions with a duration of 1 frame) are marked with a special icon. +
+ + Now still images (compositions with a duration of 1 frame) are marked with a special icon. +

For still images, you don't need the timeline, so it will hide itself and give you a bigger canvas.

-
+

## 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.

-
+

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 985d6febe05..256c88b313b 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 = {}; 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
{props.title}
; }; -; +; ``` This is because props must now be an object and satisfy the shape `Record`. @@ -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 26ddfc9c14b..42a309befba 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 ? ( - - ) : null} - - ); + return <>{frame === 0 ? : null}; }; ``` ## Rules of artifacts -1 The asset should only be rendered for one single frame of the video. -Otherwise, the asset will get emitted multiple times.
+1 The asset should only be rendered for one single frame of the video. Otherwise, the asset will get emitted multiple times.
-2 It is possible to emit multiple assets, but they may not have the -same filename.
+2 It is possible to emit multiple assets, but they may not have the same filename. +
-3 For the content prop it is possible to pass a string, or a Uint8Array for binary data. Passing an - Uint8Array - should not be considered faster due to it having to be serialized. +3 For the content prop it is possible to pass a string, or a Uint8Array for binary data. Passing an Uint8Array should not be considered faster due to it having to be serialized.
## 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 14febff930f..dad37ab1203 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 a07846ef68a..4f6b5fb0339 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 f8d5fc35959..1aedc8a8764 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 24551fafe0e..6d034d5e5ba 100644 --- a/packages/docs/docs/cloudrun/deployservice.mdx +++ b/packages/docs/docs/cloudrun/deployservice.mdx @@ -8,12 +8,7 @@ crumb: 'Cloud Run API'

- Cloud Run is in Alpha, which means APIs - may change in any version and documentation is not yet finished. See the{' '} - - changelog to stay up to date with breaking changes - - . + Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

@@ -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 a9e704c0b08..f84bcef4e4d 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 6a3617d1c55..96e77600456 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 30a2589db2c..ee20a2d3a42 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 3bbf92f5541..ec40d10c481 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 e184c6c2bb2..ef93cad8f33 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 71860e83665..ef92399f80e 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 645d9c6cc28..89674d6b485 100644 --- a/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx +++ b/packages/docs/docs/cloudrun/rendermediaoncloudrun.mdx @@ -7,12 +7,7 @@ crumb: 'Cloud Run API'

- Cloud Run is in Alpha, which means APIs - may change in any version and documentation is not yet finished. See the{' '} - - changelog to stay up to date with breaking changes - - . + Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

@@ -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 b408b51e939..d05e233868e 100644 --- a/packages/docs/docs/cloudrun/renderstilloncloudrun.mdx +++ b/packages/docs/docs/cloudrun/renderstilloncloudrun.mdx @@ -7,12 +7,7 @@ crumb: 'Cloud Run API'

- Cloud Run is in Alpha, which means APIs - may change in any version and documentation is not yet finished. See the{' '} - - changelog to stay up to date with breaking changes - - . + Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

@@ -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 2a874a62ccd..990c298b87f 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'; -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

## 1. Install `@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 ``` -
+
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. + @@ -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 🚀 + 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 c7b7b7dd7a9..674ef6b01ed 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 6e89a675216..ff591eebf20 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' --- -

Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes.

+

+ Cloud Run is in Alpha, which means APIs may change in any version and documentation is not yet finished. See the changelog to stay up to date with breaking changes. +

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 44f7756bdda..5b190a7ee3d 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'; = ({ name, repo, logo }) => { +export const MyComposition: React.FC = ({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 = ({ 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 (
@@ -143,8 +136,8 @@ export const MyComposition: React.FC = ({ name, repo, logo }) => { />
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 diff --git a/packages/docs/docs/docker.mdx b/packages/docs/docs/docker.mdx index fbc8c6fda4c..794a9ce507c 100644 --- a/packages/docs/docs/docker.mdx +++ b/packages/docs/docs/docker.mdx @@ -54,8 +54,7 @@ CMD ["node", "render.mjs"] ## Line-by-line

- 1 Specify the base image for the Dockerfile. In this case, we use - Debian. + 1 Specify the base image for the Dockerfile. In this case, we use Debian.

```docker @@ -63,9 +62,7 @@ FROM node:22-bookworm-slim ```

- 2 Update the package lists on the Debian system and install the - needed [shared libraries](/docs/miscellaneous/linux-dependencies) for Chrome - Headless Shell. + 2 Update the package lists on the Debian system and install the needed [shared libraries](/docs/miscellaneous/linux-dependencies) for Chrome Headless Shell.

```docker @@ -86,12 +83,8 @@ RUN apt install -y \ ```

- 3 Copy the files from your project. If you have additional source - files, add them here. If some files do not exist, remove them. The{' '} - COPY syntax allows multiple files, but at least one file must - exist. It is assumed package.json, src and{' '} - public exist in your project, but you can adjust this to your - needs. + 3 Copy the files from your project. If you have additional source files, add them here. If some files do not exist, remove them. The COPY syntax allows multiple files, but at least one file must exist. It is assumed package.json, src and{' '} + public exist in your project, but you can adjust this to your needs.

```docker @@ -123,8 +116,7 @@ COPY public ./public ```

- 5 Install [Chrome Headless - Shell](/docs/miscellaneous/chrome-headless-shell). + 5 Install [Chrome Headless Shell](/docs/miscellaneous/chrome-headless-shell).

```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 9b20cd484cf..7027caa6244 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 More info
  • - Remotion's origin is usually http://localhost:3000, but it - may be different if rendering on Lambda or the port is busy. + Remotion's origin is usually http://localhost:3000, but it may be different if rendering on Lambda or the port is busy.
  • 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.
  • - You can{' '} - disable CORS{' '} - during renders. + You can disable CORS during renders.
@@ -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 e4de49e4968..c5d7266c7ca 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 e68c62a9245..8949973941e 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 079dc8933e7..952953f1693 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 14db3c2e9ed..04f56646432 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 314be8342be..52c2868b5c0 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).
-More info -
    -
  • -Remotion's origin is usually http://localhost:3000, but it may be different if rendering on Lambda or the port is busy. -
  • -
  • -You can disable CORS during renders. -
  • -
+ More info +
    +
  • + Remotion's origin is usually http://localhost:3000, but it may be different if rendering on Lambda or the port is busy. +
  • +
  • + You can disable CORS during renders. +
  • +
::: @@ -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 b3ccb1acfe0..b4d26842b7f 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 09119d25f19..877a24fd9d1 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 cfca2878c30..b6187bd43b8 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 50a91873470..6f283f3ba0f 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() @@ -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 d71312a4bdb..081ff868e85 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 e5300b3109f..bef26550a6a 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 = { 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 db71171a9f2..275c7a0cbd0 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: -1 Enable the lifecycle rules on the AWS bucket.
+1 Enable the lifecycle rules on the AWS bucket.
2 Render a video with the deleteAfter 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. -
+
2 Enable the lifecycle rules 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 ```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);
- -Verify that it worked - -

In your S3 bucket, under "Management", you should see 4 lifecycle rules.

- + Verify that it worked +

In your S3 bucket, under "Management", you should see 4 lifecycle rules.

+
-
+
## Trigger a render with expiration @@ -110,19 +106,16 @@ npx remotion lambda render testbed-v6 react-svg --delete-after="1-day" ```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({ ```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 -

-All files should have an expiration rule and expiration date set when viewing the object properties. -

+

All files should have an expiration rule and expiration date set when viewing the object properties.

-
-
+
+
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 a80254337b4..17bb5cd203e 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` - -Enable the [upcoming v5 runtime](/docs/lambda/runtime#runtime-changes-in-remotion-50) with newer Chrome and Node versions early. - ### `--vpc-subnet-ids` 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 df4465f6494..094b17f2e03 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: "", - secretAccessKey: "", + endpoint: 'https://fra1.digitaloceanspaces.com', + accessKeyId: '', + secretAccessKey: '', }, }, }); diff --git a/packages/docs/docs/lambda/deletefunction.mdx b/packages/docs/docs/lambda/deletefunction.mdx index 3b452bc40e8..a275989c31f 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 21323c0fd54..f4b912380dd 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 daf7fc61d87..631940e729a 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 a70e96d3d3c..6bd0ec218f9 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 ce23e19f2f7..5a4a559a39c 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 66d87fe2a9e..49b025afe93 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 a4a1051b91e..70508440810 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 1e7144b5009..6339abb9d5f 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` - + #### `userAgent` @@ -102,7 +99,7 @@ Specify a specific bucket name to be used. [This is not recommended](/docs/lambd ### `logLevel?` - + 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 fc951debb11..1490ca7e6ae 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?` - + ## Return value diff --git a/packages/docs/docs/lambda/getfunctions.mdx b/packages/docs/docs/lambda/getfunctions.mdx index 22fa49124d5..ad565e6fc99 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?` - + ### `compatibleOnly` diff --git a/packages/docs/docs/lambda/getorcreatebucket.mdx b/packages/docs/docs/lambda/getorcreatebucket.mdx index 3c84df0129f..f6bc83e134a 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` - + ### ~~`onBucketEnsured?`~~ diff --git a/packages/docs/docs/lambda/getregions.mdx b/packages/docs/docs/lambda/getregions.mdx index 112f3f06a6d..b9a0291fb29 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 a22b407ef82..b7cda239b8e 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 a287a1b1981..73cc429ce03 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 dc078a4db29..a87eec22b55 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 @@ -11,7 +11,7 @@ You may enable [AWS Lambda Insights](https://docs.aws.amazon.com/AmazonCloudWatc ## Prerequisites -1 Ensure you are on at least Remotion v4.0.61.
+1 Ensure you are on at least Remotion v4.0.61.
2 If you started using Remotion before v4.0.61, update both your AWS user permission and AWS role permission, 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 aac3fe6b0ad..34759f0a3b6 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 7b316522054..1c7f689fcaa 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'; diff --git a/packages/docs/docs/lambda/renderstillonlambda.mdx b/packages/docs/docs/lambda/renderstillonlambda.mdx index 7327c3b37fb..e1f020aff0b 100644 --- a/packages/docs/docs/lambda/renderstillonlambda.mdx +++ b/packages/docs/docs/lambda/renderstillonlambda.mdx @@ -257,10 +257,6 @@ _optional - default `false`, deprecated in v4.0_ Deprecated in favor of [`logLevel`](#loglevel). -### `apiKey?` - - - ## 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 a195ff398f3..da2651eb6bd 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'; - + ## 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 fe0d1169537..765f95ee14c 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 262d8b6ccc8..dda321d31b9 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 3593cbaa3b9..1cabd77604c 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:
- - Show full role permissions JSON file for latest Remotion Lambda version - + Show full role permissions JSON file for latest Remotion Lambda version
- 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 7ecdecf0a72..eab6d9d8927 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 02e251c1b1a..fb1ae52ec5b 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 6da698ca989..03f3fd9b341 100644 --- a/packages/docs/docs/media-parser/download-and-parse-media.mdx +++ b/packages/docs/docs/media-parser/download-and-parse-media.mdx @@ -46,10 +46,10 @@ Throw an error to stop the download. import {downloadAndParseMedia} from '@remotion/media-parser'; import {nodeWriter} from '@remotion/media-parser/node-writer'; -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'); } @@ -63,7 +63,7 @@ If an error occurs (including one you've thrown yourself), you can decide what t import {downloadAndParseMedia} from '@remotion/media-parser'; import {nodeWriter} from '@remotion/media-parser/node-writer'; -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 1afc9124006..528e6e6b1c6 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 52c71042b2c..73c2edadacf 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 65fddbfe521..911ac979e1e 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 3193d6e4cc5..5475fa48c44 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 c245a59de7b..4b3630aa4f1 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 390c5429ebf..cc33cc1dd27 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 be0ac5c9a7a..e64ef68e497 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 ddee1dd6b8e..e87ce699669 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 `` 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 3e9fa69d0cf..3d99435ce2e 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 1877fb9ed04..ba4f7684356 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 3a4a76897d3..8a152595f78 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 34f4a2701d5..534a7aa9cd8 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 ( <> - + ); }; @@ -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 78fe717a97d..937b743f335 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 ``. 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 => { +export const uploadWithProgress = ({file, url, onProgress}: {file: File; url: string; onProgress: OnUploadProgress}): Promise => { 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 d6010369144..6e75b3a1597 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 d5e06ec0b3e..8068cc3675a 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 f51a7af3ce1..74f83835077 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() @@ -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?` - + ### `binariesDirectory?` 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 0ce054fd17b..fb59aeb91ab 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 [``](/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 d73569b0440..bbea5fde3b5 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' --- - + # getSilentParts() @@ -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?` - + ### `binariesDirectory?` diff --git a/packages/docs/docs/renderer/get-video-metadata.mdx b/packages/docs/docs/renderer/get-video-metadata.mdx index c4e3de64195..fb323920eaf 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 31a74887c2d..494a0366c25 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 05268d7b9d1..324985bf735 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 f456e341814..db2ae0c99ae 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 ee4f0090597..6c22dde8461 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 b69412255a9..58e07e4ebc6 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:
- 1 Creating a{' '} - Remotion Bundle + 1 Creating a Remotion Bundle
2 Select the composition to render and calculate its metadata
@@ -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 c21866311a8..311ac041b5a 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 '{ ```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 e28a716e5e5..5bc34266df9 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 [`