Skip to content

Fix: Allow exporting of videos with unknown duration (e.g. streaming WebM)#958

Merged
magic-peach merged 1 commit into
magic-peach:mainfrom
Sandeep6135:fix-unknown-duration-export
May 23, 2026
Merged

Fix: Allow exporting of videos with unknown duration (e.g. streaming WebM)#958
magic-peach merged 1 commit into
magic-peach:mainfrom
Sandeep6135:fix-unknown-duration-export

Conversation

@Sandeep6135
Copy link
Copy Markdown
Contributor

Description

This pull request fixes a critical bug where videos missing duration metadata (such as streaming WebM blobs where video.duration is Infinity) were completely blocked from being exported.

The Problem:
When extractMetadata encountered a video with Infinity duration, it correctly fell back to setting the duration to 0. However, the validation checks in useVideoEditor.ts rigidly enforced that trimStart (default 0) must be earlier than the duration. This caused 0 >= 0 to evaluate to true, instantly failing the validation and throwing a "Trim start time must be earlier than the end time" error, making these videos completely unexportable.

The Solution:
Updated the validation logic in useVideoEditor.ts to smartly bypass the duration constraint when duration === 0 (meaning it's unknown/missing metadata).

  • If the user sets a custom trimEnd, we still rigidly enforce trimStart < trimEnd.
  • If trimEnd is null and duration is missing, we safely allow the export to proceed to FFmpeg without failing the pre-flight checks.

Testing:

  • Verified that standard videos with valid durations still validate correctly.
  • Verified that videos with missing duration metadata (duration 0) no longer fail the initial export checks and proceed properly to the engine.

Closes #955.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

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

✅ PR Format Check Passed — @Sandeep6135

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
Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @Sandeep6135!

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! 🎉

@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
reframe Ready Ready Preview, Comment May 23, 2026 11:04am

@magic-peach magic-peach merged commit 85e6b35 into magic-peach:main May 23, 2026
12 checks passed
@Sandeep6135
Copy link
Copy Markdown
Contributor Author

@magic-peach I have starred the repo already.
However I can notice that you haven't added GSSoC labels(eg. gssoc:approved, gssoc, etc.) to this PR.
Kindly add them as they are evaluated and you know that better than anyone else in here.
Thank you!

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:testing Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Videos with unknown duration (Infinity) are entirely unexportable

2 participants