remotion-dev/remotion · error · Error

Mediabunny remux did not return an output buffer.

Error message

Mediabunny remux did not return an output buffer.

What it means

After the capture is encoded, the recorder runs a second Mediabunny `Conversion` to remux the output with metadata tags (`CAPTURE_METADATA_TAG_KEY`) using `BufferTarget` again. If `remuxTarget.buffer` is falsy after `conversion.execute()`, the remux produced no data and the error is thrown before constructing the final `File`.

Source

Thrown at packages/canvas-capture-extension/src/recorder.ts:380

	const remuxOutput = new Output({
		format:
			format === 'mp4'
				? new Mp4OutputFormat({metadataFormat: 'mdta'})
				: new WebMOutputFormat(),
		target: remuxTarget,
	});
	const conversion = await Conversion.init({
		input: remuxInput,
		output: remuxOutput,
		tags: {
			raw: {[CAPTURE_METADATA_TAG_KEY]: captureData},
		},
		showWarnings: false,
	});
	await conversion.execute();

	if (!remuxTarget.buffer) {
		throw new Error('Mediabunny remux did not return an output buffer.');
	}

	return new File([remuxTarget.buffer], filename, {
		type: format === 'mp4' ? 'video/mp4' : 'video/webm',
	});
};

export class CanvasCaptureRecorder {
	readonly #options: CanvasCaptureRecorderOptions;
	#recording: RecordingState | null = null;
	#recordingAction: Promise<void> = Promise.resolve();
	#disposed = false;

	constructor(options: CanvasCaptureRecorderOptions) {
		this.#options = options;
		window.addEventListener('pointermove', this.#onCursorMove);
		// Native HTML drag-and-drop suppresses pointermove events while dragging.
		window.addEventListener('dragover', this.#onCursorMove, true);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Verify the primary encode buffer (error 68 path) succeeded and is non-empty before remux.
  2. Upgrade/pin Mediabunny to a version where remux is stable.
  3. Check the input/output format pair is supported for remux.
  4. Re-run the capture; if persistent, gather Mediabunny warnings (`showWarnings: true`).
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await finalizeWithRemux(recording);
} catch (e) {
  if (e instanceof Error && /remux did not return an output buffer/.test(e.message)) {
    // fall back to the pre-remux buffer if available, or re-encode.
  }
  throw e;
}

Prevention

When it happens

Trigger: The remux `Conversion` (input from the encode buffer, output to a BufferTarget) completes but yields no bytes — e.g., the input buffer was empty/corrupt, the remuxer rejected the input format, or a Mediabunny internal failure left the target empty.

Common situations: The first encode produced a buffer the remuxer could not parse; Mediabunny version mismatch between encode and remux paths; tag writing failed silently; format/container incompatibility.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/6dcf8d2a90420036. Report an issue: GitHub.