π₯ Make videos programmatically with React
document cache size
JonnyBurger2a93e22ccc88
diff --git a/packages/docs/docs/media/audio.mdx b/packages/docs/docs/media/audio.mdxindex d057a5c16d..f71627020b 100644--- a/packages/docs/docs/media/audio.mdx+++ b/packages/docs/docs/media/audio.mdx@@ -199,15 +199,6 @@ By default, if the video cannot be embedded using this tag, [a fallback to `<AudPass this prop to disable the fallback and fail the render instead.-## Setting the cache size--`@remotion/media` keeps a cache of video and audio frames.--By default, the cache may grow to up to 50% of the available system memory.-The rendering APIs allow you to customize this limit on a per-render basis.--See in [`renderMedia()`](/docs/renderer/render-media) for example: [`mediaCacheSizeInBytes`](/docs/renderer/select-composition#mediacachesizeinbytes).-## See also- [Source code for this component](https://github.com/remotion-dev/remotion/blob/main/packages/media/src/audio/audio.tsx)diff --git a/packages/docs/docs/media/cache.mdx b/packages/docs/docs/media/cache.mdxnew file mode 100644index 0000000000..cd19ba8c6c--- /dev/null+++ b/packages/docs/docs/media/cache.mdx@@ -0,0 +1,47 @@+---+title: In-memory cache for @remotion/media+sidebar_label: Cache+crumb: 'API - @remotion/media'+---++[`@remotion/media`](/docs/media) keeps a cache of recently decoded video and audio frames.++## Mechanism++Video streams consist of key frames and delta frames.+In order to decode a delta frame, the last keyframe and all the delta frames since the last keyframe also need to be decoded.++Due to Remotion's [multithreaded rendering and each frame being independent](/docs/flickering), it is not guaranteed that video frames are needed in their natural order.++The cache is shared across all of the instances of [`<Video>`](/docs/video) and [`<Audio>`](/docs/audio).+Therefore, the settings for the cache are per-render, not per tag.++## Default cache size++By default, the cache may grow to up to 50% of the available system memory.++## Customizing the cache size++The rendering APIs allow you to customize this limit on a per-render basis:++- [`renderMedia()` β `mediaCacheSizeInBytes`](/docs/renderer/render-media#mediacachesizeinbytes)+- [`renderStill()` β `mediaCacheSizeInBytes`](/docs/renderer/render-still#mediacachesizeinbytes)+- [`selectComposition()` β `mediaCacheSizeInBytes`](/docs/renderer/select-composition#mediacachesizeinbytes)+- [`renderMediaOnCloudRun()` β `mediaCacheSizeInBytes`](/docs/cloudrun/rendermediaoncloudrun#mediacachesizeinbytes)+- [`renderStillOnCloudRun()` β `mediaCacheSizeInBytes`](/docs/cloudrun/renderstilloncloudrun#mediacachesizeinbytes)+- [`getCompositionsOnLambda()` β `mediaCacheSizeInBytes`](/docs/lambda/getcompositionsonlambda#mediacachesizeinbytes)+- [`renderMediaOnLambda()` β `mediaCacheSizeInBytes`](/docs/lambda/rendermediaonlambda#mediacachesizeinbytes)+- [`renderStillOnLambda()` β `mediaCacheSizeInBytes`](/docs/lambda/renderstillonlambda#mediacachesizeinbytes)+- [`getCompositions()` β `mediaCacheSizeInBytes`](/docs/lambda/get-compositions#mediacachesizeinbytes)+- [`renderFrames()` β `mediaCacheSizeInBytes`](/docs/renderer/render-frames#mediacachesizeinbytes)+- [`npx remotion benchmark` β `--media-cache-size-in-bytes`](/docs/cli/benchmark#--media-cache-size-in-bytes)+- [`npx remotion compositions` β `--media-cache-size-in-bytes`](/docs/cli/compositions#--media-cache-size-in-bytes)+- [`npx remotion render` β `--media-cache-size-in-bytes`](/docs/cli/render#--media-cache-size-in-bytes)+- [`npx remotion still` β `--media-cache-size-in-bytes`](/docs/cli/still#--media-cache-size-in-bytes)+- [`npx remotion lambda render` β `--media-cache-size-in-bytes`](/docs/lambda/cli/render#--media-cache-size-in-bytes)+- [`npx remotion lambda still` β `--media-cache-size-in-bytes`](/docs/lambda/cli/still#--media-cache-size-in-bytes)+- [`npx remotion lambda compositions` β `--media-cache-size-in-bytes`](/docs/lambda/cli/compositions#--media-cache-size-in-bytes)+- [`npx remotion cloudrun render` β `--media-cache-size-in-bytes`](/docs/cli/cloudrun/render#--media-cache-size-in-bytes)+- [`npx remotion cloudrun still` β `--media-cache-size-in-bytes`](/docs/cli/cloudrun/still#--media-cache-size-in-bytes)+- [`npx remotion cloudrun render` β `--media-cache-size-in-bytes`](/docs/cli/cloudrun/render#--media-cache-size-in-bytes)+- [Remotion Studio](/docs/studio): Set the cache size under the "Advanced" tabdiff --git a/packages/docs/docs/media/video.mdx b/packages/docs/docs/media/video.mdxindex bfc4574b68..c4b599e400 100644--- a/packages/docs/docs/media/video.mdx+++ b/packages/docs/docs/media/video.mdx@@ -231,15 +231,6 @@ By default, if the video cannot be embedded using this tag, [a fallback to `<OffPass this prop to disable the fallback and fail the render instead.-## Setting the cache size--`@remotion/media` keeps a cache of video and audio frames.--By default, the cache may grow to up to 50% of the available system memory.-The rendering APIs allow you to customize this limit on a per-render basis.--See in [`renderMedia()`](/docs/renderer/render-media) for example: [`mediaCacheSizeInBytes`](/docs/renderer/select-composition#mediacachesizeinbytes).-## See also- [Source code for this component](https://github.com/remotion-dev/remotion/blob/main/packages/media/src/video/video.tsx)diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.tsindex 069634ea7f..d5da5d3dd3 100644--- a/packages/docs/sidebars.ts+++ b/packages/docs/sidebars.ts@@ -398,7 +398,13 @@ const sidebars: SidebarsConfig = {type: 'doc',id: 'media/index',},- items: ['media/audio', 'media/video', 'media/support', 'media/fallback'],+ items: [+ 'media/audio',+ 'media/video',+ 'media/support',+ 'media/fallback',+ 'media/cache',+ ],},{type: 'category',diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 84026d3bdd..fbdde2bf19 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -3284,6 +3284,15 @@ export const articles = [noAi: false,slug: 'media/audio',},+ {+ id: 'media/fallback',+ title: 'Fallback from @remotion/media to <OffthreadVideo> or <Audio>',+ relativePath: 'docs/media/fallback.mdx',+ compId: 'articles-docs-media-fallback',+ crumb: '@remotion/media',+ noAi: false,+ slug: 'media/fallback',+ },{id: 'media/index',title: '@remotion/media',