Skip to content

🎥 Make videos programmatically with React

chmod binaries to fix EACCESS

Jonny Burger6d8ffdc38f3a
diff --git a/packages/cli/src/ffmpeg.ts b/packages/cli/src/ffmpeg.ts
index f801b12589..b5ad1a70b7 100644
--- a/packages/cli/src/ffmpeg.ts
+++ b/packages/cli/src/ffmpeg.ts
@@ -1,8 +1,11 @@
import {RenderInternals} from '@remotion/renderer';
import {spawnSync} from 'node:child_process';
+import {chmodSync} from 'node:fs';
export const ffmpegCommand = (_root: string, args: string[]) => {
- const done = spawnSync(RenderInternals.getExecutablePath('ffmpeg'), args, {
+ const binary = RenderInternals.getExecutablePath('ffmpeg');
+ chmodSync(binary, 0o755);
+ const done = spawnSync(binary, args, {
...RenderInternals.dynamicLibraryPathOptions(),
stdio: 'inherit',
});
@@ -10,7 +13,9 @@ export const ffmpegCommand = (_root: string, args: string[]) => {
};
export const ffprobeCommand = (_root: string, args: string[]) => {
- const done = spawnSync(RenderInternals.getExecutablePath('ffprobe'), args, {
+ const binary = RenderInternals.getExecutablePath('ffprobe');
+ chmodSync(binary, 0o755);
+ const done = spawnSync(binary, args, {
...RenderInternals.dynamicLibraryPathOptions(),
stdio: 'inherit',
});
diff --git a/packages/renderer/src/call-ffmpeg.ts b/packages/renderer/src/call-ffmpeg.ts
index 41939411ca..0630ea41eb 100644
--- a/packages/renderer/src/call-ffmpeg.ts
+++ b/packages/renderer/src/call-ffmpeg.ts
@@ -1,4 +1,5 @@
import execa from 'execa';
+import {chmodSync} from 'node:fs';
import path from 'node:path';
import {getExecutablePath} from './compositor/get-executable-path';
import {truthy} from './truthy';
@@ -29,7 +30,9 @@ export const callFf = (
args: (string | null)[],
options?: execa.Options<string>
) => {
- return execa(getExecutablePath(bin), args.filter(truthy), {
+ const executablePath = getExecutablePath(bin);
+ chmodSync(executablePath, 0o755);
+ return execa(executablePath, args.filter(truthy), {
...dynamicLibraryPathOptions(),
...options,
});
diff --git a/packages/renderer/src/compositor/compose.ts b/packages/renderer/src/compositor/compose.ts
index 5fc133985d..a81bb66b49 100644
--- a/packages/renderer/src/compositor/compose.ts
+++ b/packages/renderer/src/compositor/compose.ts
@@ -1,5 +1,6 @@
import {spawn} from 'node:child_process';
import {createHash} from 'node:crypto';
+import {chmodSync} from 'node:fs';
import {copyFile} from 'node:fs/promises';
import type {DownloadMap} from '../assets/download-map';
import {dynamicLibraryPathOptions} from '../call-ffmpeg';
@@ -70,11 +71,9 @@ export const compose = async ({
export const callCompositor = (payload: string) => {
return new Promise<void>((resolve, reject) => {
- const child = spawn(
- getExecutablePath('compositor'),
- [payload],
- dynamicLibraryPathOptions()
- );
+ const execPath = getExecutablePath('compositor');
+ chmodSync(execPath, 0o755);
+ const child = spawn(execPath, [payload], dynamicLibraryPathOptions());
child.stdin.write(payload);
child.stdin.end();
diff --git a/packages/renderer/src/compositor/compositor.ts b/packages/renderer/src/compositor/compositor.ts
index e91dad66cc..e5824267bd 100644
--- a/packages/renderer/src/compositor/compositor.ts
+++ b/packages/renderer/src/compositor/compositor.ts
@@ -1,4 +1,5 @@
import {spawn} from 'node:child_process';
+import {chmodSync} from 'node:fs';
import os from 'node:os';
import {dynamicLibraryPathOptions} from '../call-ffmpeg';
import {getActualConcurrency} from '../get-concurrency';
@@ -53,6 +54,7 @@ export const startCompositor = <T extends keyof CompositorCommand>(
payload: CompositorCommand[T]
): Compositor => {
const bin = getExecutablePath('compositor');
+ chmodSync(bin, 0o755);
const fullCommand: CompositorCommandSerialized<T> = serializeCommand(
type,