Skip to main content

Hardware accelerated encoding

Encoding is the process of converting a sequence of images into a video file.
Besides rendering frames, encoding is one of the two steps required to create a video.

From Remotion v4.0.228, Remotion supports hardware-accelerated encoding in some cases.
Since encoding is platform- and codec-specific, only a few scenarios are supported at the moment.

  • Currently, only macOS is supported (Acceleration using VideoToolbox)
  • Only ProRes is supported

Enable hardware accelerated encoding

By default, hardware acceleration is "disabled".
You can set the hardwareAcceleration option to "if-possible" to enable hardware acceleration if it is available.
If you want the render to fail if hardware acceleration is not possible, set the option to "required".

In SSR APIs

Use the hardwareAcceleration option in the renderMedia() function.

tsx
await renderMedia({
composition,
serveUrl,
codec: 'prores',
outputLocation,
inputProps,
hardwareAcceleration: 'if-possible',
});
tsx
await renderMedia({
composition,
serveUrl,
codec: 'prores',
outputLocation,
inputProps,
hardwareAcceleration: 'if-possible',
});

In the CLI

Use the --hardware-acceleration option in the npx remotion studio command.

bash
npx remotion render MyComp --codec prores --hardware-acceleration if-possible
bash
npx remotion render MyComp --codec prores --hardware-acceleration if-possible

In the Studio

In the Remotion Studio, you can set the hardware acceleration option in the "Advanced" tab when rendering a video.

With the config file

You can set the setHardwareAcceleration() option in the config file.

ts
import {Config} from '@remotion/cli/config';
 
Config.setHardwareAcceleration('if-possible');
ts
import {Config} from '@remotion/cli/config';
 
Config.setHardwareAcceleration('if-possible');

In Remotion Lambda and Cloud Run

These options are not supported in Remotion Lambda and Cloud Run, because those cloud services do not support hardware acceleration.

Tell if hardware acceleration is being used

Run the render with verbose logging. If the render is using hardware acceleration, you will see a log message like this:

Encoder: prores_videotoolbox, hardware accelerated: true
Encoder: prores_videotoolbox, hardware accelerated: true

Don't rely on the exact wording of the log message to determine if hardware acceleration is being used.

See also