Skip to content

πŸŽ₯ Make videos programmatically with React

cool

Jonny Burger5fee64eb3d77
diff --git a/packages/docs/components/AudioWaveformExamples.tsx b/packages/docs/components/AudioWaveformExamples.tsx
index 0b69477269..348767e1fb 100644
--- a/packages/docs/components/AudioWaveformExamples.tsx
+++ b/packages/docs/components/AudioWaveformExamples.tsx
@@ -1,180 +1,180 @@
-import { Player } from "@remotion/player";
import {
- smoothenSvgPath,
- useAudioData,
- visualizeAudioWaveform,
-} from "@remotion/media-utils";
-import React from "react";
-import { AbsoluteFill, Audio, useCurrentFrame, useVideoConfig } from "remotion";
-import voice from "./voice-short.mp3";
+ smoothenSvgPath,
+ useAudioData,
+ visualizeAudioWaveform,
+} from '@remotion/media-utils';
+import {Player} from '@remotion/player';
+import React from 'react';
+import {AbsoluteFill, Audio, useCurrentFrame, useVideoConfig} from 'remotion';
+import voice from './voice-short.mp3';
const BaseExample: React.FC = () => {
- const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
- const audioDataVoice = useAudioData(voice);
- const { width, height } = useVideoConfig();
-
- if (!audioDataVoice) {
- return null;
- }
-
- const waveform = visualizeAudioWaveform({
- fps,
- frame,
- audioData: audioDataVoice,
- numberOfSamples: 32,
- windowInSeconds: 1 / fps,
- channel: 0,
- });
-
- const p = smoothenSvgPath(
- waveform.map((x, i) => {
- return [
- (i / (waveform.length - 1)) * width,
- (x - 0.5) * 300 + height / 2,
- ];
- })
- );
-
- return (
- <div style={{ flex: 1 }}>
- <Audio src={voice} />
- <AbsoluteFill style={{ justifyContent: "center", alignItems: "center" }}>
- <svg
- style={{ backgroundColor: " #0B84F3" }}
- viewBox={`0 0 ${width} ${height}`}
- width={width}
- height={height}
- >
- <path stroke="white" fill="none" strokeWidth={10} d={p as string} />
- </svg>
- </AbsoluteFill>
- </div>
- );
+ const frame = useCurrentFrame();
+ const {fps} = useVideoConfig();
+ const audioDataVoice = useAudioData(voice);
+ const {width, height} = useVideoConfig();
+
+ if (!audioDataVoice) {
+ return null;
+ }
+
+ const waveform = visualizeAudioWaveform({
+ fps,
+ frame,
+ audioData: audioDataVoice,
+ numberOfSamples: 32,
+ windowInSeconds: 1 / fps,
+ channel: 0,
+ });
+
+ const p = smoothenSvgPath({
+ points: waveform.map((x, i) => {
+ return [
+ (i / (waveform.length - 1)) * width,
+ (x - 0.5) * 300 + height / 2,
+ ];
+ }),
+ });
+
+ return (
+ <div style={{flex: 1}}>
+ <Audio src={voice} />
+ <AbsoluteFill style={{justifyContent: 'center', alignItems: 'center'}}>
+ <svg
+ style={{backgroundColor: '#0B84F3'}}
+ viewBox={`0 0 ${width} ${height}`}
+ width={width}
+ height={height}
+ >
+ <path stroke="white" fill="none" strokeWidth={10} d={p as string} />
+ </svg>
+ </AbsoluteFill>
+ </div>
+ );
};
const MovingExample: React.FC = () => {
- const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
- const audioDataVoice = useAudioData(voice);
- const { width, height } = useVideoConfig();
-
- if (!audioDataVoice) {
- return null;
- }
-
- const waveform = visualizeAudioWaveform({
- fps,
- frame,
- audioData: audioDataVoice,
- numberOfSamples: 32,
- windowInSeconds: 10 / fps,
- channel: 0,
- });
-
- const p = smoothenSvgPath(
- waveform.map((x, i) => {
- return [
- (i / (waveform.length - 1)) * width,
- (x - 0.5) * 300 + height / 2,
- ];
- })
- );
-
- return (
- <div style={{ flex: 1 }}>
- <Audio src={voice} />
- <AbsoluteFill style={{ justifyContent: "center", alignItems: "center" }}>
- <svg
- style={{ backgroundColor: "#0B84F3" }}
- viewBox={`0 0 ${width} ${height}`}
- width={width}
- height={height}
- >
- <path stroke="#ffffff" fill="none" strokeWidth={10} d={p as string} />
- </svg>
- </AbsoluteFill>
- </div>
- );
+ const frame = useCurrentFrame();
+ const {fps} = useVideoConfig();
+ const audioDataVoice = useAudioData(voice);
+ const {width, height} = useVideoConfig();
+
+ if (!audioDataVoice) {
+ return null;
+ }
+
+ const waveform = visualizeAudioWaveform({
+ fps,
+ frame,
+ audioData: audioDataVoice,
+ numberOfSamples: 32,
+ windowInSeconds: 10 / fps,
+ channel: 0,
+ });
+
+ const p = smoothenSvgPath({
+ points: waveform.map((x, i) => {
+ return [
+ (i / (waveform.length - 1)) * width,
+ (x - 0.5) * 300 + height / 2,
+ ];
+ }),
+ });
+
+ return (
+ <div style={{flex: 1}}>
+ <Audio src={voice} />
+ <AbsoluteFill style={{justifyContent: 'center', alignItems: 'center'}}>
+ <svg
+ style={{backgroundColor: '#0B84F3'}}
+ viewBox={`0 0 ${width} ${height}`}
+ width={width}
+ height={height}
+ >
+ <path stroke="#ffffff" fill="none" strokeWidth={10} d={p as string} />
+ </svg>
+ </AbsoluteFill>
+ </div>
+ );
};
const PosterizedExample: React.FC = () => {
- const frame = useCurrentFrame();
- const { fps } = useVideoConfig();
- const audioDataVoice = useAudioData(voice);
- const { width, height } = useVideoConfig();
-
- if (!audioDataVoice) {
- return null;
- }
-
- const waveform = visualizeAudioWaveform({
- fps,
- frame: Math.round(frame / 3) * 3,
- audioData: audioDataVoice,
- numberOfSamples: 16,
- windowInSeconds: 1 / fps,
- channel: 0,
- });
-
- const p = smoothenSvgPath(
- waveform.map((x, i) => {
- return [
- (i / (waveform.length - 1)) * width,
- (x - 0.5) * 300 + height / 2,
- ];
- })
- );
-
- return (
- <div style={{ flex: 1 }}>
- <Audio src={voice} />
- <AbsoluteFill style={{ justifyContent: "center", alignItems: "center" }}>
- <svg
- style={{ backgroundColor: " #0B84F3" }}
- viewBox={`0 0 ${width} ${height}`}
- width={width}
- height={height}
- >
- <path stroke="white" fill="none" strokeWidth={10} d={p as string} />
- </svg>
- </AbsoluteFill>
- </div>
- );
+ const frame = useCurrentFrame();
+ const {fps} = useVideoConfig();
+ const audioDataVoice = useAudioData(voice);
+ const {width, height} = useVideoConfig();
+
+ if (!audioDataVoice) {
+ return null;
+ }
+
+ const waveform = visualizeAudioWaveform({
+ fps,
+ frame: Math.round(frame / 3) * 3,
+ audioData: audioDataVoice,
+ numberOfSamples: 16,
+ windowInSeconds: 1 / fps,
+ channel: 0,
+ });
+
+ const p = smoothenSvgPath({
+ points: waveform.map((x, i) => {
+ return [
+ (i / (waveform.length - 1)) * width,
+ (x - 0.5) * 300 + height / 2,
+ ];
+ }),
+ });
+
+ return (
+ <div style={{flex: 1}}>
+ <Audio src={voice} />
+ <AbsoluteFill style={{justifyContent: 'center', alignItems: 'center'}}>
+ <svg
+ style={{backgroundColor: ' #0B84F3'}}
+ viewBox={`0 0 ${width} ${height}`}
+ width={width}
+ height={height}
+ >
+ <path stroke="white" fill="none" strokeWidth={10} d={p as string} />
+ </svg>
+ </AbsoluteFill>
+ </div>
+ );
};
export const AudioWaveFormExample: React.FC<{
- type: "base" | "moving" | "posterized";
-}> = ({ type }) => {
- const component = (() => {
- if (type === "base") {
- return BaseExample;
- }
-
- if (type === "moving") {
- return MovingExample;
- }
-
- if (type === "posterized") {
- return PosterizedExample;
- }
-
- throw new TypeError("oops");
- })();
- return (
- <div>
- <Player
- component={component}
- compositionWidth={2160}
- compositionHeight={1080}
- controls
- durationInFrames={300}
- fps={30}
- style={{
- width: "100%",
- }}
- loop
- />
- </div>
- );
+ readonly type: 'base' | 'moving' | 'posterized';
+}> = ({type}) => {
+ const component = (() => {
+ if (type === 'base') {
+ return BaseExample;
+ }
+
+ if (type === 'moving') {
+ return MovingExample;
+ }
+
+ if (type === 'posterized') {
+ return PosterizedExample;
+ }
+
+ throw new TypeError('oops');
+ })();
+ return (
+ <div>
+ <Player
+ component={component}
+ compositionWidth={2160}
+ compositionHeight={1080}
+ controls
+ durationInFrames={300}
+ fps={30}
+ style={{
+ width: '100%',
+ }}
+ loop
+ />
+ </div>
+ );
};
diff --git a/packages/docs/docs/get-waveform-portion.mdx b/packages/docs/docs/get-waveform-portion.mdx
index 04f5664643..336b8c54cc 100644
--- a/packages/docs/docs/get-waveform-portion.mdx
+++ b/packages/docs/docs/get-waveform-portion.mdx
@@ -37,6 +37,18 @@ _number_
How big you want the result array to be. The function will compress the waveform to fit in `numberOfSamples` data points.
+### `channel`
+
+_number_
+
+Which channel to use. Defaults to 0.
+
+### `outputRange`
+
+_number_
+
+The range of the output values. Either `minus-one-to-one` or `zero-to-one`. Defaults to `zero-to-one`.
+
## Return value
`Bar[]` - An array of objects with the following properties:
diff --git a/packages/docs/docs/visualize-audio-waveform.md b/packages/docs/docs/visualize-audio-waveform.mdx
similarity index 71%
rename from packages/docs/docs/visualize-audio-waveform.md
rename to packages/docs/docs/visualize-audio-waveform.mdx
index 443c929556..87938e4975 100644
--- a/packages/docs/docs/visualize-audio-waveform.md
+++ b/packages/docs/docs/visualize-audio-waveform.mdx
@@ -1,28 +1,25 @@
---
+image: /generated/articles-docs-visualize-audio-waveform.png
title: visualizeAudioWaveform()
id: visualize-audio-waveform
+crumb: '@remotion/media-utils'
---
-import { AudioWaveFormExample } from "../components/AudioWaveformExamples.tsx";
+import {AudioWaveFormExample} from '../components/AudioWaveformExamples.tsx';
_Part of the `@remotion/media-utils`_ package of helper functions.
This function takes in `AudioData` (preferrably fetched by the [`useAudioData()`](/docs/use-audio-data) hook) and processes it in a way that makes visualizing the audio waveform that is playing at the current frame easy.
```tsx twoslash
-import {
- createSmoothSvgPath,
- useAudioData,
- visualizeAudioWaveform,
- AudioData,
-} from "@remotion/media-utils";
-import React from "react";
-import { AbsoluteFill, Audio, useCurrentFrame, useVideoConfig } from "remotion";
-import voice from "./voice-short.mp3";
+import {createSmoothSvgPath, useAudioData, visualizeAudioWaveform, AudioData} from '@remotion/media-utils';
+import React from 'react';
+import {AbsoluteFill, Audio, useCurrentFrame, useVideoConfig} from 'remotion';
+import voice from './voice-short.mp3';
const frame = useCurrentFrame();
const audioData = useAudioData(voice) as AudioData;
-const { fps } = useVideoConfig();
+const {fps} = useVideoConfig();
// ---cut---
const waveform = visualizeAudioWaveform({
@@ -85,19 +82,15 @@ An array of values describing the amplitude of each frequency range. Each value
### Basic example
```tsx twoslash
-import {
- createSmoothSvgPath,
- useAudioData,
- visualizeAudioWaveform,
-} from "@remotion/media-utils";
-import React from "react";
-import { AbsoluteFill, Audio, useCurrentFrame, useVideoConfig } from "remotion";
-import voice from "./voice-short.mp3";
+import {createSmoothSvgPath, useAudioData, visualizeAudioWaveform} from '@remotion/media-utils';
+import React from 'react';
+import {AbsoluteFill, Audio, useCurrentFrame, useVideoConfig} from 'remotion';
+import voice from './voice-short.mp3';
const BaseExample: React.FC = () => {
const frame = useCurrentFrame();
const audioDataVoice = useAudioData(voice);
- const { width, height, fps } = useVideoConfig();
+ const {width, height, fps} = useVideoConfig();
if (!audioDataVoice) {
return null;
@@ -113,23 +106,15 @@ const BaseExample: React.FC = () => {
const p = createSmoothSvgPath(
waveform.map((x, i) => {
- return [
- (i / (waveform.length - 1)) * width,
- (x - 0.5) * 300 + height / 2,
- ];
- })
+ return [(i / (waveform.length - 1)) * width, (x - 0.5) * 300 + height / 2];
+ }),
);
return (
- <div style={{ flex: 1 }}>
+ <div style={{flex: 1}}>
<Audio src={voice} />
- <AbsoluteFill style={{ justifyContent: "center", alignItems: "center" }}>
- <svg
- style={{ backgroundColor: " #0B84F3" }}
- viewBox={`0 0 ${width} ${height}`}
- width={width}
- height={height}
- >
+ <AbsoluteFill style={{justifyContent: 'center', alignItems: 'center'}}>
+ <svg style={{backgroundColor: ' #0B84F3'}} viewBox={`0 0 ${width} ${height}`} width={width} height={height}>
<path stroke="white" fill="none" strokeWidth={10} d={p as string} />
</svg>
</AbsoluteFill>
@@ -139,26 +124,21 @@ const BaseExample: React.FC = () => {
```
<AudioWaveFormExample type="base" />
-<br/>
+<br />
### Sliding effect
By increasing the `windowInSeconds` by tenfold, the audiogram starts moving to the right:
```tsx twoslash {6}
-import {
- createSmoothSvgPath,
- useAudioData,
- visualizeAudioWaveform,
- AudioData,
-} from "@remotion/media-utils";
-import React from "react";
-import { AbsoluteFill, Audio, useCurrentFrame, useVideoConfig } from "remotion";
-import voice from "./voice-short.mp3";
+import {createSmoothSvgPath, useAudioData, visualizeAudioWaveform, AudioData} from '@remotion/media-utils';
+import React from 'react';
+import {AbsoluteFill, Audio, useCurrentFrame, useVideoConfig} from 'remotion';
+import voice from './voice-short.mp3';
const frame = useCurrentFrame();
const audioDataVoice = useAudioData(voice) as AudioData;
-const { fps } = useVideoConfig();
+const {fps} = useVideoConfig();
// ---cut---
const waveform = visualizeAudioWaveform({
@@ -171,26 +151,21 @@ const waveform = visualizeAudioWaveform({
```
<AudioWaveFormExample type="moving" />
-<br/>
+<br />
### Posterizing
By only calculating the waveform every third frame, we make the waveform calmer and generate a cool effect:
```tsx twoslash {3}
-import {
- createSmoothSvgPath,
- useAudioData,
- visualizeAudioWaveform,
- AudioData,
-} from "@remotion/media-utils";
-import React from "react";
-import { AbsoluteFill, Audio, useCurrentFrame, useVideoConfig } from "remotion";
-import voice from "./voice-short.mp3";
+import {createSmoothSvgPath, useAudioData, visualizeAudioWaveform, AudioData} from '@remotion/media-utils';
+import React from 'react';
+import {AbsoluteFill, Audio, useCurrentFrame, useVideoConfig} from 'remotion';
+import voice from './voice-short.mp3';
const frame = useCurrentFrame();
const audioDataVoice = useAudioData(voice) as AudioData;
-const { fps } = useVideoConfig();
+const {fps} = useVideoConfig();
// ---cut---
const waveform = visualizeAudioWaveform({
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 56ecadf86d..e24d215072 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -1,78 +1,680 @@
module.exports = {
- lambdaSidebar: [
+ apiSidebar: [
+ 'api',
{
- type: 'link',
- label: '← Back to main docs',
- href: '/docs',
+ type: 'category',
+ label: 'Command line',
+ link: {
+ type: 'doc',
+ id: 'cli/cli',
+ },
+ collapsed: true,
+ items: [
+ 'cli/studio',
+ 'cli/render',
+ 'cli/still',
+ 'cli/compositions',
+ 'cli/bundle',
+ {
+ type: 'category',
+ label: 'lambda',
+ link: {
+ type: 'doc',
+ id: 'lambda/cli',
+ },
+ items: [
+ 'lambda/cli/sites',
+ 'lambda/cli/functions',
+ 'lambda/cli/render',
+ 'lambda/cli/still',
+ 'lambda/cli/policies',
+ 'lambda/cli/compositions',
+ 'lambda/cli/regions',
+ 'lambda/cli/quotas',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'cloudrun',
+ link: {
+ type: 'doc',
+ id: 'cloudrun/cli',
+ },
+ items: [
+ 'cloudrun/cli/sites',
+ 'cloudrun/cli/services',
+ 'cloudrun/cli/render',
+ 'cloudrun/cli/still',
+ 'cloudrun/cli/permissions',
+ 'cloudrun/cli/regions',
+ ],
+ },
+ 'cli/benchmark',
+ {
+ type: 'category',
+ label: 'browser',
+ link: {
+ type: 'doc',
+ id: 'cli/browser/index',
+ },
+ items: ['cli/browser/ensure'],
+ },
+ 'cli/versions',
+ 'cli/upgrade',
+ 'cli/ffmpeg',
+ 'cli/ffprobe',
+ 'cli/gpu',
+ 'cli/help',
+ ],
+ },
+ 'config',
+ {
+ type: 'html',
+ value:
+ '<hr style="margin-top: 4px; margin-bottom: 4px; border-bottom: none"/>', // The HTML to be rendered
+ defaultStyle: true, // Use the default menu item styling
+ },
+ {
+ type: 'category',
+ label: 'remotion',
+ link: {
+ type: 'doc',
+ id: 'remotion',
+ },
+ items: [
+ 'absolute-fill',
+ 'audio',
+ 'artifact',
+ 'calculate-metadata',
+ 'cancel-render',
+ 'composition',
+ 'continue-render',
+ 'delay-render',
+ 'easing',
+ 'folder',
+ 'freeze',
+ 'get-input-props',
+ 'get-remotion-environment',
+ 'getstaticfiles',
+ 'iframe',
+ 'img',
+ 'interpolate-colors',
+ 'interpolate',
+ 'loop',
+ 'measure-spring',
+ 'offthreadvideo',
+ 'animatedimage',
+ 'prefetch',
+ 'random',
+ 'register-root',
+ 'sequence',
+ 'series',
+ 'spring',
+ 'staticfile',
+ 'still',
+ 'use-buffer-state',
+ 'use-current-frame',
+ 'use-current-scale',
+ 'use-video-config',
+ 'version',
+ 'video',
+ 'watchstaticfile',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/bundler',
+ link: {
+ type: 'doc',
+ id: 'bundler',
+ },
+ items: ['bundle'],
+ },
+ {
+ type: 'category',
+ link: {
+ type: 'doc',
+ id: 'renderer',
+ },
+ label: '@remotion/renderer',
+ items: [
+ 'renderer/get-compositions',
+ 'renderer/select-composition',
+ 'renderer/render-media',
+ 'renderer/render-frames',
+ 'renderer/render-still',
+ 'renderer/stitch-frames-to-video',
+ 'renderer/open-browser',
+ 'renderer/ensure-browser',
+ 'renderer/make-cancel-signal',
+ 'renderer/ensure-ffmpeg',
+ 'renderer/ensure-ffprobe',
+ 'renderer/get-can-extract-frames-fast',
+ 'renderer/get-video-metadata',
+ 'renderer/get-silent-parts',
+ 'renderer/extract-audio',
+ ],
+ },
+ {
+ type: 'category',
+ link: {
+ type: 'doc',
+ id: 'player/installation',
+ },
+
+ label: '@remotion/player',
+ items: [
+ {
+ type: 'link',
+ href: '/docs/player',
+ label: 'Guide + Examples',
+ },
+ 'player/api',
+ 'player/thumbnail',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/gif',
+ link: {
+ type: 'doc',
+ id: 'gif/index',
+ },
+ items: ['gif/gif', 'gif/get-gif-duration-in-seconds', 'gif/preload-gif'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/media-utils',
+ link: {
+ type: 'doc',
+ id: 'media-utils/index',
+ },
+ items: [
+ 'audio-buffer-to-data-url',
+ 'get-audio-data',
+ 'get-audio-duration-in-seconds',
+ 'get-video-metadata',
+ 'get-waveform-portion',
+ 'use-audio-data',
+ 'use-windowed-audio-data',
+ 'visualize-audio',
+ 'get-image-dimensions',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/media-parser',
+ link: {
+ type: 'doc',
+ id: 'media-parser/index',
+ },
+ items: [
+ {
+ type: 'link',
+ href: '/docs/media-parser/metadata',
+ label: 'Guide',
+ },
+ 'media-parser/parse-media',
+ 'media-parser/download-and-parse-media',
+ 'media-parser/media-parser-controller',
+ 'media-parser/has-been-aborted',
+ 'media-parser/node-reader',
+ 'media-parser/fetch-reader',
+ 'media-parser/web-file-reader',
+ 'media-parser/node-writer',
+ ],
+ },
+
+ {
+ type: 'category',
+ label: '@remotion/motion-blur',
+ link: {
+ type: 'doc',
+ id: 'motion-blur/index',
+ },
+ items: [
+ 'motion-blur/trail',
+ 'motion-blur/camera-motion-blur',
+ 'motion-blur/common-mistake',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/lambda',
+ link: {
+ type: 'doc',
+ id: 'lambda/api',
+ },
+ items: [
+ {
+ type: 'link',
+ href: '/docs/lambda/cli',
+ label: 'CLI Reference',
+ },
+ 'lambda/estimateprice',
+ 'lambda/deployfunction',
+ 'lambda/deletefunction',
+ 'lambda/getfunctioninfo',
+ 'lambda/getfunctions',
+ 'lambda/deletesite',
+ 'lambda/deploysite',
+ 'lambda/getawsclient',
+ 'lambda/getregions',
+ 'lambda/getsites',
+ 'lambda/downloadmedia',
+ 'lambda/deleterender',
+ 'lambda/getuserpolicy',
+ 'lambda/getrolepolicy',
+ 'lambda/getcompositionsonlambda',
+ 'lambda/getorcreatebucket',
+ 'lambda/getrenderprogress',
+ 'lambda/presignurl',
+ 'lambda/rendermediaonlambda',
+ 'lambda/renderstillonlambda',
+ 'lambda/simulatepermissions',
+ 'lambda/speculatefunctionname',
+ 'lambda/validatewebhooksignature',
+ 'lambda/approuterwebhook',
+ 'lambda/pagesrouterwebhook',
+ 'lambda/expresswebhook',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/cloudrun',
+ link: {
+ type: 'doc',
+ id: 'cloudrun/api',
+ },
+ items: [
+ {
+ type: 'link',
+ href: '/docs/cloudrun/cli',
+ label: 'CLI Reference',
+ },
+ 'cloudrun/getserviceinfo',
+ 'cloudrun/deployservice',
+ 'cloudrun/deleteservice',
+ 'cloudrun/getservices',
+ 'cloudrun/speculateservicename',
+ 'cloudrun/getregions',
+ 'cloudrun/deploysite',
+ 'cloudrun/deletesite',
+ 'cloudrun/getsites',
+ 'cloudrun/getorcreatebucket',
+ 'cloudrun/rendermediaoncloudrun',
+ 'cloudrun/renderstilloncloudrun',
+ 'cloudrun/testpermissions',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/tailwind',
+ link: {
+ type: 'doc',
+ id: 'tailwind/tailwind',
+ },
+ items: ['tailwind/enable-tailwind'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/tailwind-v4',
+ link: {
+ type: 'doc',
+ id: 'tailwind-v4/overview',
+ },
+ items: ['tailwind-v4/enable-tailwind'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/enable-scss',
+ link: {
+ type: 'doc',
+ id: 'enable-scss/overview',
+ },
+ items: ['enable-scss/enable-scss'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/three',
+ link: {
+ type: 'doc',
+ id: 'three',
+ },
+ items: [
+ 'three-canvas',
+ 'use-video-texture',
+ 'use-offthread-video-texture',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/skia',
+ link: {
+ type: 'doc',
+ id: 'skia/skia',
+ },
+ items: ['skia/enable-skia', 'skia/skia-canvas'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/lottie',
+ link: {
+ type: 'doc',
+ id: 'lottie/lottie-index',
+ },
+ items: [
+ 'lottie/lottie-comp',
+ 'lottie/getlottiemetadata',
+ 'lottie/lottie-staticfile',
+ 'lottie/lottie-remote',
+ 'lottie/lottie-lottiefiles',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/preload',
+ link: {
+ type: 'doc',
+ id: 'preload/preload',
+ },
+ items: [
+ 'preload/preload-video',
+ 'preload/preload-audio',
+ 'preload/preload-image',
+ 'preload/preload-font',
+ 'preload/resolve-redirect',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/paths',
+ link: {
+ type: 'doc',
+ id: 'paths/index',
+ },
+ items: [
+ 'paths/get-length',
+ 'paths/get-point-at-length',
+ 'paths/get-tangent-at-length',
+ 'paths/get-instruction-index-at-length',
+ 'paths/reverse-path',
+ 'paths/normalize-path',
+ 'paths/interpolate-path',
+ 'paths/evolve-path',
+ 'paths/reset-path',
+ 'paths/get-subpaths',
+ 'paths/translate-path',
+ 'paths/warp-path',
+ 'paths/scale-path',
+ 'paths/get-bounding-box',
+ 'paths/extend-viewbox',
+ 'paths/parse-path',
+ 'paths/serialize-instructions',
+ 'paths/reduce-instructions',
+ 'paths/get-parts',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/noise',
+ link: {
+ type: 'doc',
+ id: 'noise/index',
+ },
+ items: ['noise/noise-2d', 'noise/noise-3d', 'noise/noise-4d'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/google-fonts',
+ link: {
+ type: 'doc',
+ id: 'google-fonts/google-fonts',
+ },
+ items: [
+ 'google-fonts/load-font',
+ 'google-fonts/get-available-fonts',
+ 'google-fonts/get-info',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/shapes',
+ link: {
+ type: 'doc',
+ id: 'shapes/index',
+ },
+ items: [
+ 'shapes/rect',
+ 'shapes/triangle',
+ 'shapes/circle',
+ 'shapes/ellipse',
+ 'shapes/star',
+ 'shapes/pie',
+ 'shapes/polygon',
+ 'shapes/make-rect',
+ 'shapes/make-triangle',
+ 'shapes/make-circle',
+ 'shapes/make-ellipse',
+ 'shapes/make-star',
+ 'shapes/make-pie',
+ 'shapes/make-polygon',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/rive',
+ link: {
+ type: 'doc',
+ id: 'rive/index',
+ },
+ items: ['rive/index', 'rive/remotionrivecanvas'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/studio',
+ link: {
+ type: 'doc',
+ id: 'studio/api',
+ },
+ items: [
+ 'studio/get-static-files',
+ 'studio/watch-public-folder',
+ 'studio/watch-static-file',
+ 'studio/write-static-file',
+ 'studio/delete-static-file',
+ 'studio/restart-studio',
+ 'studio/save-default-props',
+ 'studio/seek',
+ 'studio/update-default-props',
+ 'studio/focus-default-props-path',
+ 'studio/reevaluate-composition',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/transitions',
+ link: {
+ type: 'doc',
+ id: 'transitions/index',
+ },
+ items: [
+ 'transitions/transitionseries',
+ 'transitions/use-transition-progress',
+ {
+ type: 'category',
+ label: 'Timings',
+ link: {
+ type: 'doc',
+ id: 'transitions/timings/index',
+ },
+ items: [
+ 'transitions/timings/springtiming',
+ 'transitions/timings/lineartiming',
+ 'transitions/timings/custom',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Presentations',
+ link: {
+ type: 'doc',
+ id: 'transitions/presentations/index',
+ },
+ items: [
+ 'transitions/presentations/fade',
+ 'transitions/presentations/slide',
+ 'transitions/presentations/wipe',
+ 'transitions/presentations/flip',
+ 'transitions/presentations/clock-wipe',
+ 'transitions/presentations/none',
+ {
+ type: 'doc',
+ id: 'transitions/presentations/cube',
+ className: 'pro-item',
+ },
+ 'transitions/presentations/custom',
+ 'transitions/audio-transitions',
+ ],
+ },
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/zod-types',
+ link: {
+ type: 'doc',
+ id: 'zod-types/index',
+ },
+ items: ['zod-types/z-color', 'zod-types/z-textarea'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/layout-utils',
+ link: {
+ type: 'doc',
+ id: 'layout-utils/index',
+ },
+ items: [
+ 'layout-utils/best-practices',
+ 'layout-utils/measure-text',
+ 'layout-utils/fill-text-box',
+ 'layout-utils/fit-text',
+ 'layout-utils/debug',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/animation-utils',
+ link: {
+ type: 'doc',
+ id: 'animation-utils/index',
+ },
+ items: [
+ 'animation-utils/make-transform',
+ 'animation-utils/interpolate-styles',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/animated-emoji',
+ link: {
+ type: 'doc',
+ id: 'animated-emoji/index',
+ },
+ items: [
+ 'animated-emoji/animated-emoji',
+ 'animated-emoji/get-available-emoji',
+ ],
+ },
+ {
+ type: 'category',
+ label: '@remotion/webcodecs',
+ link: {
+ type: 'doc',
+ id: 'webcodecs/index',
+ },
+ items: [
+ {
+ type: 'link',
+ href: '/docs/webcodecs/convert-a-video',
+ label: 'Guide',
+ },
+ 'webcodecs/convert-media',
+ 'webcodecs/webcodecs-controller',
+ 'webcodecs/get-available-containers',
+ 'webcodecs/can-reencode-audio-track',
+ 'webcodecs/can-reencode-video-track',
+ 'webcodecs/can-copy-audio-track',
+ 'webcodecs/can-copy-video-track',
+ 'webcodecs/default-on-audio-track-handler',
+ 'webcodecs/default-on-video-track-handler',
+ 'webcodecs/get-default-audio-codec',
+ 'webcodecs/get-default-video-codec',
+ 'webcodecs/get-available-audio-codecs',
+ 'webcodecs/get-available-video-codecs',
+ ],
},
- 'lambda',
{
- collapsed: false,
type: 'category',
- label: 'CLI',
+ label: '@remotion/captions',
+ link: {
+ type: 'doc',
+ id: 'captions/index',
+ },
items: [
- 'lambda/cli',
- 'lambda/cli/sites',
- 'lambda/cli/functions',
- 'lambda/cli/render',
- 'lambda/cli/still',
- 'lambda/cli/policies',
- 'lambda/cli/regions',
- 'lambda/cli/quotas',
+ 'captions/caption',
+ 'captions/parse-srt',
+ 'captions/serialize-srt',
+ 'captions/create-tiktok-style-captions',
],
},
- 'lambda/setup',
- 'lambda/permissions',
- 'lambda/region-selection',
- 'lambda/concurrency',
- 'lambda/runtime',
- 'lambda/disk-size',
- 'lambda/faq',
- 'lambda/light-client',
- 'lambda/custom-layers',
{
- collapsed: false,
type: 'category',
- label: 'Node.JS APIs',
+ label: '@remotion/install-whisper-cpp',
+ link: {
+ type: 'doc',
+ id: 'install-whisper-cpp/index',
+ },
items: [
- 'lambda/estimateprice',
- 'lambda/deployfunction',
- 'lambda/deletefunction',
- 'lambda/getfunctioninfo',
- 'lambda/getfunctions',
- 'lambda/deletesite',
- 'lambda/deploysite',
- 'lambda/getawsclient',
- 'lambda/getregions',
- 'lambda/getsites',
- 'lambda/downloadmedia',
- 'lambda/getuserpolicy',
- 'lambda/getrolepolicy',
- 'lambda/getorcreatebucket',
- 'lambda/getrenderprogress',
- 'lambda/presignurl',
- 'lambda/rendermediaonlambda',
- 'lambda/renderstillonlambda',
- 'lambda/simulatepermissions',
+ 'install-whisper-cpp/install-whisper-cpp',
+ 'install-whisper-cpp/download-whisper-model',
+ 'install-whisper-cpp/transcribe',
+ 'install-whisper-cpp/to-captions',
+ 'install-whisper-cpp/convert-to-captions',
],
},
- 'lambda/checklist',
{
- collapsed: false,
type: 'category',
- label: 'Troubleshooting',
- items: [
- 'lambda/troubleshooting/permissions',
- 'lambda/troubleshooting/rate-limit',
- ],
+ label: '@remotion/openai-whisper',
+ link: {
+ type: 'doc',
+ id: 'openai-whisper/index',
+ },
+ items: ['openai-whisper/openai-whisper-api-to-captions'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/fonts',
+ link: {
+ type: 'doc',
+
+ id: 'fonts-api/fonts-api',
+ },
+ items: ['fonts-api/load-font'],
+ },
+ {
+ type: 'category',
+ label: '@remotion/licensing',
+ link: {
+ type: 'doc',
+ id: 'licensing/index',
+ },
+ items: ['licensing/register-usage-point', 'licensing/get-usage'],
},
- 'lambda/changelog',
- 'lambda/upgrading',
- 'lambda/uninstall',
],
- someSidebar: [
+ mainSidebar: [
{
- collapsed: false,
type: 'category',
label: 'Getting started',
items: [
@@ -80,180 +682,322 @@ module.exports = {
'the-fundamentals',
'animating-properties',
'reusability',
- 'timeline',
- 'render',
+ 'preview',
],
},
{
type: 'category',
- label: 'Techniques',
- collapsed: false,
+ label: 'Designing visuals',
items: [
+ 'transforms',
'assets',
+ 'layers',
+ 'transitioning',
'using-audio',
'fonts',
+ 'measuring',
'using-randomness',
'audio-visualization',
- 'use-img-and-iframe',
- 'javascript',
- 'data-fetching',
- 'encoding',
- 'transparent-videos',
- 'parametrized-rendering',
- 'dynamic-metadata',
- 'ssr',
- 'webpack',
- 'legacy-babel',
- 'env-variables',
- 'third-party',
- 'stills',
- 'scaling',
+ 'noise-visualization',
+ 'animation-math',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Embedding videos',
+ items: [
+ 'videos/index',
+ 'miscellaneous/snippets/align-duration',
+ 'videos/sequence',
+ 'videos/transparency',
'video-manipulation',
+ 'miscellaneous/snippets/accelerated-video',
+ 'miscellaneous/snippets/jumpcuts',
+ 'miscellaneous/snippets/freeze-portions',
+ 'miscellaneous/snippets/hls',
+ 'video-vs-offthreadvideo',
],
},
{
type: 'category',
- label: 'CLI',
+ label: 'Parameterized videos',
link: {
type: 'doc',
- id: 'cli/cli',
+ id: 'parameterized-rendering',
},
- collapsed: true,
items: [
- 'cli/preview',
- 'cli/render',
- 'cli/still',
- 'cli/compositions',
- {
- type: 'link',
- href: '/docs/lambda/cli',
- label: 'lambda ↗️',
- },
- 'cli/versions',
- 'cli/upgrade',
- 'cli/help',
+ 'passing-props',
+ 'schemas',
+ 'visual-editing',
+ 'data-fetching',
+ 'dynamic-metadata',
+ 'props-resolution',
],
},
- 'config',
+
{
type: 'category',
- label: 'API - Core',
- collapsed: false,
+ label: 'Rendering',
+ link: {
+ type: 'doc',
+ id: 'render',
+ },
items: [
- 'continue-render',
- 'delay-render',
- 'interpolate',
- 'interpolate-colors',
- 'get-input-props',
- 'measure-spring',
- 'random',
- 'register-root',
- 'spring',
- 'staticfile',
- 'use-current-frame',
- 'use-video-config',
- 'audio',
- 'composition',
- 'sequence',
- 'loop',
- 'video',
- 'offthreadvideo',
- 'absolute-fill',
- 'img',
- 'iframe',
- 'freeze',
- 'still',
- 'series',
- 'folder',
- 'easing',
+ 'encoding',
+ 'stills',
+ 'scaling',
+ 'transparent-videos',
+ 'render-as-gif',
+ 'overlay',
+ 'quality',
+ 'dataset-render',
+ 'render-all',
+ 'miscellaneous/video-formats',
+ 'artifacts',
+ 'metadata',
+ 'hardware-acceleration',
],
},
{
type: 'category',
- label: 'API - @remotion/bundler',
- items: ['bundle'],
+ label: 'Studio',
+ items: [
+ 'studio/studio',
+ 'studio/shortcuts',
+ 'studio/quick-switcher',
+ 'studio/deploy-static',
+ 'studio/deploy-server',
+ ],
},
- 'gif',
{
type: 'category',
- label: 'API - @remotion/media-utils',
+ label: 'Server-side rendering',
+ link: {
+ type: 'doc',
+ id: 'ssr',
+ },
items: [
- 'audio-buffer-to-data-url',
- 'get-audio-data',
- 'get-audio-duration-in-seconds',
- 'get-video-metadata',
- 'get-waveform-portion',
- 'use-audio-data',
- 'visualize-audio',
- 'visualize-audio-waveform',
+ 'ssr',
+ 'ssr-node',
+ 'docker',
+ 'miscellaneous/linux-single-process',
+ 'gpu',
+ 'miscellaneous/cloud-gpu',
+ 'miscellaneous/cloud-gpu-docker',
+ 'compare-ssr',
],
},
- {
- type: 'link',
- href: '/docs/lambda',
- label: 'API - @remotion/lambda',
- },
{
type: 'category',
link: {
type: 'doc',
- id: 'player/player',
+ id: 'player/index',
},
- label: 'API - @remotion/player',
+ label: 'Player',
items: [
- 'player/installation',
+ {
+ type: 'link',
+ href: '/docs/player/player',
+ label: 'API Reference',
+ },
'player/examples',
- 'player/api',
'player/scaling',
'player/integration',
'player/autoplay',
+ 'player/current-time',
+ 'troubleshooting/player-flicker',
+ 'player/buffer-state',
'player/preloading',
+ 'player/premounting',
+ 'player/best-practices',
+ 'player/drag-and-drop/index',
+ 'player/custom-controls',
+ 'player/media-keys',
+ 'player/playback-issues',
],
},
+
{
type: 'category',
- label: 'API - @remotion/three',
+ label: 'Lambda',
link: {
type: 'doc',
- id: 'three',
+ id: 'lambda',
},
- items: ['three-canvas', 'use-video-texture'],
+ items: [
+ {
+ type: 'link',
+ href: '/docs/lambda/api',
+ label: 'API Reference',
+ },
+ 'lambda/setup',
+ 'lambda/authentication',
+ 'lambda/permissions',
+ 'lambda/region-selection',
+ 'lambda/concurrency',
+ 'lambda/runtime',
+ 'lambda/disk-size',
+ 'lambda/faq',
+ 'lambda/light-client',
+ 'lambda/custom-layers',
+ 'lambda/custom-destination',
+ 'lambda/checklist',
+ 'lambda/webhooks',
+ 'lambda/cost-example',
+ 'lambda/autodelete',
+ {
+ type: 'category',
+ label: 'Troubleshooting',
+ items: [
+ 'lambda/troubleshooting/debug',
+ 'lambda/troubleshooting/permissions',
+ 'lambda/troubleshooting/rate-limit',
+ 'lambda/troubleshooting/unrecognizedclientexception',
+ 'lambda/troubleshooting/bucket-disallows-acl',
+ 'lambda/troubleshooting/security-token',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Using without IAM users',
+ link: {
+ type: 'doc',
+ id: 'lambda/without-iam/index',
+ },
+ items: [
+ 'lambda/without-iam/index',
+ 'lambda/without-iam/example',
+ 'lambda/without-iam/ec2',
+ ],
+ },
+ 'lambda/php',
+ 'lambda/go',
+ 'lambda/python',
+ 'lambda/ruby',
+ 'lambda/serverless-framework-integration',
+ 'lambda/supabase',
+ 'lambda/r2',
+ 'lambda/insights',
+ 'lambda/multiple-buckets',
+ 'lambda/how-lambda-works',
+ 'lambda/bucket-naming',
+ 'lambda/optimizing-cost',
+ 'lambda/optimizing-speed',
+ 'lambda/limits',
+ 'lambda/changelog',
+ 'lambda/upgrading',
+ 'lambda/uninstall',
+ 'lambda/s3-public-access',
+ 'lambda/naming-convention',
+ ],
},
{
type: 'category',
- label: 'API - @remotion/preload',
+ label: 'Cloud Run',
link: {
type: 'doc',
- id: 'preload/preload',
+ id: 'cloudrun-alpha',
},
items: [
- 'preload/preload-video',
- 'preload/preload-audio',
- 'preload/resolve-redirect',
+ 'cloudrun',
+ 'cloudrun/setup',
+ 'cloudrun/permissions',
+ 'cloudrun/generate-env',
+ 'cloudrun/region-selection',
+ 'cloudrun/checklist',
+ 'cloudrun/instancecount',
+ 'cloudrun/multiple-buckets',
+ 'cloudrun/limits',
+ 'cloudrun/light-client',
+ 'cloudrun/upgrading',
+ 'cloudrun/uninstall',
],
},
{
type: 'category',
+ label: 'Media Parser',
link: {
type: 'doc',
- id: 'renderer',
+ id: 'media-parser/index',
},
- label: 'API - @remotion/renderer',
items: [
- 'renderer/get-compositions',
- 'renderer/render-media',
- 'renderer/render-frames',
- 'renderer/render-still',
- 'renderer/stitch-frames-to-video',
- 'renderer/open-browser',
- 'renderer/make-cancel-signal',
+ {
+ type: 'link',
+ href: '/docs/media-parser/parse-media',
+ label: 'API Reference',
+ },
+ 'media-parser/fields',
+ 'media-parser/metadata',
+ 'media-parser/fast-and-slow',
+ 'media-parser/tags',
+ 'media-parser/format-support',
+ 'media-parser/runtime-support',
+ 'media-parser/pause-resume-abort',
+ 'media-parser/webcodecs',
+ 'media-parser/foreign-file-types',
+ 'media-parser/stream-selection',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'WebCodecs',
+ link: {
+ type: 'doc',
+ id: 'webcodecs/index',
+ },
+ items: [
+ {
+ type: 'link',
+ href: '/docs/webcodecs/convert-media',
+ label: 'API Reference',
+ },
+ 'webcodecs/convert-a-video',
+ 'webcodecs/rotate-a-video',
+ 'webcodecs/resize-a-video',
+ 'webcodecs/fix-mediarecorder-video',
+ 'webcodecs/track-transformation',
+ 'webcodecs/pause-resume-abort',
+ 'webcodecs/telemetry',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Building apps',
+ items: [
+ 'brownfield',
+ 'studio-into-app',
+ 'player-into-remotion-project',
+ 'video-uploads',
+ 'presigned-urls',
+ 'font-picker',
+ 'building-a-timeline',
+ 'multiple-fps',
+ 'angular',
+ 'svelte',
+ 'vue',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Tooling',
+ items: [
+ 'tailwind',
+ 'env-variables',
+ 'webpack',
+ 'legacy-babel',
+ 'javascript',
+ 'third-party',
+ 'miscellaneous/typescript-aliases',
+ 'figma',
+ 'spline',
+ 'after-effects',
],
},
{
type: 'category',
label: 'Troubleshooting',
- collapsed: false,
items: [
+ 'troubleshooting/debug-failed-render',
'timeout',
'target-closed',
'media-playback-error',
@@ -264,24 +1008,230 @@ module.exports = {
'version-mismatch',
'enametoolong',
'slow-method-to-extract-frame',
+ 'wrong-composition-mount',
+ 'staticfile-relative-paths',
+ 'staticfile-remote-urls',
+ 'troubleshooting/background-image',
+ 'troubleshooting/nextjs-image',
+ 'troubleshooting/rosetta',
+ 'troubleshooting/loading-root-component',
+ 'troubleshooting/defaultprops-too-big',
+ 'troubleshooting/could-not-be-parsed-as-a-value-list',
+ 'troubleshooting/broken-fast-refresh',
+ 'troubleshooting/timed-out-page-function',
+ 'troubleshooting/delay-render-proxy',
+ 'troubleshooting/bundling-bundle',
+ 'troubleshooting/browser-launch',
+ 'troubleshooting/sigkill',
+ 'troubleshooting/subpixel-rendering',
+ 'troubleshooting/could-not-find-executable-to-run',
+ 'troubleshooting/stuck-render',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Snippets',
+ items: [
+ 'miscellaneous/snippets/different-segments-at-different-speeds',
+ 'miscellaneous/snippets/player-in-iframe',
+ 'miscellaneous/snippets/use-delay-render',
+ 'miscellaneous/snippets/offthread-video-while-rendering',
+ 'miscellaneous/snippets/combine-compositions',
+ ],
+ },
+ {
+ type: 'link',
+ href: '/docs/api',
+ label: 'API Reference',
+ },
+ 'upgrading',
+ {
+ type: 'link',
+ href: '/docs/recorder',
+ label: 'Recorder',
+ },
+ {
+ type: 'category',
+ label: 'Terminology',
+ link: {
+ type: 'doc',
+ id: 'terminology',
+ },
+ items: [
+ 'terminology/player',
+ 'terminology/studio',
+ 'terminology/concurrency',
+ 'terminology/input-props',
+ 'terminology/cloud-run-url',
+ 'terminology/service-name',
+ 'terminology/entry-point',
+ 'terminology/root-file',
+ 'terminology/remotion-root',
+ 'terminology/public-dir',
+ 'terminology/serve-url',
+ 'terminology/bundle',
+ 'terminology/sequence',
+ 'terminology/composition',
+ ],
+ },
+ 'resources',
+ {
+ type: 'category',
+ label: 'Migration guides',
+ items: [
+ 'react-19',
+ '5-0-migration',
+ '4-0-migration',
+ '3-0-migration',
+ '2-0-migration',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Get help',
+ link: {
+ type: 'doc',
+ id: 'get-help',
+ },
+ items: [
+ {
+ type: 'link',
+ href: '/docs/get-help',
+ label: 'How to get help',
+ },
+ {
+ type: 'link',
+ href: 'https://remotion.dev/discord',
+ label: 'Discord',
+ },
+ {
+ type: 'link',
+ href: 'https://remotion.dev/discord',
+ label: 'GitHub Issues',
+ },
+ 'support',
],
},
{
type: 'category',
label: 'Miscellaneous',
- collapsed: false,
items: [
- 'brownfield',
+ 'security',
'chromium-flags',
- 'video-vs-offthreadvideo',
+ 'miscellaneous/changing-temp-dir',
+ 'miscellaneous/chrome-headless-shell',
+ 'miscellaneous/linux-dependencies',
+ 'gl-options',
+ 'bun',
+ 'deno',
+ 'standalone',
+ 'miscellaneous/emojis',
+ 'media-fragments',
+ 'system-prompt',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'FAQ',
+ items: [
+ 'miscellaneous/render-in-browser',
+ 'miscellaneous/automatic-duration',
+ 'miscellaneous/vercel-functions',
+ 'miscellaneous/render-on-edge',
+ 'miscellaneous/embed-studio',
+ 'miscellaneous/absolute-paths',
+ 'miscellaneous/live-streaming',
+ 'miscellaneous/parse-media-vs-get-video-metadata',
+ 'compare/motion-canvas',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Contributing',
+ items: [
+ 'contributing/index',
+ 'contributing/feature',
+ 'contributing/option',
+ 'contributing/docs',
+ 'contributing/formatting',
+ 'contributing/bounty',
+ 'contributing/rust',
+ 'contributing/presentation',
+ 'authoring-packages',
'prereleases',
- 'gpu',
- 'react-18',
- 'miscellaneous/typescript-aliases',
+ 'contributing/ineligible',
],
},
- '3-0-migration',
- '2-0-migration',
'license',
+ 'acknowledgements',
+ ],
+ recorderSidebar: [
+ {
+ type: 'category',
+ label: 'Recorder',
+ items: [
+ 'recorder/index',
+ 'recorder/before-you-buy',
+ 'recorder/buy',
+ 'recorder/demo',
+ 'recorder/setup',
+ 'recorder/create',
+ {
+ type: 'category',
+ label: 'Record',
+ items: [
+ 'recorder/record/index',
+ 'recorder/record/manually',
+ 'recorder/record/delete',
+ 'recorder/record/cropping',
+ ],
+ },
+ 'recorder/captions',
+ {
+ type: 'category',
+ label: 'Editing',
+ collapsed: false,
+ items: [
+ 'recorder/editing/editing',
+ 'recorder/editing/silence-removal',
+ 'recorder/editing/captions',
+ 'recorder/editing/layout',
+ 'recorder/editing/scenes',
+ 'recorder/editing/endcard',
+ 'recorder/editing/transitions',
+ 'recorder/editing/chapters',
+ 'recorder/editing/music',
+ 'recorder/editing/b-roll',
+ 'recorder/editing/cutting-clips',
+ 'recorder/editing/normalizing-audio',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Exporting',
+ collapsed: false,
+ items: [
+ 'recorder/exporting',
+ 'recorder/lambda-rendering',
+ 'recorder/exporting-subtitles',
+ ],
+ },
+ 'recorder/source-control',
+ 'recorder/external-recordings',
+ 'recorder/upgrading',
+ {
+ type: 'category',
+ label: 'Troubleshooting',
+ items: [
+ 'recorder/troubleshooting/failed-to-execute-get-video-metadata',
+ 'recorder/troubleshooting/cannot-read-properties-of-undefined',
+ ],
+ },
+ 'recorder/roadmap',
+ 'recorder/gear',
+ 'recorder/our-recorder',
+ 'recorder/support',
+ ],
+ },
],
};
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 98ec7ea570..231a39a6dc 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -5336,6 +5336,15 @@ export const articles = [
noAi: false,
slug: 'visual-editing',
},
+ {
+ id: 'visualize-audio-waveform',
+ title: 'visualizeAudioWaveform()',
+ relativePath: 'docs/visualize-audio-waveform.mdx',
+ compId: 'articles-docs-visualize-audio-waveform',
+ crumb: '@remotion/media-utils',
+ noAi: false,
+ slug: 'visualize-audio-waveform',
+ },
{
id: 'visualize-audio',
title: 'visualizeAudio()',
diff --git a/packages/docs/static/generated/articles-docs-visualize-audio-waveform.png b/packages/docs/static/generated/articles-docs-visualize-audio-waveform.png
new file mode 100644
index 0000000000..b4805316fb
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-visualize-audio-waveform.png differ
diff --git a/packages/media-utils/src/create-smooth-svg-path.ts b/packages/media-utils/src/create-smooth-svg-path.ts
index b0b1f79429..2e57cf77ef 100644
--- a/packages/media-utils/src/create-smooth-svg-path.ts
+++ b/packages/media-utils/src/create-smooth-svg-path.ts
@@ -11,7 +11,7 @@ const controlPoint = (
current: [number, number],
previous: [number, number],
next: [number, number],
- reverse: boolean
+ reverse: boolean,
): [number, number] => {
const p = previous || current;
const n = next || current;
@@ -29,7 +29,7 @@ const controlPoint = (
return [x, y];
};
-export const smoothenSvgPath = (points: [number, number][]) => {
+export const createSmoothSvgPath = ({points}: {points: [number, number][]}) => {
return points.reduce(
(acc: string, current: [number, number], i: number, a) => {
if (i === 0) {
@@ -47,6 +47,6 @@ export const smoothenSvgPath = (points: [number, number][]) => {
return `${acc} C ${cp1x},${cp1y} ${cp2x},${cp2y} ${x},${y}`;
},
- ''
+ '',
);
};
diff --git a/packages/media-utils/src/get-waveform-portion.ts b/packages/media-utils/src/get-waveform-portion.ts
index c659d83c44..c07e03d26d 100644
--- a/packages/media-utils/src/get-waveform-portion.ts
+++ b/packages/media-utils/src/get-waveform-portion.ts
@@ -1,3 +1,4 @@
+import {NoReactInternals} from 'remotion/no-react';
import type {SampleOutputRange} from './get-wave-form-samples';
import {getWaveformSamples} from './get-wave-form-samples';
import type {AudioData} from './types';
@@ -25,11 +26,14 @@ const concatArrays = (arrays: Float32Array[]): Float32Array => {
return result;
};
-type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;
-
-function truthy<T>(value: T): value is Truthy<T> {
- return Boolean(value);
-}
+export type GetWaveformPortion = {
+ audioData: AudioData;
+ startTimeInSeconds: number;
+ durationInSeconds: number;
+ numberOfSamples: number;
+ channel?: number;
+ outputRange?: SampleOutputRange;
+};
/*
* @description Takes bulky waveform data (for example fetched by getAudioData()) and returns a trimmed and simplified version of it, for simpler visualization
@@ -40,16 +44,9 @@ export const getWaveformPortion = ({
startTimeInSeconds,
durationInSeconds,
numberOfSamples,
- channel,
+ channel = 0,
outputRange = 'zero-to-one',
-}: {
- audioData: AudioData;
- startTimeInSeconds: number;
- durationInSeconds: number;
- numberOfSamples: number;
- channel: number;
- outputRange?: SampleOutputRange;
-}): Bar[] => {
+}: GetWaveformPortion): Bar[] => {
validateChannel(channel, audioData.numberOfChannels);
const waveform = audioData.channelWaveforms[channel];
@@ -78,7 +75,7 @@ export const getWaveformPortion = ({
padStart,
waveform.slice(clampedStart, clampedEnd),
padEnd,
- ].filter(truthy);
+ ].filter(NoReactInternals.truthy);
const audioBuffer = arrs.length === 1 ? arrs[0] : concatArrays(arrs);
return getWaveformSamples({
diff --git a/packages/media-utils/src/index.ts b/packages/media-utils/src/index.ts
index 041417ea20..491fcf35d6 100644
--- a/packages/media-utils/src/index.ts
+++ b/packages/media-utils/src/index.ts
@@ -1,5 +1,5 @@
export {audioBufferToDataUrl} from './audio-buffer/audio-url-helpers';
-export {smoothenSvgPath} from './create-smooth-svg-path';
+export {createSmoothSvgPath as smoothenSvgPath} from './create-smooth-svg-path';
export {getAudioData} from './get-audio-data';
export {
getAudioDuration,
@@ -11,7 +11,6 @@ export {getVideoMetadata} from './get-video-metadata';
export {getWaveformPortion} from './get-waveform-portion';
export {WaveProbe, probeWaveFile} from './probe-wave-file';
export * from './types';
-export {VideoMetadata} from './types';
export type {AudioData, VideoMetadata as VideoData} from './types';
export {useAudioData} from './use-audio-data';
export {
@@ -20,4 +19,7 @@ export {
useWindowedAudioData,
} from './use-windowed-audio-data';
export {VisualizeAudioOptions, visualizeAudio} from './visualize-audio';
-export {visualizeAudioWaveform} from './visualize-audio-waveform';
+export {
+ VisualizeAudioWaveformOptions,
+ visualizeAudioWaveform,
+} from './visualize-audio-waveform';
diff --git a/packages/media-utils/src/visualize-audio-waveform.ts b/packages/media-utils/src/visualize-audio-waveform.ts
index 26aee6eb35..2d96e8406c 100644
--- a/packages/media-utils/src/visualize-audio-waveform.ts
+++ b/packages/media-utils/src/visualize-audio-waveform.ts
@@ -1,9 +1,10 @@
-import {Bar, getWaveformPortion} from './get-waveform-portion';
-import {AudioData} from './types';
+import type {Bar} from './get-waveform-portion';
+import {getWaveformPortion} from './get-waveform-portion';
+import type {AudioData} from './types';
const cache: {[key: string]: Bar[]} = {};
-type FnParameters = {
+export type VisualizeAudioWaveformOptions = {
audioData: AudioData;
frame: number;
fps: number;
@@ -19,13 +20,13 @@ const visualizeAudioWaveformFrame = ({
numberOfSamples,
windowInSeconds,
channel,
-}: FnParameters) => {
+}: VisualizeAudioWaveformOptions) => {
if (windowInSeconds * audioData.sampleRate < numberOfSamples) {
throw new TypeError(
windowInSeconds +
's audiodata does not have ' +
numberOfSamples +
- ' bars. Increase windowInSeconds or decrease numberOfSamples'
+ ' bars. Increase windowInSeconds or decrease numberOfSamples',
);
}
@@ -49,7 +50,9 @@ const visualizeAudioWaveformFrame = ({
});
};
-export const visualizeAudioWaveform = ({...parameters}: FnParameters) => {
+export const visualizeAudioWaveform = ({
+ ...parameters
+}: VisualizeAudioWaveformOptions) => {
const data = visualizeAudioWaveformFrame(parameters);
return data.map((value) => value.amplitude);
};