Skip to content

Trim tool drops the audio from every trim after the first #3432

Open

Description

@patrickballard

Description

On https://cap.so/tools/trim, the first trim of a video keeps its audio, but every later trim in the same visit comes out silent, both after "Trim Again" on the same video and after "Choose Different Video" with a new one. The page shows "Video trimmed successfully!" either way.

Trimming a 6-second MP4 with a 440 Hz tone (H.264 + AAC) on cap.so today, full length each time:

trim tracks in the download
first H.264 video + Opus audio
after Trim Again H.264 video only
after Choose Different Video H.264 video only

processTrim in apps/web/components/tools/TrimmingTool.tsx routes the preview's audio into the recording by calling audioContext.createMediaElementSource(video) on every trim. The preview <video> stays mounted for the whole visit, and a media element can only ever be connected to one MediaElementAudioSourceNode, so from the second trim on that call throws InvalidStateError. The catch around it logs the error and the recording goes ahead without audio.

Reproduction

  1. Open https://cap.so/tools/trim and load a video with sound.
  2. Trim it, click Trim Again, and trim it again.
  3. The second download has no audio track.

I've opened a PR that fixes this; it's linked below.

Activity

  1. linear commented on Oct 26, 2026

    @linear
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions