packages/docs/docs/media/cache.mdx
@remotion/media keeps an in-memory cache for video and audio decoding.
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, it is not guaranteed that video frames are needed in their natural order.
Decoded media is cached across all instances of <Video> and <Audio>.
Therefore, the decoded media cache is per-render, not per tag.
By default, the decoded media cache may grow to up to 50% of the available system memory. A minimum of 500MB and a maximum of 20GB is enforced.
The rendering APIs allow you to customize the decoded media cache budget on a per-render basis. The same value determines the read cache size for each source:
renderMedia() → mediaCacheSizeInBytesrenderStill() → mediaCacheSizeInBytesselectComposition() → mediaCacheSizeInBytesrenderMediaOnCloudRun() → mediaCacheSizeInBytesrenderStillOnCloudRun() → mediaCacheSizeInBytesgetCompositionsOnLambda() → mediaCacheSizeInBytesrenderMediaOnLambda() → mediaCacheSizeInBytesrenderStillOnLambda() → mediaCacheSizeInBytesgetCompositions() → mediaCacheSizeInBytesrenderFrames() → mediaCacheSizeInBytesnpx remotion benchmark → --media-cache-size-in-bytesnpx remotion compositions → --media-cache-size-in-bytesnpx remotion render → --media-cache-size-in-bytesnpx remotion still → --media-cache-size-in-bytesnpx remotion lambda render → --media-cache-size-in-bytesnpx remotion lambda still → --media-cache-size-in-bytesnpx remotion lambda compositions → --media-cache-size-in-bytesnpx remotion cloudrun render → --media-cache-size-in-bytesnpx remotion cloudrun still → --media-cache-size-in-bytesnpx remotion cloudrun render → --media-cache-size-in-bytes