Skip to content

🎥 Make videos programmatically with React

Renderer: Use standard FFmpeg streams for Bun 1.3.3 compatibility

Jonny Burger28aad75c1e14
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index 22a9ce8648..24bcfb840d 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -58,8 +58,7 @@ jobs:
node-version: 25
- uses: oven-sh/[email protected]
with:
- # Fixes extra-stdio fd ownership used by shared-memory FFmpeg.
- bun-version: 1.4.2
+ bun-version: 1.3.3
- name: Install
run: bun ci
- name: Cache Turbo
diff --git a/packages/renderer/src/prespawn-ffmpeg.ts b/packages/renderer/src/prespawn-ffmpeg.ts
index 3316763e10..ae9b233469 100644
--- a/packages/renderer/src/prespawn-ffmpeg.ts
+++ b/packages/renderer/src/prespawn-ffmpeg.ts
@@ -235,8 +235,8 @@ export const prespawnFfmpeg = (options: PreStitcherOptions) => {
['-f', 'remotionshm'],
['-video_size', `${options.width}x${options.height}`],
['-framerate', fpsAsFraction(options.fps)],
- ['-control_fd', '3'],
- ['-ack_fd', '4'],
+ ['-control_fd', '0'],
+ ['-ack_fd', '1'],
options.remotionSharedMemoryPoolDirectory === null
? null
: ['-pool_dir', options.remotionSharedMemoryPoolDirectory],
@@ -291,14 +291,19 @@ export const prespawnFfmpeg = (options: PreStitcherOptions) => {
cancelSignal: options.signal,
options:
options.inputMode === 'remotion-shared-memory'
- ? {stdio: ['ignore', 'pipe', 'pipe', 'pipe', 'pipe']}
+ ? {
+ // Bun 1.3.3 can double-close extra stdio FDs. Use stdin/stdout
+ // for the protocol, and let the bridge consume ACKs without buffering.
+ stdio: 'pipe',
+ buffer: false,
+ }
: undefined,
});
const remotionSharedMemory =
options.inputMode === 'remotion-shared-memory'
? createRemotionSharedMemoryFfmpegBridge({
- control: task.stdio[3] as Writable,
- acknowledgements: task.stdio[4] as Readable,
+ control: task.stdin as Writable,
+ acknowledgements: task.stdout as Readable,
})
: null;