Skip to content

[BUG] Sound export issue #915

Open
Open

Description

@arka2518

Platform

MacOS 27

Browser

Chrome

Current Behavior

I am a first-time user of OpenCut, and the issue I am facing currently is about the audio, After the export, I observed that the videos and the audio of the music I there, but the audio of the videos are all missing i.e. if one or two words a spoken in a clip, the clip gets exported not its audio, This is my main issues. I would be happy if the developers can fix this problem, or correct me in the process of the export so that my clip and its audio both get exported.

Current Situation Update:
The problem remains the same, but now I'm also not able to export my video. Saying "Array buffer allocation failed".

Expected Behavior

As a first-time user of OpenCut, I expect that when I export my video project, both the video and its corresponding audio will be included seamlessly. This means that any spoken words or sounds present in the video clips should be exported alongside the video content. Additionally, I anticipate that the export process will run smoothly without any errors preventing me from completing the export. Overall, my expectation is that the final exported video will have both the visual elements and the full audio intact, creating a cohesive viewing experience.

Recurrence Probability

Always

Steps To Reproduce

.

Anything else?

No response

Activity

  1. neerajmaurya92084-ui commented on Oct 29, 2026

    @neerajmaurya92084-ui

    Array buffer allocation failed" crash and the missing clip audio issue in OpenCut, we need to address how WebAssembly handles large media buffers and audio mixing during export.

    Here is how you can implement the fix directly in your export pipeline:

    Step 1: Fix the "Array buffer allocation failed" (Memory OOM)
    This error happens because the browser's JavaScript engine / WebAssembly memory heap runs out of continuous address space when loading large uncompressed files or frames into memory all at once.

    Instead of calling .arrayBuffer() on large files, stream the file or process it in chunks:

    TypeScript
    // BEFORE (Causes OOM on large files):
    // const buffer = await file.arrayBuffer();
    // await ffmpeg.writeFile('input.mp4', new Uint8Array(buffer));

    // AFTER (Stream or chunk processing):
    async function writeLargeFileToFFmpeg(ffmpeg: any, file: File, targetName: string) {
    const stream = file.stream();
    const reader = stream.getReader();

    // Open file sink in FFmpeg virtual filesystem
    const chunks: Uint8Array[] = [];
    while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    chunks.push(value);
    }

    // Concatenate safely or write block-by-block if using direct streams
    const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
    const combined = new Uint8Array(totalLength);
    let offset = 0;
    for (const chunk of chunks) {
    combined.set(chunk, offset);
    offset += chunk.length;
    }

    await ffmpeg.writeFile(targetName, combined);
    }
    If you are building OpenCut using Emscripten/FFmpeg.wasm, also make sure your compilation or worker config allows memory growth:

    JavaScript
    // In your ffmpeg core initialization options:
    const ffmpeg = new FFmpeg();
    await ffmpeg.load({
    coreURL: await toBlobURL(.../ffmpeg-core.js, 'text/javascript'),
    wasmURL: await toBlobURL(.../ffmpeg-core.wasm, 'application/wasm'),
    });
    Step 2: Fix the Missing Native Video Audio
    Background music tracks likely export fine because they are added as a distinct audio track, whereas native clip audio often gets dropped if the export mapping (-map) only targets the primary video stream or ignores embedded audio streams from individual video clips.

    When constructing your FFmpeg export command, make sure you explicitly map both the video stream and the audio streams (or mix audio streams using an amix filter if you have background music + clip dialogue):

    TypeScript
    // Example FFmpeg command fix for exporting video with both original clip audio and background music
    const args = [
    '-i', 'input_video.mp4',
    '-i', 'background_music.mp3',
    // Map video stream 0
    '-map', '0:v',
    // Map and mix audio: stream 0's audio (clip dialogue) AND stream 1's audio (BGM)
    '-filter_complex', '[0:a][1:a]amix=inputs=2:duration=first[outa]',
    '-map', '[outa]',
    '-c:v', 'libx264',
    '-c:a', 'aac',
    'output.mp4'
    ];

    await ffmpeg.exec(args);
    If clips don't have an audio stream, -map 0:a might throw an error if not handled conditionally. You can check if the video file contains an audio stream first using ffprobe or inspect the track metadata before building the -map arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions