Skip to content

🎥 Make videos programmatically with React

Merge branch 'main' into pr/1381

Jonny Burgera87bd3d67801
diff --cc packages/docs/docs/renderer/render-media.md
index 52ce3c9e18,de8f84002e..77a1bbecd1
--- a/packages/docs/docs/renderer/render-media.md
+++ b/packages/docs/docs/renderer/render-media.md
@@@ -366,30 -371,12 +371,36 @@@ Using this feature is discouraged. Befo
Before you use this hack, reach out to the Remotion team on [Discord](https://remotion.dev/discord) and ask us if we are open to implement the feature you need in a clean way - we often do implement new features quickly based on users feedback.
:::
+ ### `disallowParallelEncoding`
+
+ _available from v3.2.29_
+
+ Disallows the renderer from doing rendering frames and encoding at the same time. This makes the rendering process more memory-efficient, but possibly slower.
+
+### `onSlowestFrames?`
+
+_available from v3.2.29_
+
+Callback function that gets called right before `renderMedia()` resolves.
+The only argument `slowestFrames` is an array of the 10 slowest frames in the shape of `{frame:<Frame number>, time:<Time to render frame ms>}`. You can use this information to optimise your render times.
+
+```tsx twoslash
+import type { OnSlowestFrames } from "@remotion/renderer";
+
+const onSlowestFrames: OnSlowestFrames = (slowestFrames) => {
+ console.log("The slowest 10 frames are:");
+ for (const slowFrame of slowestFrames) {
+ console.log(`Frame ${slowFrame.frame} (${slowFrame.time}ms)`);
+ }
+};
+```
+
+## Return Value
+
+_since v3.0.26_
+
+If `outputLocation` is not specified or `null`, the return value is a Promise that resolves a `Buffer`. If an output location is specified, the return value is a Promise that resolves no value.
+
## See also
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/renderer/src/render-media.ts)
diff --cc packages/renderer/src/render-media.ts
index 75c03031d0,dc35a63cb7..b6da96345d
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@@ -100,7 -94,7 +100,8 @@@ export type RenderMediaOptions =
muted?: boolean;
enforceAudioTrack?: boolean;
ffmpegOverride?: FfmpegOverrideFn;
+ onSlowestFrames?: OnSlowestFrames;
+ disallowParallelEncoding?: boolean;
} & ServeUrlOrWebpackBundle &
ConcurrencyOrParallelism;