Skip to main content

Parallel encoding

With parallel encoding, Remotion encodes video frames using FFmpeg while Chromium renders the following frames. Encoding starts as soon as the first frame is available, instead of waiting for all frames to be rendered.

After the frames have been encoded, Remotion combines the video and any audio into the final output file.

When it is enabled​

From v4.0.534, parallel encoding is enabled by default.

GIFs, audio-only renders, stills and image sequences do not use parallel encoding. GIF encoding needs a color palette generated from all frames before encoding can start.

This applies to server-side rendering, including Remotion Lambda and Cloud Run. Client-side rendering uses a different rendering pipeline, but also encodes while rendering.

Parallel encoding is independent of rendering concurrency: it also works with a single browser tab. On Lambda, it runs within each render chunk.

Performance and memory​

Overlapping frame rendering and encoding can reduce the total render time. The benefit depends on your composition, encoder and machine.

The browser and FFmpeg need memory at the same time, which can increase peak memory usage. If your render runs out of memory, disable parallel encoding to render all frames before starting the encoder. This may make rendering slower.

From our empirical testing, we find that the added memory need is around 30-80MB for a 1080p video.

From v4.0.533, Remotion no longer disables parallel encoding automatically based on the available memory.

Shared-memory capture​

On supported platforms, parallel encoding enables shared-memory capture by default. Frames are passed directly to FFmpeg as bitmaps, avoiding the extra JPEG or PNG compression step.

Parallel encoding also works with regular JPEG or PNG screenshots on other platforms. Your selected video codec and encoding settings still apply.

To keep parallel encoding enabled while opting out of shared-memory capture, use disableSharedMemoryCapture.

Check whether it is enabled​

Render with verbose logging:

Check parallel encoding
npx remotion render MyComp --log=verbose

Look for Parallel encoding is enabled. or Parallel encoding is disabled. in the logs. With renderMedia(), set logLevel: "verbose" to see the same messages.

Shared-memory capture has a separate log message.

Disable parallel encoding​

For CLI renders, pass --disallow-parallel-encoding:

Render frames before encoding
npx remotion render MyComp --disallow-parallel-encoding

With renderMedia(), set disallowParallelEncoding: true.

For CLI and Studio renders, you can also use Config.setDisallowParallelEncoding():

remotion.config.ts
import {Config} from '@remotion/cli/config'; Config.setDisallowParallelEncoding(true);

Disabling parallel encoding also disables shared-memory capture. Lambda and Cloud Run currently do not expose this option.

See also​