Skip to content

🎥 Make videos programmatically with React

cli option

Jonny Burger36e84f955f47
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.ts
index a226634311..4f8abb6eba 100644
--- a/packages/cli/src/benchmark.ts
+++ b/packages/cli/src/benchmark.ts
@@ -45,6 +45,7 @@ const {
delayRenderTimeoutInMillisecondsOption,
headlessOption,
overwriteOption,
+ binariesDirectoryOption,
} = BrowserSafeApis.options;
const getValidConcurrency = (cliConcurrency: number | string | null) => {
@@ -289,6 +290,9 @@ export const benchmarkCommand = async (
offthreadVideoCacheSizeInBytesOption.getValue({
commandLine: parsedCli,
}).value,
+ binariesDirectory: binariesDirectoryOption.getValue({
+ commandLine: parsedCli,
+ }).value,
});
const ids = (
@@ -452,6 +456,9 @@ export const benchmarkCommand = async (
commandLine: parsedCli,
}).value,
repro: false,
+ binariesDirectory: binariesDirectoryOption.getValue({
+ commandLine: parsedCli,
+ }).value,
finishRenderProgress: () => undefined,
},
(run, progress) => {
diff --git a/packages/cli/src/compositions.ts b/packages/cli/src/compositions.ts
index 276a8d11fb..697012f2dc 100644
--- a/packages/cli/src/compositions.ts
+++ b/packages/cli/src/compositions.ts
@@ -17,6 +17,7 @@ const {
glOption,
headlessOption,
delayRenderTimeoutInMillisecondsOption,
+ binariesDirectoryOption,
} = BrowserSafeApis.options;
export const listCompositionsCommand = async (
@@ -122,6 +123,9 @@ export const listCompositionsCommand = async (
offthreadVideoCacheSizeInBytesOption.getValue({
commandLine: parsedCli,
}).value,
+ binariesDirectory: binariesDirectoryOption.getValue({
+ commandLine: parsedCli,
+ }).value,
});
printCompositions(compositions, logLevel);
diff --git a/packages/cli/src/ffmpeg.ts b/packages/cli/src/ffmpeg.ts
index 6344166418..71296b8973 100644
--- a/packages/cli/src/ffmpeg.ts
+++ b/packages/cli/src/ffmpeg.ts
@@ -1,12 +1,23 @@
import type {LogLevel} from '@remotion/renderer';
import {RenderInternals} from '@remotion/renderer';
+import {BrowserSafeApis} from '@remotion/renderer/client';
import {spawnSync} from 'node:child_process';
import {chmodSync} from 'node:fs';
import path from 'node:path';
+import {parsedCli} from './parse-command-line';
-export const dynamicLibEnv = (indent: boolean, logLevel: LogLevel) => {
+export const dynamicLibEnv = (
+ indent: boolean,
+ logLevel: LogLevel,
+ binariesDirectory: string | null,
+) => {
const lib = path.dirname(
- RenderInternals.getExecutablePath('compositor', indent, logLevel),
+ RenderInternals.getExecutablePath({
+ type: 'compositor',
+ indent,
+ logLevel,
+ binariesDirectory,
+ }),
);
return {
@@ -30,14 +41,24 @@ export const ffmpegCommand = (
args: string[],
logLevel: LogLevel,
) => {
- const binary = RenderInternals.getExecutablePath('ffmpeg', false, logLevel);
+ const {value: binariesDirectory} =
+ BrowserSafeApis.options.binariesDirectoryOption.getValue({
+ commandLine: parsedCli,
+ });
+
+ const binary = RenderInternals.getExecutablePath({
+ type: 'ffmpeg',
+ indent: false,
+ logLevel,
+ binariesDirectory,
+ });
if (!process.env.READ_ONLY_FS) {
chmodSync(binary, 0o755);
}
const done = spawnSync(binary, args, {
stdio: 'inherit',
- env: dynamicLibEnv(false, logLevel),
+ env: dynamicLibEnv(false, logLevel, binariesDirectory),
});
process.exit(done.status as number);
};
@@ -47,7 +68,16 @@ export const ffprobeCommand = (
args: string[],
logLevel: LogLevel,
) => {
- const binary = RenderInternals.getExecutablePath('ffprobe', false, logLevel);
+ const {value: binariesDirectory} =
+ BrowserSafeApis.options.binariesDirectoryOption.getValue({
+ commandLine: parsedCli,
+ });
+ const binary = RenderInternals.getExecutablePath({
+ type: 'ffprobe',
+ indent: false,
+ logLevel,
+ binariesDirectory,
+ });
if (!process.env.READ_ONLY_FS) {
chmodSync(binary, 0o755);
}
@@ -55,7 +85,7 @@ export const ffprobeCommand = (
const done = spawnSync(binary, args, {
cwd: path.dirname(binary),
stdio: 'inherit',
- env: dynamicLibEnv(false, logLevel),
+ env: dynamicLibEnv(false, logLevel, binariesDirectory),
});
process.exit(done.status as number);
};
diff --git a/packages/cli/src/get-composition-id.ts b/packages/cli/src/get-composition-id.ts
index 210a38a1c2..802f2772b1 100644
--- a/packages/cli/src/get-composition-id.ts
+++ b/packages/cli/src/get-composition-id.ts
@@ -50,6 +50,7 @@ export const getCompositionId = async ({
indent,
server,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
}: {
args: string[];
compositionIdFromUi: string | null;
@@ -65,6 +66,7 @@ export const getCompositionId = async ({
indent: boolean;
server: RemotionServer;
offthreadVideoCacheSizeInBytes: number | null;
+ binariesDirectory: string | null;
}): Promise<{
compositionId: string;
reason: string;
@@ -96,6 +98,7 @@ export const getCompositionId = async ({
indent,
onBrowserLog: null,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
if (propsSize > 10_000_000) {
@@ -137,6 +140,7 @@ export const getCompositionId = async ({
onBrowserLog: null,
serializedInputPropsWithCustomSchema,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
const {compositionId, reason} = await showSingleCompositionsPicker(
comps,
diff --git a/packages/cli/src/get-composition-with-dimension-override.ts b/packages/cli/src/get-composition-with-dimension-override.ts
index ac74ec274b..dc50ffe620 100644
--- a/packages/cli/src/get-composition-with-dimension-override.ts
+++ b/packages/cli/src/get-composition-with-dimension-override.ts
@@ -25,6 +25,7 @@ export const getCompositionWithDimensionOverride = async ({
logLevel,
server,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
}: {
height: number | null;
width: number | null;
@@ -42,6 +43,7 @@ export const getCompositionWithDimensionOverride = async ({
serializedInputPropsWithCustomSchema: string;
server: RemotionServer;
offthreadVideoCacheSizeInBytes: number | null;
+ binariesDirectory: string | null;
}): Promise<{
compositionId: string;
reason: string;
@@ -63,6 +65,7 @@ export const getCompositionWithDimensionOverride = async ({
timeoutInMilliseconds,
server,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
return {
diff --git a/packages/cli/src/render-flows/render.ts b/packages/cli/src/render-flows/render.ts
index 9cc76bc27f..2d884d1132 100644
--- a/packages/cli/src/render-flows/render.ts
+++ b/packages/cli/src/render-flows/render.ts
@@ -100,6 +100,7 @@ export const renderVideoFlow = async ({
offthreadVideoCacheSizeInBytes,
colorSpace,
repro,
+ binariesDirectory,
}: {
remotionRoot: string;
fullEntryPoint: string;
@@ -149,6 +150,7 @@ export const renderVideoFlow = async ({
offthreadVideoCacheSizeInBytes: number | null;
colorSpace: ColorSpace;
repro: boolean;
+ binariesDirectory: string | null;
}) => {
const downloads: DownloadProgress[] = [];
@@ -268,6 +270,7 @@ export const renderVideoFlow = async ({
logLevel,
webpackConfigOrServeUrl: urlOrBundle,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
addCleanupCallback(() => server.closeServer(false));
@@ -290,6 +293,7 @@ export const renderVideoFlow = async ({
logLevel,
server,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
const {value: codec, source: codecReason} =
@@ -427,6 +431,7 @@ export const renderVideoFlow = async ({
}).serializedString,
offthreadVideoCacheSizeInBytes,
parallelEncodingEnabled: isUsingParallelEncoding,
+ binariesDirectory,
});
updateRenderProgress({newline: true, printToConsole: true});
@@ -512,6 +517,7 @@ export const renderVideoFlow = async ({
finishRenderProgress: () => {
updateRenderProgress({newline: true, printToConsole: true});
},
+ binariesDirectory,
});
Log.info(
diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.ts
index 6da00b52e0..a1eb2320eb 100644
--- a/packages/cli/src/render-flows/still.ts
+++ b/packages/cli/src/render-flows/still.ts
@@ -69,6 +69,7 @@ export const renderStillFlow = async ({
cancelSignal,
outputLocationFromUi,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
}: {
remotionRoot: string;
fullEntryPoint: string;
@@ -97,6 +98,7 @@ export const renderStillFlow = async ({
cancelSignal: CancelSignal | null;
outputLocationFromUi: string | null;
offthreadVideoCacheSizeInBytes: number | null;
+ binariesDirectory: string | null;
}) => {
const aggregate: AggregateRenderProgress = initialAggregateRenderProgress();
const updatesDontOverwrite = shouldUseNonOverlayingLogger({logLevel});
@@ -186,6 +188,7 @@ export const renderStillFlow = async ({
logLevel,
webpackConfigOrServeUrl: urlOrBundle,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
addCleanupCallback(() => server.closeServer(false));
@@ -213,6 +216,7 @@ export const renderStillFlow = async ({
logLevel,
server,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
const {format: imageFormat, source} = determineFinalStillImageFormat({
@@ -312,6 +316,7 @@ export const renderStillFlow = async ({
data: config.props,
}).serializedString,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
aggregate.rendering = {
diff --git a/packages/cli/src/render-queue/process-still.ts b/packages/cli/src/render-queue/process-still.ts
index 949009ba85..67c1bee5a3 100644
--- a/packages/cli/src/render-queue/process-still.ts
+++ b/packages/cli/src/render-queue/process-still.ts
@@ -57,5 +57,6 @@ export const processStill = async ({
cancelSignal: job.cancelToken.cancelSignal,
outputLocationFromUi: job.outName,
offthreadVideoCacheSizeInBytes: job.offthreadVideoCacheSizeInBytes,
+ binariesDirectory: job.binariesDirectory,
});
};
diff --git a/packages/cli/src/render-queue/process-video.ts b/packages/cli/src/render-queue/process-video.ts
index 63050933ce..63035d676b 100644
--- a/packages/cli/src/render-queue/process-video.ts
+++ b/packages/cli/src/render-queue/process-video.ts
@@ -81,5 +81,6 @@ export const processVideoJob = async ({
offthreadVideoCacheSizeInBytes: job.offthreadVideoCacheSizeInBytes,
colorSpace: job.type === 'video' ? job.colorSpace : 'default',
repro: job.repro,
+ binariesDirectory: job.binariesDirectory,
});
};
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 8032630eb6..8565521a97 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -32,6 +32,7 @@ const {
delayRenderTimeoutInMillisecondsOption,
headlessOption,
overwriteOption,
+ binariesDirectoryOption,
} = BrowserSafeApis.options;
export const render = async (
@@ -145,6 +146,9 @@ export const render = async (
},
true,
).value;
+ const binariesDirectory = binariesDirectoryOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const chromiumOptions: ChromiumOptions = {
disableWebSecurity,
@@ -214,5 +218,6 @@ export const render = async (
offthreadVideoCacheSizeInBytes,
colorSpace,
repro,
+ binariesDirectory,
});
};
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index 893ee7bd49..853a633030 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -19,6 +19,7 @@ const {
delayRenderTimeoutInMillisecondsOption,
headlessOption,
overwriteOption,
+ binariesDirectoryOption,
} = BrowserSafeApis.options;
export const still = async (
@@ -98,6 +99,9 @@ export const still = async (
},
true,
).value;
+ const binariesDirectory = binariesDirectoryOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const chromiumOptions: ChromiumOptions = {
disableWebSecurity,
@@ -143,5 +147,6 @@ export const still = async (
cancelSignal: null,
outputLocationFromUi: null,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
};
diff --git a/packages/cli/src/studio.ts b/packages/cli/src/studio.ts
index 681b39f6a6..7e7fa9084e 100644
--- a/packages/cli/src/studio.ts
+++ b/packages/cli/src/studio.ts
@@ -1,4 +1,5 @@
import type {LogLevel} from '@remotion/renderer';
+import {BrowserSafeApis} from '@remotion/renderer/client';
import {StudioServerInternals} from '@remotion/studio-server';
import {ConfigInternals} from './config';
import {getNumberOfSharedAudioTags} from './config/number-of-shared-audio-tags';
@@ -90,6 +91,11 @@ export const studioCommand = async (
const gitSource = getGitSource(remotionRoot);
+ const binariesDirectory =
+ BrowserSafeApis.options.binariesDirectoryOption.getValue({
+ commandLine: parsedCli,
+ }).value;
+
await StudioServerInternals.startStudio({
previewEntry: require.resolve('@remotion/studio/entry'),
browserArgs: parsedCli['browser-args'],
@@ -121,5 +127,6 @@ export const studioCommand = async (
gitSource,
bufferStateDelayInMilliseconds:
ConfigInternals.getBufferStateDelayInMilliseconds(),
+ binariesDirectory,
});
};
diff --git a/packages/cloudrun/src/cli/commands/render/index.ts b/packages/cloudrun/src/cli/commands/render/index.ts
index 6e72c32abb..f3ed86833a 100644
--- a/packages/cloudrun/src/cli/commands/render/index.ts
+++ b/packages/cloudrun/src/cli/commands/render/index.ts
@@ -33,6 +33,7 @@ const {
encodingMaxRateOption,
encodingBufferSizeOption,
delayRenderTimeoutInMillisecondsOption,
+ binariesDirectoryOption,
} = BrowserSafeApis.options;
export const renderCommand = async (
@@ -100,6 +101,9 @@ export const renderCommand = async (
const headless = headlessOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
+ const binariesDirectory = binariesDirectoryOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
let composition: string = args[1];
const chromiumOptions: ChromiumOptions = {
@@ -133,6 +137,7 @@ export const renderCommand = async (
logLevel,
webpackConfigOrServeUrl: serveUrl,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
const {compositionId} =
@@ -158,6 +163,7 @@ export const renderCommand = async (
staticBase: null,
}).serializedString,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
composition = compositionId;
}
diff --git a/packages/cloudrun/src/cli/commands/still.ts b/packages/cloudrun/src/cli/commands/still.ts
index e249b1089e..88e7f39c21 100644
--- a/packages/cloudrun/src/cli/commands/still.ts
+++ b/packages/cloudrun/src/cli/commands/still.ts
@@ -21,6 +21,7 @@ const {
glOption,
delayRenderTimeoutInMillisecondsOption,
headlessOption,
+ binariesDirectoryOption,
} = BrowserSafeApis.options;
export const stillCommand = async (
@@ -78,6 +79,9 @@ export const stillCommand = async (
const puppeteerTimeout = delayRenderTimeoutInMillisecondsOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
+ const binariesDirectory = binariesDirectoryOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
if (!composition) {
Log.info(
@@ -101,6 +105,7 @@ export const stillCommand = async (
logLevel,
webpackConfigOrServeUrl: serveUrl,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
const {compositionId} =
@@ -126,6 +131,7 @@ export const stillCommand = async (
width,
server: await server,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
composition = compositionId;
}
diff --git a/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts b/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts
index de0fd0a603..645366e6a5 100644
--- a/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts
+++ b/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts
@@ -24,6 +24,7 @@ export const getCompositionFromBody = async (body: CloudRunPayloadType) => {
body.delayRenderTimeoutInMilliseconds ??
RenderInternals.DEFAULT_TIMEOUT,
offthreadVideoCacheSizeInBytes: body.offthreadVideoCacheSizeInBytes,
+ binariesDirectory: null,
},
);
diff --git a/packages/cloudrun/src/functions/render-media-single-thread.ts b/packages/cloudrun/src/functions/render-media-single-thread.ts
index f51447c69e..39c27592e7 100644
--- a/packages/cloudrun/src/functions/render-media-single-thread.ts
+++ b/packages/cloudrun/src/functions/render-media-single-thread.ts
@@ -120,6 +120,7 @@ export const renderMediaSingleThread = async (
colorSpace: body.colorSpace,
repro: false,
finishRenderProgress: () => undefined,
+ binariesDirectory: null,
});
const storage = new Storage();
diff --git a/packages/cloudrun/src/functions/render-still-single-thread.ts b/packages/cloudrun/src/functions/render-still-single-thread.ts
index 18331c9563..d155ac78a7 100644
--- a/packages/cloudrun/src/functions/render-still-single-thread.ts
+++ b/packages/cloudrun/src/functions/render-still-single-thread.ts
@@ -93,6 +93,7 @@ export const renderStillSingleThread = async (
puppeteerInstance: null,
server: undefined,
offthreadVideoCacheSizeInBytes: body.offthreadVideoCacheSizeInBytes,
+ binariesDirectory: null,
});
Log.info({indent: false, logLevel: body.logLevel}, 'Still rendered');
diff --git a/packages/docs/docs/cli/benchmark.md b/packages/docs/docs/cli/benchmark.md
index f84c9a1793..b2387a3be1 100644
--- a/packages/docs/docs/cli/benchmark.md
+++ b/packages/docs/docs/cli/benchmark.md
@@ -217,6 +217,10 @@ Inherited from [`npx remotion render`](/docs/cli/render#--audio-bitrate)
<Options cli id="color-space" />
+### `--binaries-directory`<AvailableFrom v="4.0.120" />
+
+<Options cli id="binaries-directory" />
+
### ~~`--ffmpeg-executable`~~
_optional, removed in v4.0_
diff --git a/packages/docs/docs/cli/compositions.md b/packages/docs/docs/cli/compositions.md
index d618118fcf..4ce5a79d6f 100644
--- a/packages/docs/docs/cli/compositions.md
+++ b/packages/docs/docs/cli/compositions.md
@@ -87,6 +87,10 @@ Lets you set a custom user agent that the headless Chrome browser assumes.
<Options id="offthreadvideo-cache-size-in-bytes" />
+### `--binaries-directory`<AvailableFrom v="4.0.120" />
+
+<Options cli id="binaries-directory" />
+
### `--quiet`, `--q`
Only prints the composition IDs, separated by a space.
diff --git a/packages/docs/docs/cli/render.md b/packages/docs/docs/cli/render.md
index 0865cb70f8..8a338dc709 100644
--- a/packages/docs/docs/cli/render.md
+++ b/packages/docs/docs/cli/render.md
@@ -204,6 +204,10 @@ Lets you set a custom user agent that the headless Chrome browser assumes.
<Options id="repro" />
+### `--binaries-directory`<AvailableFrom v="4.0.120" />
+
+<Options cli id="binaries-directory" />
+
### ~~`--ffmpeg-executable`~~
_removed in v4.0_
diff --git a/packages/docs/docs/cli/still.md b/packages/docs/docs/cli/still.md
index 3c6efa9ff0..c362f594d7 100644
--- a/packages/docs/docs/cli/still.md
+++ b/packages/docs/docs/cli/still.md
@@ -123,6 +123,10 @@ Lets you set a custom user agent that the headless Chrome browser assumes.
<Options cli id="enable-multiprocess-on-linux" />
+### `--binaries-directory`<AvailableFrom v="4.0.120" />
+
+<Options cli id="binaries-directory" />
+
### ~~`--ffmpeg-executable`~~
_removed in v4.0_
diff --git a/packages/docs/docs/renderer/extract-audio.md b/packages/docs/docs/renderer/extract-audio.md
index cf2be92de4..f51a7af3ce 100644
--- a/packages/docs/docs/renderer/extract-audio.md
+++ b/packages/docs/docs/renderer/extract-audio.md
@@ -59,6 +59,10 @@ The path where the extracted audio will be saved. The file extension must match
<Options id="log"/>
+### `binariesDirectory?`<AvailableFrom v="4.0.120" />
+
+<Options id="binaries-directory" />
+
## Return Value
The function returns a `Promise<void>`, which resolves once the audio extraction is complete.
diff --git a/packages/docs/docs/renderer/get-compositions.md b/packages/docs/docs/renderer/get-compositions.md
index d76c4f3542..732987d425 100644
--- a/packages/docs/docs/renderer/get-compositions.md
+++ b/packages/docs/docs/renderer/get-compositions.md
@@ -143,13 +143,17 @@ Allows you to set certain Chromium / Google Chrome flags. See: [Chromium flags](
<Options id="offthreadvideo-cache-size-in-bytes" />
-#### ~~`ffmpegExecutable`~~
+### `binariesDirectory?`<AvailableFrom v="4.0.120" />
+
+<Options id="binaries-directory" />
+
+### ~~`ffmpegExecutable`~~
_removed in v4.0, optional_
An absolute path overriding the `ffmpeg` executable to use.
-#### ~~`ffprobeExecutable?`~~ <AvailableFrom v="3.0.17" />
+### ~~`ffprobeExecutable?`~~ <AvailableFrom v="3.0.17" />
_removed in v4.0_
diff --git a/packages/docs/docs/renderer/get-silent-parts.md b/packages/docs/docs/renderer/get-silent-parts.md
index 9fa8b1a162..d73569b044 100644
--- a/packages/docs/docs/renderer/get-silent-parts.md
+++ b/packages/docs/docs/renderer/get-silent-parts.md
@@ -66,6 +66,10 @@ The minimum duration of a silent part in seconds. The default is `1`.
<Options id="log"/>
+### `binariesDirectory?`<AvailableFrom v="4.0.120" />
+
+<Options id="binaries-directory" />
+
## Return Value
The return value is an object with the following properties:
diff --git a/packages/docs/docs/renderer/get-video-metadata.md b/packages/docs/docs/renderer/get-video-metadata.md
index b80ff7dc33..92d39e9e07 100644
--- a/packages/docs/docs/renderer/get-video-metadata.md
+++ b/packages/docs/docs/renderer/get-video-metadata.md
@@ -50,6 +50,16 @@ _string_
A local video file path.
+### options?
+
+### `logLevel?`
+
+<Options id="log" />
+
+#### `binariesDirectory?`<AvailableFrom v="4.0.120" />
+
+<Options id="binaries-directory" />
+
## Return Value
The return value is an object with the following properties:
diff --git a/packages/docs/docs/renderer/render-frames.md b/packages/docs/docs/renderer/render-frames.md
index 40370287a5..4f2c2c13d5 100644
--- a/packages/docs/docs/renderer/render-frames.md
+++ b/packages/docs/docs/renderer/render-frames.md
@@ -286,6 +286,10 @@ Lets you set a custom user agent that the headless Chrome browser assumes.
<Options id="offthreadvideo-cache-size-in-bytes" />
+### `binariesDirectory?`<AvailableFrom v="4.0.120" />
+
+<Options id="binaries-directory" />
+
### ~~`quality?`~~
Renamed to `jpegQuality` in `v4.0.0`.
diff --git a/packages/docs/docs/renderer/render-media.md b/packages/docs/docs/renderer/render-media.md
index 3c9bdc280b..8d5516031f 100644
--- a/packages/docs/docs/renderer/render-media.md
+++ b/packages/docs/docs/renderer/render-media.md
@@ -439,6 +439,10 @@ _boolean - default `false`_
<Options id="repro" />
+### `binariesDirectory?`<AvailableFrom v="4.0.120" />
+
+<Options id="binaries-directory" />
+
### ~~`parallelism?`~~
Renamed to `concurrency` in v3.2.17.
diff --git a/packages/docs/docs/renderer/render-still.md b/packages/docs/docs/renderer/render-still.md
index 3983db2d6f..afdba27412 100644
--- a/packages/docs/docs/renderer/render-still.md
+++ b/packages/docs/docs/renderer/render-still.md
@@ -196,6 +196,10 @@ Lets you set a custom user agent that the headless Chrome browser assumes.
<Options id="offthreadvideo-cache-size-in-bytes" />
+### `binariesDirectory?`<AvailableFrom v="4.0.120" />
+
+<Options id="binaries-directory" />
+
### ~~`dumpBrowserLogs?`~~
_optional - default `false`, deprecated in v4.0_
diff --git a/packages/docs/docs/renderer/select-composition.md b/packages/docs/docs/renderer/select-composition.md
index 5ed043c037..153f83fcb6 100644
--- a/packages/docs/docs/renderer/select-composition.md
+++ b/packages/docs/docs/renderer/select-composition.md
@@ -85,6 +85,10 @@ See: [Environment variables](/docs/env-variables/)
<Options id="offthreadvideo-cache-size-in-bytes" />
+### `binariesDirectory?`<AvailableFrom v="4.0.120" />
+
+<Options id="binaries-directory" />
+
## See also
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/renderer/src/select-composition.ts)
diff --git a/packages/docs/docs/renderer/stitch-frames-to-video.md b/packages/docs/docs/renderer/stitch-frames-to-video.md
index 15f7e2e004..8de39a4f36 100644
--- a/packages/docs/docs/renderer/stitch-frames-to-video.md
+++ b/packages/docs/docs/renderer/stitch-frames-to-video.md
@@ -152,6 +152,10 @@ _optional_
A token that allows the render to be cancelled. See: [`makeCancelSignal()`](/docs/renderer/make-cancel-signal)
+### `binariesDirectory?`<AvailableFrom v="4.0.120" />
+
+<Options id="binaries-directory" />
+
### `ffmpegOverride?`<AvailableFrom v="3.2.22" />
_function - optional_
diff --git a/packages/it-tests/src/bundle/bundle-studio.test.ts b/packages/it-tests/src/bundle/bundle-studio.test.ts
index aba5095235..6ea9864d29 100644
--- a/packages/it-tests/src/bundle/bundle-studio.test.ts
+++ b/packages/it-tests/src/bundle/bundle-studio.test.ts
@@ -21,6 +21,7 @@ test("Bundle studio", async () => {
logLevel: "info",
offthreadVideoCacheSizeInBytes: null,
remotionRoot: path.join(process.cwd(), "..", "example"),
+ binariesDirectory: null,
}
);
await tab.goto({
diff --git a/packages/it-tests/src/rendering/base64-audio.test.ts b/packages/it-tests/src/rendering/base64-audio.test.ts
index 837405d26a..4a179222ca 100644
--- a/packages/it-tests/src/rendering/base64-audio.test.ts
+++ b/packages/it-tests/src/rendering/base64-audio.test.ts
@@ -30,6 +30,7 @@ test("Should be able to render a MP3 audio file", async () => {
args: [outputPath],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("mp3");
diff --git a/packages/it-tests/src/rendering/bundle-renderer.test.ts b/packages/it-tests/src/rendering/bundle-renderer.test.ts
index c16ddeffae..4b10d1f255 100644
--- a/packages/it-tests/src/rendering/bundle-renderer.test.ts
+++ b/packages/it-tests/src/rendering/bundle-renderer.test.ts
@@ -20,11 +20,12 @@ test("Should be able to bundle the renderer", () => {
});
expect(errors.length).toBe(0);
expect(warnings.length).toBe(0);
- const binaryPath = RenderInternals.getExecutablePath(
- "compositor",
- false,
- "info"
- );
+ const binaryPath = RenderInternals.getExecutablePath({
+ type: "compositor",
+ indent: false,
+ logLevel: "info",
+ binariesDirectory: null,
+ });
const ffmpegCwd = path.dirname(binaryPath);
const filesInCwd = readdirSync(ffmpegCwd);
const filesToCopy = filesInCwd.filter(
diff --git a/packages/it-tests/src/rendering/call-ffmpeg-from-node-modules.test.ts b/packages/it-tests/src/rendering/call-ffmpeg-from-node-modules.test.ts
index a67355caca..307aeb786f 100644
--- a/packages/it-tests/src/rendering/call-ffmpeg-from-node-modules.test.ts
+++ b/packages/it-tests/src/rendering/call-ffmpeg-from-node-modules.test.ts
@@ -4,7 +4,12 @@ import path from "path";
import { expect, test } from "vitest";
test("Should be able to call ffmpeg from node_modules (not officially supported)", async () => {
- const binary = RenderInternals.getExecutablePath("ffmpeg", false, "info");
+ const binary = RenderInternals.getExecutablePath({
+ type: "ffmpeg",
+ indent: false,
+ logLevel: "info",
+ binariesDirectory: null,
+ });
const a = execSync(`${binary} -buildconf`, {
cwd: path.dirname(binary),
stdio: "pipe",
diff --git a/packages/it-tests/src/rendering/frame-accuracy-gif.test.ts b/packages/it-tests/src/rendering/frame-accuracy-gif.test.ts
index 13ad85262e..b59de3f254 100644
--- a/packages/it-tests/src/rendering/frame-accuracy-gif.test.ts
+++ b/packages/it-tests/src/rendering/frame-accuracy-gif.test.ts
@@ -47,6 +47,7 @@ const getMissedFramesforCodec = async () => {
],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
let missedFrames = 0;
diff --git a/packages/it-tests/src/rendering/render-scale.test.ts b/packages/it-tests/src/rendering/render-scale.test.ts
index 8a2ff2547e..37b0324df3 100644
--- a/packages/it-tests/src/rendering/render-scale.test.ts
+++ b/packages/it-tests/src/rendering/render-scale.test.ts
@@ -43,6 +43,7 @@ test("Should be able to render video with scale 2", async () => {
args: [outputPath],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("Video: h264");
@@ -82,6 +83,7 @@ test("Should be able to render video with scale 0.1", async () => {
args: [outputPath],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("Video: h264");
diff --git a/packages/it-tests/src/rendering/rendering.test.ts b/packages/it-tests/src/rendering/rendering.test.ts
index 2c7519a0b7..ac13495eb7 100644
--- a/packages/it-tests/src/rendering/rendering.test.ts
+++ b/packages/it-tests/src/rendering/rendering.test.ts
@@ -40,6 +40,7 @@ test("Should be able to render video with custom port", async () => {
args: [outputPath],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("Video: h264");
@@ -146,6 +147,7 @@ test("Should render a ProRes video", async () => {
args: [out],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data.includes("prores (4444)") || data.includes("prores (ap4h")).toBe(
@@ -173,6 +175,7 @@ test("Should render a still image if single frame specified", async () => {
args: [outImg],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("Video: png");
@@ -200,6 +203,7 @@ test("Should be able to render a WAV audio file", async () => {
args: [out],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("pcm_s16le");
@@ -230,6 +234,7 @@ test("Should be able to render a MP3 audio file", async () => {
args: [out],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("mp3");
@@ -260,6 +265,7 @@ test("Should be able to render a AAC audio file", async () => {
args: [out],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("aac");
@@ -287,6 +293,7 @@ test("Should render a video with GIFs", async () => {
args: [outputPath],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("Video: h264");
@@ -314,6 +321,7 @@ test("Should render a video with Offline Audio-context", async () => {
args: [out],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("Stream #0:0: Audio: mp3");
@@ -336,6 +344,7 @@ test("Should succeed to render an audio file that doesn't have any audio inputs"
args: [out],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("Duration: 00:00:00.36");
@@ -396,6 +405,7 @@ test("Dynamic duration should work, and render from inside src/", async () => {
args: [outputPath],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
const data = info.stderr;
expect(data).toContain("Video: h264");
diff --git a/packages/it-tests/src/ssr/render-frames.test.ts b/packages/it-tests/src/ssr/render-frames.test.ts
index ed9d97c070..9e282c02e7 100644
--- a/packages/it-tests/src/ssr/render-frames.test.ts
+++ b/packages/it-tests/src/ssr/render-frames.test.ts
@@ -61,6 +61,7 @@ test("Legacy SSR way of rendering videos should still work", async () => {
args: [outPath],
indent: false,
logLevel: "info",
+ binariesDirectory: null,
});
expect(probe.stderr).toMatch(/Video: h264/);
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index 8e0c647c96..44df8cbd8d 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -59,6 +59,7 @@ const {
encodingBufferSizeOption,
delayRenderTimeoutInMillisecondsOption,
overwriteOption,
+ binariesDirectoryOption,
} = BrowserSafeApis.options;
export const renderCommand = async (
@@ -161,6 +162,10 @@ export const renderCommand = async (
},
false,
).value;
+ const binariesDirectory = binariesDirectoryOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
+
const chromiumOptions: ChromiumOptions = {
disableWebSecurity,
enableMultiProcessOnLinux,
@@ -193,6 +198,7 @@ export const renderCommand = async (
logLevel,
webpackConfigOrServeUrl: serveUrl,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
const {compositionId} =
@@ -218,6 +224,7 @@ export const renderCommand = async (
width,
server,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
composition = compositionId;
}
diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.ts
index ce4f2b844b..8b5032a540 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -29,6 +29,7 @@ const {
glOption,
headlessOption,
delayRenderTimeoutInMillisecondsOption,
+ binariesDirectoryOption,
} = BrowserSafeApis.options;
const {
@@ -106,6 +107,9 @@ export const stillCommand = async (
offthreadVideoCacheSizeInBytesOption.getValue({
commandLine: parsedCli,
}).value;
+ const binariesDirectory = binariesDirectoryOption.getValue({
+ commandLine: parsedCli,
+ }).value;
if (!composition) {
Log.info(
@@ -129,6 +133,7 @@ export const stillCommand = async (
logLevel,
webpackConfigOrServeUrl: serveUrl,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
const {compositionId} = await getCompositionWithDimensionOverride({
@@ -153,6 +158,7 @@ export const stillCommand = async (
width,
server,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory,
});
composition = compositionId;
}
diff --git a/packages/lambda/src/functions/compositions.ts b/packages/lambda/src/functions/compositions.ts
index f80fc00625..eff18bb36f 100644
--- a/packages/lambda/src/functions/compositions.ts
+++ b/packages/lambda/src/functions/compositions.ts
@@ -81,6 +81,7 @@ export const compositionsHandler = async (
onBrowserLog: null,
offthreadVideoCacheSizeInBytes:
lambdaParams.offthreadVideoCacheSizeInBytes,
+ binariesDirectory: null,
});
return Promise.resolve({
diff --git a/packages/lambda/src/functions/helpers/concat-videos.ts b/packages/lambda/src/functions/helpers/concat-videos.ts
index 3f4dac757f..c111c76969 100644
--- a/packages/lambda/src/functions/helpers/concat-videos.ts
+++ b/packages/lambda/src/functions/helpers/concat-videos.ts
@@ -190,6 +190,7 @@ export const concatVideosS3 = async ({
audioCodec,
audioBitrate,
logLevel,
+ binariesDirectory,
}: {
onProgress: (frames: number) => void;
numberOfFrames: number;
@@ -201,6 +202,7 @@ export const concatVideosS3 = async ({
audioCodec: AudioCodec | null;
audioBitrate: string | null;
logLevel: LogLevel;
+ binariesDirectory: string | null;
}) => {
const outfile = join(
RenderInternals.tmpDir(REMOTION_CONCATED_TOKEN),
@@ -222,6 +224,7 @@ export const concatVideosS3 = async ({
audioBitrate,
indent: false,
logLevel,
+ binariesDirectory,
});
combine.end();
diff --git a/packages/lambda/src/functions/helpers/merge-chunks.ts b/packages/lambda/src/functions/helpers/merge-chunks.ts
index 2b3f52cd2a..e33a1b4bc6 100644
--- a/packages/lambda/src/functions/helpers/merge-chunks.ts
+++ b/packages/lambda/src/functions/helpers/merge-chunks.ts
@@ -61,6 +61,7 @@ export const mergeChunksAndFinishRender = async (options: {
onAllChunks: OnAllChunksAvailable;
audioBitrate: string | null;
logLevel: LogLevel;
+ binariesDirectory: string | null;
}): Promise<PostRenderData> => {
let lastProgressUploaded = 0;
@@ -165,6 +166,7 @@ export const mergeChunksAndFinishRender = async (options: {
audioCodec: options.audioCodec,
audioBitrate: options.audioBitrate,
logLevel: options.logLevel,
+ binariesDirectory: options.binariesDirectory,
});
const encodingStop = Date.now();
diff --git a/packages/lambda/src/functions/helpers/validate-composition.ts b/packages/lambda/src/functions/helpers/validate-composition.ts
index 6033222115..1959b52947 100644
--- a/packages/lambda/src/functions/helpers/validate-composition.ts
+++ b/packages/lambda/src/functions/helpers/validate-composition.ts
@@ -55,6 +55,7 @@ export const validateComposition = async ({
onBrowserLog: null,
server,
offthreadVideoCacheSizeInBytes,
+ binariesDirectory: null,
});
return {
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index beb99d6b71..5481eabc76 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -399,6 +399,7 @@ const innerLaunchHandler = async ({
onAllChunks: onAllChunksAvailable,
audioBitrate: params.audioBitrate,
logLevel: params.logLevel,
+ binariesDirectory: null,
});
return postRenderData;
diff --git a/packages/lambda/src/functions/merge.ts b/packages/lambda/src/functions/merge.ts
index b1c7a800c7..107c159ec6 100644
--- a/packages/lambda/src/functions/merge.ts
+++ b/packages/lambda/src/functions/merge.ts
@@ -79,6 +79,7 @@ export const mergeHandler = async (
},
audioBitrate: renderMetadata.audioBitrate,
logLevel: params.logLevel,
+ binariesDirectory: null,
});
return {type: 'success' as const, postRenderData};
diff --git a/packages/lambda/src/functions/renderer.ts b/packages/lambda/src/functions/renderer.ts
index 6f3e5a0894..057bce5fa2 100644
--- a/packages/lambda/src/functions/renderer.ts
+++ b/packages/lambda/src/functions/renderer.ts
@@ -227,6 +227,7 @@ const renderHandler = async (
offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
colorSpace: params.colorSpace,
finishRenderProgress: () => undefined,
+ binariesDirectory: null,
})
.then(({slowestFrames}) => {
console.log(`Slowest frames:`);
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index d522685d19..c4ff37335a 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -119,6 +119,7 @@ const innerStillHandler = async ({
logLevel: lambdaParams.logLevel,
webpackConfigOrServeUrl: serveUrl,
offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
+ binariesDirectory: null,
});
const browserInstance = await browserInstancePromise;
@@ -209,6 +210,7 @@ const innerStillHandler = async ({
data: composition.props,
}).serializedString,
offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
+ binariesDirectory: null,
});
const {key, renderBucketName, customCredentials} = getExpectedOutName(
diff --git a/packages/lambda/src/test/integration/renders/gif.test.ts b/packages/lambda/src/test/integration/renders/gif.test.ts
index 477d515c42..170e284881 100644
--- a/packages/lambda/src/test/integration/renders/gif.test.ts
+++ b/packages/lambda/src/test/integration/renders/gif.test.ts
@@ -110,6 +110,7 @@ test('Should make a distributed GIF', async () => {
args: [out],
indent: false,
logLevel: 'info',
+ binariesDirectory: null,
});
unlinkSync(out);
expect(probe.stderr).toMatch(/Video: gif, bgra, 1080x1080/);
diff --git a/packages/lambda/src/test/integration/renders/other-bucket.test.ts b/packages/lambda/src/test/integration/renders/other-bucket.test.ts
index c4cb689b58..9cb233fc0f 100644
--- a/packages/lambda/src/test/integration/renders/other-bucket.test.ts
+++ b/packages/lambda/src/test/integration/renders/other-bucket.test.ts
@@ -108,6 +108,7 @@ test('Should be able to render to another bucket', async () => {
options: {
stdin: file,
},
+ binariesDirectory: null,
});
expect(probe.stderr).toMatch(/Stream #0:0/);
expect(probe.stderr).toMatch(/Video: h264/);
diff --git a/packages/lambda/src/test/integration/renders/silent-audio.test.ts b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
index d6d8147af3..465da83f9f 100644
--- a/packages/lambda/src/test/integration/renders/silent-audio.test.ts
+++ b/packages/lambda/src/test/integration/renders/silent-audio.test.ts
@@ -105,6 +105,7 @@ test('Should add silent audio if there is no audio', async () => {
options: {
stdin: file,
},
+ binariesDirectory: null,
});
expect(probe.stderr).toMatch(/Stream #0:0/);
expect(probe.stderr).toMatch(/Video: h264/);
diff --git a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
index 8bb7d97a2c..a35724471b 100644
--- a/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
+++ b/packages/lambda/src/test/integration/renders/transparent-webm.test.ts
@@ -114,6 +114,7 @@ test('Should make a transparent video', async () => {
args: [out],
indent: false,
logLevel: 'info',
+ binariesDirectory: null,
});
expect(probe.stderr).toMatch(/ALPHA_MODE(\s+): 1/);
expect(probe.stderr).toMatch(/Video: vp8, yuv420p/);
diff --git a/packages/renderer/src/get-video-metadata.ts b/packages/renderer/src/get-video-metadata.ts
index 1d026fdcd0..f106e1a70a 100644
--- a/packages/renderer/src/get-video-metadata.ts
+++ b/packages/renderer/src/get-video-metadata.ts
@@ -6,13 +6,13 @@ export {VideoMetadata} from './compositor/payloads';
export const getVideoMetadata = async (
videoSource: string,
- options?: {logLevel?: LogLevel},
+ options?: {logLevel?: LogLevel; binariesDirectory?: string | null},
): Promise<VideoMetadata> => {
const compositor = startLongRunningCompositor({
maximumFrameCacheItemsInBytes: null,
logLevel: options?.logLevel ?? 'info',
indent: false,
- binariesDirectory: null,
+ binariesDirectory: options?.binariesDirectory ?? null,
});
const metadataResponse = await compositor.executeCommand('GetVideoMetadata', {
src: videoSource,
diff --git a/packages/studio-server/src/preview-server/api-types.ts b/packages/studio-server/src/preview-server/api-types.ts
index 9fb39b5712..7ef7c6f29f 100644
--- a/packages/studio-server/src/preview-server/api-types.ts
+++ b/packages/studio-server/src/preview-server/api-types.ts
@@ -26,4 +26,5 @@ export type ApiHandler<ReqData, ResData> = (params: {
response: ServerResponse;
logLevel: LogLevel;
methods: QueueMethods;
+ binariesDirectory: string | null;
}) => Promise<ResData>;
diff --git a/packages/studio-server/src/preview-server/handler.ts b/packages/studio-server/src/preview-server/handler.ts
index 1c4ca196ae..282aa4ff22 100644
--- a/packages/studio-server/src/preview-server/handler.ts
+++ b/packages/studio-server/src/preview-server/handler.ts
@@ -11,11 +11,13 @@ export const handleRequest = async <Req, Res>({
handler,
logLevel,
methods,
+ binariesDirectory,
}: {
remotionRoot: string;
request: IncomingMessage;
response: ServerResponse;
entryPoint: string;
+ binariesDirectory: string | null;
handler: ApiHandler<Req, Res>;
logLevel: LogLevel;
methods: QueueMethods;
@@ -40,6 +42,7 @@ export const handleRequest = async <Req, Res>({
input: body,
logLevel,
methods,
+ binariesDirectory,
});
response.end(
diff --git a/packages/studio-server/src/preview-server/routes/add-render.ts b/packages/studio-server/src/preview-server/routes/add-render.ts
index 524bfe8aed..c8439e7e11 100644
--- a/packages/studio-server/src/preview-server/routes/add-render.ts
+++ b/packages/studio-server/src/preview-server/routes/add-render.ts
@@ -7,6 +7,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({
entryPoint,
remotionRoot,
logLevel,
+ binariesDirectory,
methods: {addJob},
}): Promise<undefined> => {
const id = String(Math.random()).replace('0.', '');
@@ -56,6 +57,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({
multiProcessOnLinux: input.multiProcessOnLinux,
beepOnFinish: input.beepOnFinish,
repro: input.repro,
+ binariesDirectory,
},
logLevel,
});
@@ -91,6 +93,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({
multiProcessOnLinux: input.multiProcessOnLinux,
beepOnFinish: input.beepOnFinish,
repro: input.repro,
+ binariesDirectory,
},
logLevel,
});
@@ -122,6 +125,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({
multiProcessOnLinux: input.multiProcessOnLinux,
beepOnFinish: input.beepOnFinish,
repro: false,
+ binariesDirectory,
},
entryPoint,
remotionRoot,
diff --git a/packages/studio-server/src/preview-server/routes/copy-still-to-clipboard-handler.ts b/packages/studio-server/src/preview-server/routes/copy-still-to-clipboard-handler.ts
index 7fe7bd7588..ca227ba355 100644
--- a/packages/studio-server/src/preview-server/routes/copy-still-to-clipboard-handler.ts
+++ b/packages/studio-server/src/preview-server/routes/copy-still-to-clipboard-handler.ts
@@ -6,7 +6,7 @@ import type {ApiHandler} from '../api-types';
export const handleCopyStillToClipboard: ApiHandler<
CopyStillToClipboardRequest,
void
-> = ({input: {outName}, remotionRoot}) => {
+> = ({input: {outName, binariesDirectory}, remotionRoot}) => {
const resolved = path.resolve(remotionRoot, outName);
const relativeToProcessCwd = path.relative(remotionRoot, resolved);
@@ -14,5 +14,9 @@ export const handleCopyStillToClipboard: ApiHandler<
throw new Error(`Not allowed to open ${relativeToProcessCwd}`);
}
- return RenderInternals.copyImageToClipboard(resolved, 'info');
+ return RenderInternals.copyImageToClipboard(
+ resolved,
+ 'info',
+ binariesDirectory,
+ );
};
diff --git a/packages/studio-server/src/preview-server/start-server.ts b/packages/studio-server/src/preview-server/start-server.ts
index 64076f82d6..9fa968abdc 100644
--- a/packages/studio-server/src/preview-server/start-server.ts
+++ b/packages/studio-server/src/preview-server/start-server.ts
@@ -40,6 +40,7 @@ export const startServer = async (options: {
numberOfAudioTags: number;
queueMethods: QueueMethods;
gitSource: GitSource | null;
+ binariesDirectory: string | null;
}): Promise<{
port: number;
liveEventsServer: LiveEventsServer;
@@ -97,6 +98,7 @@ export const startServer = async (options: {
numberOfAudioTags: options.numberOfAudioTags,
queueMethods: options.queueMethods,
gitSource: options.gitSource,
+ binariesDirectory: options.binariesDirectory,
});
})
.catch((err) => {
diff --git a/packages/studio-server/src/routes.ts b/packages/studio-server/src/routes.ts
index 924975dd26..6387f84e71 100644
--- a/packages/studio-server/src/routes.ts
+++ b/packages/studio-server/src/routes.ts
@@ -259,6 +259,7 @@ export const handleRoutes = ({
numberOfAudioTags,
queueMethods: methods,
gitSource,
+ binariesDirectory,
}: {
staticHash: string;
staticHashPrefix: string;
@@ -278,6 +279,7 @@ export const handleRoutes = ({
numberOfAudioTags: number;
queueMethods: QueueMethods;
gitSource: GitSource | null;
+ binariesDirectory: string | null;
}) => {
const url = new URL(request.url as string, 'http://localhost');
@@ -311,6 +313,7 @@ export const handleRoutes = ({
response,
logLevel,
methods,
+ binariesDirectory,
});
}
}
diff --git a/packages/studio-server/src/start-studio.ts b/packages/studio-server/src/start-studio.ts
index e0aa9c07c5..d96c23533f 100644
--- a/packages/studio-server/src/start-studio.ts
+++ b/packages/studio-server/src/start-studio.ts
@@ -78,6 +78,7 @@ export const startStudio = async ({
previewEntry,
gitSource,
bufferStateDelayInMilliseconds,
+ binariesDirectory,
}: {
browserArgs: string;
browserFlag: string;
@@ -101,6 +102,7 @@ export const startStudio = async ({
parsedCliOpen: boolean;
previewEntry: string;
gitSource: GitSource | null;
+ binariesDirectory: string | null;
}) => {
watchRootFile(remotionRoot);
const publicDir = getAbsolutePublicDir({
@@ -160,6 +162,7 @@ export const startStudio = async ({
queueMethods,
gitSource,
bufferStateDelayInMilliseconds,
+ binariesDirectory,
});
setLiveEventsListener(liveEventsServer);
diff --git a/packages/studio-shared/src/api-requsts.ts b/packages/studio-shared/src/api-requsts.ts
index 26db433511..3adbe8c902 100644
--- a/packages/studio-shared/src/api-requsts.ts
+++ b/packages/studio-shared/src/api-requsts.ts
@@ -19,6 +19,7 @@ export type OpenInFileExplorerRequest = {
export type CopyStillToClipboardRequest = {
outName: string;
+ binariesDirectory: string | null;
};
type ReqAndRes<A, B> = {
diff --git a/packages/studio-shared/src/render-job.ts b/packages/studio-shared/src/render-job.ts
index 6cb8a7cbd7..2b997f1d2e 100644
--- a/packages/studio-shared/src/render-job.ts
+++ b/packages/studio-shared/src/render-job.ts
@@ -151,6 +151,7 @@ export type RenderJob = {
multiProcessOnLinux: boolean;
beepOnFinish: boolean;
repro: boolean;
+ binariesDirectory: string | null;
} & RenderJobDynamicFields;
export type RenderJobWithCleanup = RenderJob & {
diff --git a/packages/studio/src/components/RenderQueue/RenderQueueCopyToClipboard.tsx b/packages/studio/src/components/RenderQueue/RenderQueueCopyToClipboard.tsx
index c5b24ed682..ec29190c2e 100644
--- a/packages/studio/src/components/RenderQueue/RenderQueueCopyToClipboard.tsx
+++ b/packages/studio/src/components/RenderQueue/RenderQueueCopyToClipboard.tsx
@@ -44,7 +44,10 @@ export const RenderQueueCopyToClipboard: React.FC<{
const onClick: React.MouseEventHandler = useCallback(
(e) => {
e.stopPropagation();
- copyToClipboard({outName: job.outName})
+ copyToClipboard({
+ outName: job.outName,
+ binariesDirectory: job.binariesDirectory,
+ })
.catch((err) => {
sendErrorNotification(`Could not copy to clipboard: ${err.message}`);
})
@@ -57,7 +60,7 @@ export const RenderQueueCopyToClipboard: React.FC<{
});
});
},
- [job.outName],
+ [job.binariesDirectory, job.outName],
);
return (
diff --git a/packages/studio/src/components/RenderQueue/actions.ts b/packages/studio/src/components/RenderQueue/actions.ts
index 2be69e4cc7..6d1e2e56cf 100644
--- a/packages/studio/src/components/RenderQueue/actions.ts
+++ b/packages/studio/src/components/RenderQueue/actions.ts
@@ -319,9 +319,16 @@ export const openInFileExplorer = ({directory}: {directory: string}) => {
return callApi('/api/open-in-file-explorer', body);
};
-export const copyToClipboard = ({outName}: {outName: string}) => {
+export const copyToClipboard = ({
+ outName,
+ binariesDirectory,
+}: {
+ outName: string;
+ binariesDirectory: string | null;
+}) => {
const body: CopyStillToClipboardRequest = {
outName,
+ binariesDirectory,
};
return callApi('/api/copy-still-to-clipboard', body);
};