Skip to content

🎥 Make videos programmatically with React

chore: ref doc links from <Loop /> through @remotion/media-utils

kaf-lamed-beyt68e622428fc5
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.ts
index 65f76fdf6a..afdc3e18dc 100644
--- a/packages/bundler/src/bundle.ts
+++ b/packages/bundler/src/bundle.ts
@@ -147,6 +147,10 @@ const validateEntryPoint = async (entryPoint: string) => {
}
};
+/**
+ * the method bundles a Remotion project using Webpack and prepares it for rendering using renderMedia()
+ * @see [Documentation](https://www.remotion.dev/docs/bundle)
+ */
export async function bundle(...args: Arguments): Promise<string> {
const actualArgs = convertArgumentsIntoOptions(args);
const entryPoint = path.resolve(process.cwd(), actualArgs.entryPoint);
diff --git a/packages/core/src/AbsoluteFill.tsx b/packages/core/src/AbsoluteFill.tsx
index 2843df871c..2d8191043d 100644
--- a/packages/core/src/AbsoluteFill.tsx
+++ b/packages/core/src/AbsoluteFill.tsx
@@ -25,6 +25,7 @@ const AbsoluteFillRefForwarding: React.ForwardRefRenderFunction<
/**
* An absolutely positioned <div> element with 100% width, height, and a column flex style
- * @link https://www.remotion.dev/docs/absolute-fill
+ * @see [Documentation](https://www.remotion.dev/docs/absolute-fill)
*/
+
export const AbsoluteFill = forwardRef(AbsoluteFillRefForwarding);
diff --git a/packages/core/src/Folder.tsx b/packages/core/src/Folder.tsx
index 9b31214903..1706f1593c 100644
--- a/packages/core/src/Folder.tsx
+++ b/packages/core/src/Folder.tsx
@@ -19,6 +19,10 @@ export const FolderContext = createContext<FolderContextType>({
parentName: null,
});
+/**
+ * By wrapping a <Composition /> inside a <Folder />, you can visually categorize it in your sidebar, should you have many compositions.
+ * @see [Documentation](https://www.remotion.dev/docs/folder)
+ */
export const Folder: FC<{name: string; children: React.ReactNode}> = ({
name,
children,
diff --git a/packages/core/src/IFrame.tsx b/packages/core/src/IFrame.tsx
index c98e234718..e4ce5bb87d 100644
--- a/packages/core/src/IFrame.tsx
+++ b/packages/core/src/IFrame.tsx
@@ -39,4 +39,8 @@ const IFrameRefForwarding: React.ForwardRefRenderFunction<
return <iframe {...props} ref={ref} onError={didGetError} onLoad={didLoad} />;
};
+/**
+ * The <IFrame /> can be used like a regular <iframe> HTML tag.
+ * @see [Documentation](https://www.remotion.dev/docs/iframe)
+ */
export const IFrame = forwardRef(IFrameRefForwarding);
diff --git a/packages/core/src/Img.tsx b/packages/core/src/Img.tsx
index bdad354aeb..b16475d867 100644
--- a/packages/core/src/Img.tsx
+++ b/packages/core/src/Img.tsx
@@ -80,4 +80,8 @@ const ImgRefForwarding: React.ForwardRefRenderFunction<
);
};
+/**
+ * Works just like a regular HTML img tag. When you use the <Img> tag, Remotion will ensure that the image is loaded before rendering the frame.
+ * @see [Documentation](https://www.remotion.dev/docs/img)
+ */
export const Img = forwardRef(ImgRefForwarding);
diff --git a/packages/core/src/Still.tsx b/packages/core/src/Still.tsx
index 6d41d4a579..e8c19912ef 100644
--- a/packages/core/src/Still.tsx
+++ b/packages/core/src/Still.tsx
@@ -1,6 +1,11 @@
import type {StillProps} from './Composition.js';
import {Composition} from './Composition.js';
+/**
+ * A <Still /> is a <Composition /> that is only 1 frame long.
+ * @see [Documentation](https://www.remotion.dev/docs/still)
+ */
+
export const Still = <T,>(props: StillProps<T>) => {
return <Composition fps={1} durationInFrames={1} {...props} />;
};
diff --git a/packages/core/src/easing.ts b/packages/core/src/easing.ts
index 3b7fa37088..95ee259336 100644
--- a/packages/core/src/easing.ts
+++ b/packages/core/src/easing.ts
@@ -2,6 +2,10 @@
import {bezier} from './bezier.js';
+/**
+ * The Easing module implements common easing functions. You can use it with the interpolate() API.
+ * @see [Documentation](https://www.remotion.dev/docs/easing)
+ */
export class Easing {
static step0(n: number): number {
return n > 0 ? 1 : 0;
diff --git a/packages/core/src/freeze.tsx b/packages/core/src/freeze.tsx
index 19fda7e41d..7d8b2bf0b0 100644
--- a/packages/core/src/freeze.tsx
+++ b/packages/core/src/freeze.tsx
@@ -8,6 +8,10 @@ type FreezeProps = {
children: React.ReactNode;
};
+/**
+ * This method freezes all of its children to the frame that you specify as a prop
+ * @see [Documentation](https://www.remotion.dev/docs/freeze)
+ */
export const Freeze: React.FC<FreezeProps> = ({frame, children}) => {
if (typeof frame === 'undefined') {
throw new Error(
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 423e6b5d79..b0bb7b0a5d 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -92,8 +92,17 @@ export * from './version.js';
export * from './video';
export * from './video-config.js';
+
export const Experimental = {
+ /**
+ * This is a special component that will cause Remotion to only partially capture the frame of the video.
+ * @see [Documentation](https://www.remotion.dev/docs/clipper)
+ */
Clipper,
+ /**
+ * This is a special component, that, when rendered, will skip rendering the frame altogether.
+ * @see [Documentation](https://www.remotion.dev/docs/null)
+ */
Null,
useIsPlayer,
};
diff --git a/packages/core/src/series/index.tsx b/packages/core/src/series/index.tsx
index 4fd3abc58f..7092247318 100644
--- a/packages/core/src/series/index.tsx
+++ b/packages/core/src/series/index.tsx
@@ -25,6 +25,10 @@ const SeriesSequenceRefForwardingFunction: React.ForwardRefRenderFunction<
const SeriesSequence = forwardRef(SeriesSequenceRefForwardingFunction);
+/**
+ * with this component, you can easily stitch together scenes that should play sequentially after another.
+ * @see [Documentation](https://www.remotion.dev/docs/series)
+ */
const Series: FC<{
children: React.ReactNode;
}> & {
diff --git a/packages/core/src/video/OffthreadVideo.tsx b/packages/core/src/video/OffthreadVideo.tsx
index 103763a0f7..40895ed839 100644
--- a/packages/core/src/video/OffthreadVideo.tsx
+++ b/packages/core/src/video/OffthreadVideo.tsx
@@ -8,6 +8,10 @@ import {OffthreadVideoForRendering} from './OffthreadVideoForRendering.js';
import type {OffthreadVideoProps, RemotionMainVideoProps} from './props.js';
import {VideoForDevelopment} from './VideoForDevelopment.js';
+/**
+ * This method imports and displays a video, similar to <Video />. During rendering, it extracts the exact frame from the video and displays it in an <img> tag
+ * @see [Documentation](https://www.remotion.dev/docs/offthreadvideo)
+ */
export const OffthreadVideo: React.FC<
Omit<OffthreadVideoProps & RemotionMainVideoProps, 'loop'>
> = (props) => {
diff --git a/packages/core/src/video/Video.tsx b/packages/core/src/video/Video.tsx
index a5057a4337..48a5b4b59f 100644
--- a/packages/core/src/video/Video.tsx
+++ b/packages/core/src/video/Video.tsx
@@ -94,4 +94,8 @@ const forward = forwardRef as <T, P = {}>(
) => React.ReactElement | null
) => (props: P & React.RefAttributes<T>) => React.ReactElement | null;
+/**
+ * allows you to include a video file in your Remotion project. It wraps the native HTMLVideoElement.
+ * @see [Documentation](https://www.remotion.dev/docs/video)
+ */
export const Video = forward(VideoForwardingFunction);
diff --git a/packages/gif/src/Gif.tsx b/packages/gif/src/Gif.tsx
index 49f2403422..3c91d9c9e4 100644
--- a/packages/gif/src/Gif.tsx
+++ b/packages/gif/src/Gif.tsx
@@ -3,6 +3,11 @@ import {GifForDevelopment} from './GifForDevelopment';
import {GifForRendering} from './GifForRendering';
import type {RemotionGifProps} from './props';
+/**
+ * Displays a GIF that synchronizes with Remotions useCurrentFrame().
+ * part of @remotion/gif
+ * @see [Documentation](https://www.remotion.dev/docs/gif/gif)
+ */
export const Gif = (props: RemotionGifProps) => {
const env = Internals.useRemotionEnvironment();
if (env === 'rendering') {
diff --git a/packages/gif/src/get-gif-duration-in-seconds.ts b/packages/gif/src/get-gif-duration-in-seconds.ts
index 9fe984abb7..7b453cf1ff 100644
--- a/packages/gif/src/get-gif-duration-in-seconds.ts
+++ b/packages/gif/src/get-gif-duration-in-seconds.ts
@@ -9,6 +9,11 @@ const calcDuration = (parsed: GifState) => {
);
};
+/**
+ * Gets the duration in seconds of a GIF
+ * part of @remotion/gif
+ * @see [Documentation](https://www.remotion.dev/docs/gif/get-gif-duration-in-seconds)
+ */
export const getGifDurationInSeconds = async (src: string) => {
const resolvedSrc = new URL(src, window.location.origin).href;
const inCache =
diff --git a/packages/gif/src/preload-gif.ts b/packages/gif/src/preload-gif.ts
index abc5225dc8..1878c838b4 100644
--- a/packages/gif/src/preload-gif.ts
+++ b/packages/gif/src/preload-gif.ts
@@ -2,6 +2,11 @@ import {manuallyManagedGifCache, volatileGifCache} from './gif-cache';
import {parseWithWorker} from './react-tools';
import {resolveGifSource} from './resolve-gif-source';
+/**
+ * Returns an object with two entries: waitUntilDone() that returns a Promise which can be awaited and free() which will cancel preloading or free up the memory if the GIF is not being used anymore.
+ * part of @remotion/gif
+ * @see [Documentation](https://www.remotion.dev/docs/gif/preload-gif)
+ */
export const preloadGif = (
src: string
): {
diff --git a/packages/media-utils/src/audio-buffer/audio-url-helpers.ts b/packages/media-utils/src/audio-buffer/audio-url-helpers.ts
index 74cd79daa6..39a2936a2d 100644
--- a/packages/media-utils/src/audio-buffer/audio-url-helpers.ts
+++ b/packages/media-utils/src/audio-buffer/audio-url-helpers.ts
@@ -1,5 +1,10 @@
import {audioBufferToWav} from './audio-buffer-to-wav';
+/**
+ * This API takes an AudioBuffer instance and converts it to a Base 64 Data URL so it can be passed to an <Audio /> tag.
+ * part of @remotion/media-utils
+ * @see [Documentation](https://www.remotion.dev/docs/audio-buffer-to-data-url)
+ */
export const audioBufferToDataUrl = (buffer: AudioBuffer) => {
const wavAsArrayBuffer = audioBufferToWav(buffer, {
float32: true,
diff --git a/packages/media-utils/src/get-audio-data.ts b/packages/media-utils/src/get-audio-data.ts
index d123bf8389..41874834f9 100644
--- a/packages/media-utils/src/get-audio-data.ts
+++ b/packages/media-utils/src/get-audio-data.ts
@@ -66,6 +66,11 @@ const fn = async (src: string): Promise<AudioData> => {
return metadata;
};
+/**
+ * Takes an audio src, loads it and returns data and metadata for the specified source.
+ * part of @remotion/media-utils
+ * @see [Documentation](https://www.remotion.dev/docs/get-audio-data)
+ */
export const getAudioData = (src: string) => {
return limit(fn, src);
};
diff --git a/packages/media-utils/src/get-audio-duration-in-seconds.ts b/packages/media-utils/src/get-audio-duration-in-seconds.ts
index e40825c62e..cb5b462064 100644
--- a/packages/media-utils/src/get-audio-duration-in-seconds.ts
+++ b/packages/media-utils/src/get-audio-duration-in-seconds.ts
@@ -43,6 +43,7 @@ const fn = (src: string): Promise<number> => {
* @async
* @param src path to the audio file
* @return {number} duration of the audio file in seconds
+ * @see [Documentation](https://www.remotion.dev/docs/get-audio-duration-in-seconds)
*/
export const getAudioDurationInSeconds = (src: string) => {
return limit(fn, src);
diff --git a/packages/media-utils/src/get-video-metadata.ts b/packages/media-utils/src/get-video-metadata.ts
index c762e7cd82..2d46b6e3ae 100644
--- a/packages/media-utils/src/get-video-metadata.ts
+++ b/packages/media-utils/src/get-video-metadata.ts
@@ -55,6 +55,11 @@ const fn = (src: string): Promise<VideoMetadata> => {
});
};
+/**
+ * Takes a src to a video, loads it and returns metadata for the specified source.
+ * part of @remotion/media-utils
+ * @see [Documentation](https://www.remotion.dev/docs/get-video-metadata)
+ */
export const getVideoMetadata = (src: string) => {
return limit(fn, src);
};
diff --git a/packages/media-utils/src/get-waveform-portion.ts b/packages/media-utils/src/get-waveform-portion.ts
index 351dbefc94..7460c61c92 100644
--- a/packages/media-utils/src/get-waveform-portion.ts
+++ b/packages/media-utils/src/get-waveform-portion.ts
@@ -6,6 +6,11 @@ type Bar = {
amplitude: number;
};
+/**
+ * Takes bulky waveform data (for example fetched by getAudioData()) and returns a trimmed and simplified version of it, for simpler visualization.
+ * part of @remotion/media-utils
+ * @see [Documentation](https://www.remotion.dev/docs/get-waveform-portion)
+ */
export const getWaveformPortion = ({
audioData,
startTimeInSeconds,
diff --git a/packages/media-utils/src/use-audio-data.ts b/packages/media-utils/src/use-audio-data.ts
index 8ac474ea90..ef4a9a8c0f 100644
--- a/packages/media-utils/src/use-audio-data.ts
+++ b/packages/media-utils/src/use-audio-data.ts
@@ -3,6 +3,13 @@ import {continueRender, delayRender} from 'remotion';
import {getAudioData} from './get-audio-data';
import type {AudioData} from './types';
+/**
+ * Wraps the getAudioData() function into a hook and does 3 things:
+ * Keeps the audio data in a state
+ * Wraps the function in a delayRender() / continueRender() pattern.
+ * Handles the case where the component gets unmounted while the fetching is in progress and a React error is thrown.
+ * @see [Documentation](https://www.remotion.dev/docs/use-audio-data)
+ */
export const useAudioData = (src: string): AudioData | null => {
if (!src) {
throw new TypeError("useAudioData requires a 'src' parameter");
diff --git a/packages/media-utils/src/visualize-audio.ts b/packages/media-utils/src/visualize-audio.ts
index a05635be88..ab3023dc26 100644
--- a/packages/media-utils/src/visualize-audio.ts
+++ b/packages/media-utils/src/visualize-audio.ts
@@ -11,6 +11,11 @@ type FnParameters = {
numberOfSamples: number;
};
+/**
+ * Takes in AudioData (preferably fetched by the useAudioData() hook) and processes it in a way that makes visualizing the audio that is playing at the current frame easy.
+ * part of @remotion/media-utils
+ * @see [Documentation](https://www.remotion.dev/docs/visualize-audio)
+ */
const visualizeAudioFrame = ({
audioData: metadata,
frame,
diff --git a/packages/player/src/Player.tsx b/packages/player/src/Player.tsx
index fa378f3647..4b714e1f13 100644
--- a/packages/player/src/Player.tsx
+++ b/packages/player/src/Player.tsx
@@ -370,4 +370,8 @@ const forward = forwardRef as <T, P = {}>(
) => React.ReactElement | null
) => (props: P & React.RefAttributes<T>) => React.ReactElement | null;
+/**
+ * A component which can be rendered in a regular React App (for example: Create React App, Next.js) to display a Remotion video.
+ * @see [Documentation](https://www.remotion.dev/docs/player/player)
+ */
export const Player = forward(PlayerFn);
diff --git a/packages/player/src/Thumbnail.tsx b/packages/player/src/Thumbnail.tsx
index f67f58eb4e..9c84e081fd 100644
--- a/packages/player/src/Thumbnail.tsx
+++ b/packages/player/src/Thumbnail.tsx
@@ -115,4 +115,9 @@ const forward = forwardRef as <T, P = {}>(
) => React.ReactElement | null
) => (props: P & React.RefAttributes<T>) => React.ReactElement | null;
+/**
+ * A component which can be rendered in a regular React App (for example: Create React App, Next.js) to display a single frame of a video.
+ * @see [Documentation](https://www.remotion.dev/docs/player/thumbnail)
+ */
+
export const Thumbnail = forward(ThumbnailFn);
diff --git a/packages/renderer/src/ensure-ffmpeg.ts b/packages/renderer/src/ensure-ffmpeg.ts
index c9ad62bd9a..921bf4043b 100644
--- a/packages/renderer/src/ensure-ffmpeg.ts
+++ b/packages/renderer/src/ensure-ffmpeg.ts
@@ -63,10 +63,20 @@ const ensureFfmpegOrFfprobe = async (
);
};
+/**
+ * Checks if the ffmpeg binary is installed and if it is not, downloads it and puts it into your node_modules folder.
+ * part of @remotion/renderer
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffmpeg)
+ */
export const ensureFfmpeg = (options?: EnsureFfmpegOptions) => {
return ensureFfmpegOrFfprobe('ffmpeg', options);
};
+/**
+ * Checks if the ffprobe binary is installed and if it is not, downloads it and puts it into your node_modules folder.
+ * part of @remotion/renderer
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/ensure-ffprobe)
+ */
export const ensureFfprobe = (options?: EnsureFfmpegOptions) => {
return ensureFfmpegOrFfprobe('ffprobe', options);
};
diff --git a/packages/renderer/src/get-can-extract-frames-fast.ts b/packages/renderer/src/get-can-extract-frames-fast.ts
index 419edca7ef..2838d3b336 100644
--- a/packages/renderer/src/get-can-extract-frames-fast.ts
+++ b/packages/renderer/src/get-can-extract-frames-fast.ts
@@ -8,6 +8,11 @@ import {tryToExtractFrameOfVideoFast} from './try-to-extract-frame-of-video-fast
export const ACCEPTABLE_OFFSET_THRESHOLD = 50;
+/**
+ * Probes whether frames of a video can be efficiently extracted when using <OffthreadVideo>.
+ * part of @remotion/renderer
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/get-can-extract-frames-fast)
+ */
export const getCanExtractFramesFast = async ({
src,
ffmpegExecutable,
diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.ts
index d9c52e5ed1..4278965c45 100644
--- a/packages/renderer/src/get-compositions.ts
+++ b/packages/renderer/src/get-compositions.ts
@@ -89,6 +89,11 @@ const innerGetCompositions = async (
return result as TCompMetadata[];
};
+/**
+ * Gets the compositions defined in a Remotion project based on a webpack bundle.
+ * part of @remotion/renderer
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
+ */
export const getCompositions = async (
serveUrlOrWebpackUrl: string,
config?: GetCompositionsConfig
diff --git a/packages/renderer/src/make-cancel-signal.ts b/packages/renderer/src/make-cancel-signal.ts
index 62133036db..860bdb2790 100644
--- a/packages/renderer/src/make-cancel-signal.ts
+++ b/packages/renderer/src/make-cancel-signal.ts
@@ -2,6 +2,11 @@ type Callback = () => void;
export type CancelSignal = (callback: Callback) => void;
+/**
+ * Returns a signal and a cancel function that allows to you cancel a render triggered using renderMedia(), renderStill(), renderFrames() or stitchFramesToVideo() .
+ * part of @remotion/renderer
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/make-cancel-signal)
+ */
export const makeCancelSignal = (): {
cancelSignal: CancelSignal;
cancel: () => void;
diff --git a/packages/renderer/src/open-browser.ts b/packages/renderer/src/open-browser.ts
index da6c889ba9..f335746537 100644
--- a/packages/renderer/src/open-browser.ts
+++ b/packages/renderer/src/open-browser.ts
@@ -47,6 +47,11 @@ export const killAllBrowsers = async () => {
}
};
+/**
+ * Opens a Chrome or Chromium browser instance.
+ * part of @remotion/renderer
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/open-browser)
+ */
export const openBrowser = async (
browser: Browser,
options?: {
diff --git a/packages/renderer/src/render-frames.ts b/packages/renderer/src/render-frames.ts
index b592cd7d97..f97142b874 100644
--- a/packages/renderer/src/render-frames.ts
+++ b/packages/renderer/src/render-frames.ts
@@ -497,6 +497,11 @@ const innerRenderFrames = ({
type CleanupFn = () => void;
+/**
+ * Renders a series of images using Puppeteer and computes information for mixing audio
+ * part of @remotion/renderer
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/render-frames)
+ */
export const renderFrames = (
options: RenderFramesOptions
): Promise<RenderFramesOutput> => {
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index 2878ca7400..efaed4a6c1 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -147,7 +147,7 @@ const getConcurrency = (others: ConcurrencyOrParallelism) => {
/**
*
* @description Render a video from a composition
- * @link https://www.remotion.dev/docs/renderer/render-media
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
*/
export const renderMedia = ({
proResProfile,
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index 830d8741cb..60f7cdfdcf 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -256,7 +256,7 @@ const innerRenderStill = async ({
/**
*
* @description Render a still frame from a composition
- * @link https://www.remotion.dev/docs/renderer/render-still
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/render-still)
*/
export const renderStill = (
options: RenderStillOptions
diff --git a/packages/renderer/src/stitch-frames-to-video.ts b/packages/renderer/src/stitch-frames-to-video.ts
index a03c4d25fd..6f95865eef 100644
--- a/packages/renderer/src/stitch-frames-to-video.ts
+++ b/packages/renderer/src/stitch-frames-to-video.ts
@@ -482,6 +482,11 @@ export const spawnFfmpeg = async (
};
};
+/**
+ * Takes a series of images and audio information generated by renderFrames() and encodes it to a video.
+ * part of @remotion/renderer
+ * @see [Documentation](https://www.remotion.dev/docs/renderer/stitch-frames-to-video)
+ */
export const stitchFramesToVideo = async (
options: StitcherOptions
): Promise<Buffer | null> => {