Skip to content

fix: Large Video Uploads Can Freeze or Crash Browser During Waveform Generation#1471

Open
Krishnx21 wants to merge 2 commits into
magic-peach:mainfrom
Krishnx21:main
Open

fix: Large Video Uploads Can Freeze or Crash Browser During Waveform Generation#1471
Krishnx21 wants to merge 2 commits into
magic-peach:mainfrom
Krishnx21:main

Conversation

@Krishnx21
Copy link
Copy Markdown

Description

This PR fixes a performance and stability issue where large uploaded videos were fully loaded into memory and decoded immediately for waveform generation.

Problem

Previously, waveform generation started automatically whenever TrimControl mounted. Large video files (400–500 MB) were read entirely into memory using file.arrayBuffer() and decoded via decodeAudioData(), even if the user never opened the trim feature.

This behavior could lead to:

  • High memory consumption
  • UI freezing and poor responsiveness
  • Browser tab crashes on lower-memory devices
  • Unnecessary processing for users who never use trimming

Changes Made

  • Deferred waveform generation until it is actually needed.
  • Prevented unnecessary audio decoding during initial editor load.
  • Reduced memory usage by avoiding automatic processing of large uploaded files.
  • Improved overall editor responsiveness when handling large videos.
  • Preserved existing trimming functionality and waveform rendering behavior.

Testing

Verified the following scenarios:

  • Small video uploads continue to generate waveforms correctly.
  • Large video uploads no longer trigger immediate heavy processing on editor load.
  • Editor remains responsive when opening large files.
  • Trim functionality continues to work as expected when waveform generation is required.
  • No regressions observed in normal editing workflows.

Impact

This fix significantly improves the user experience when working with large video files by reducing unnecessary memory allocation and preventing browser freezes or crashes during project initialization.

Closes #1450

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@Krishnx21 is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

✅ PR Format Check Passed — @Krishnx21

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@github-actions github-actions Bot added level:beginner Beginner level - 20 pts type:bug Bug fix type:design UI/UX design type:feature New feature type:performance Performance type:testing Testing labels Jun 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

👋 Thanks for your PR, @Krishnx21!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@Krishnx21
Copy link
Copy Markdown
Author

@magic-peach can you please check this and let me know what i have to enhance ?

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

Labels

level:beginner Beginner level - 20 pts type:bug Bug fix type:design UI/UX design type:feature New feature type:performance Performance type:testing Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Large video uploads can freeze or crash browser during waveform generation

1 participant