packages/docs/docs/media/cache.mdx
@remotion/media keeps a cache of recently decoded video and audio frames.
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.
The cache is shared across all of the instances of <Video> and <Audio>.
Therefore, the settings for the cache are per-render, not per tag.
By default, the 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 this limit on a per-render basis:
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