Skip to content

Commit

Permalink
Merge pull request #1386 from remotion-dev/conservative-memory
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBurger committed Oct 10, 2022
2 parents 50d8b22 + 20f8708 commit 40a3704
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/docs/docs/renderer/render-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,12 @@ Using this feature is discouraged. Before using it, we want to make you aware of
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.

## See also

- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/renderer/src/render-media.ts)
Expand Down
12 changes: 10 additions & 2 deletions packages/renderer/src/render-media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export type RenderMediaOptions = {
muted?: boolean;
enforceAudioTrack?: boolean;
ffmpegOverride?: FfmpegOverrideFn;
disallowParallelEncoding?: boolean;
} & ServeUrlOrWebpackBundle &
ConcurrencyOrParallelism;

Expand Down Expand Up @@ -195,7 +196,10 @@ export const renderMedia = ({
height: composition.height,
width: composition.width,
});
const parallelEncoding = hasEnoughMemory && canUseParallelEncoding(codec);
const parallelEncoding =
!options.disallowParallelEncoding &&
hasEnoughMemory &&
canUseParallelEncoding(codec);

if (options.verbose) {
console.log(
Expand All @@ -205,9 +209,13 @@ export const renderMedia = ({
estimatedUsage
);
console.log(
'[PRESTICHER]: Codec supports parallel rendering:',
'[PRESTITCHER]: Codec supports parallel rendering:',
canUseParallelEncoding(codec)
);
console.log(
'[PRESTITCHER]: User disallowed parallel encoding:',
Boolean(options.disallowParallelEncoding)
);
if (parallelEncoding) {
console.log('[PRESTITCHER] Parallel encoding is enabled.');
} else {
Expand Down

1 comment on commit 40a3704

@vercel
Copy link

@vercel vercel bot commented on 40a3704 Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.