{"record":{"id":"6dcf8d2a90420036","repo":"remotion-dev/remotion","slug":"mediabunny-remux-did-not-return-an-output-buffer","errorCode":null,"errorMessage":"Mediabunny remux did not return an output buffer.","messagePattern":"Mediabunny remux did not return an output buffer\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/canvas-capture-extension/src/recorder.ts","lineNumber":380,"sourceCode":"\tconst remuxOutput = new Output({\n\t\tformat:\n\t\t\tformat === 'mp4'\n\t\t\t\t? new Mp4OutputFormat({metadataFormat: 'mdta'})\n\t\t\t\t: new WebMOutputFormat(),\n\t\ttarget: remuxTarget,\n\t});\n\tconst conversion = await Conversion.init({\n\t\tinput: remuxInput,\n\t\toutput: remuxOutput,\n\t\ttags: {\n\t\t\traw: {[CAPTURE_METADATA_TAG_KEY]: captureData},\n\t\t},\n\t\tshowWarnings: false,\n\t});\n\tawait conversion.execute();\n\n\tif (!remuxTarget.buffer) {\n\t\tthrow new Error('Mediabunny remux did not return an output buffer.');\n\t}\n\n\treturn new File([remuxTarget.buffer], filename, {\n\t\ttype: format === 'mp4' ? 'video/mp4' : 'video/webm',\n\t});\n};\n\nexport class CanvasCaptureRecorder {\n\treadonly #options: CanvasCaptureRecorderOptions;\n\t#recording: RecordingState | null = null;\n\t#recordingAction: Promise<void> = Promise.resolve();\n\t#disposed = false;\n\n\tconstructor(options: CanvasCaptureRecorderOptions) {\n\t\tthis.#options = options;\n\t\twindow.addEventListener('pointermove', this.#onCursorMove);\n\t\t// Native HTML drag-and-drop suppresses pointermove events while dragging.\n\t\twindow.addEventListener('dragover', this.#onCursorMove, true);","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/canvas-capture-extension/src/recorder.ts#L362-L398","documentation":"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`.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the primary encode buffer (error 68 path) succeeded and is non-empty before remux.","Upgrade/pin Mediabunny to a version where remux is stable.","Check the input/output format pair is supported for remux.","Re-run the capture; if persistent, gather Mediabunny warnings (`showWarnings: true`)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await finalizeWithRemux(recording);\n} catch (e) {\n  if (e instanceof Error && /remux did not return an output buffer/.test(e.message)) {\n    // fall back to the pre-remux buffer if available, or re-encode.\n  }\n  throw e;\n}","preventionTips":["Verify the encode buffer is non-empty before remuxing.","Pin Mediabunny; remux stability varies by version.","Enable showWarnings during remux to surface silent failures."],"tags":["canvas-capture","mediabunny","remux","buffer"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}