Skip to content

feat: implement high-quality GIF export using two-pass FFmpeg pipeline#724

Open
Vagventure wants to merge 4 commits into
magic-peach:mainfrom
Vagventure:feat/ffmpeg-gif-export
Open

feat: implement high-quality GIF export using two-pass FFmpeg pipeline#724
Vagventure wants to merge 4 commits into
magic-peach:mainfrom
Vagventure:feat/ffmpeg-gif-export

Conversation

@Vagventure
Copy link
Copy Markdown
Contributor

Description

This PR introduces GIF export support to Reframe via a two-pass FFmpeg pipeline for accurate colour mapping, along with a GIF-aware size estimator and UI updates across the export panel and format selector.

Changes Made

  • src/lib/types.ts: Added "gif" to the format union in both EditRecipe and ExportResult. Previously ExportResult was missing "gif" despite EditRecipe already declaring it, which would have caused a TypeScript error on return.

  • src/lib/ffmpeg.ts:

    • Added "gif" case to getOutputConfig, returning .gif / image/gif.
    • Widened the format parameter of buildArguments to include "gif" for type safety.
    • Added paletteName (palette_<sessionId>.png) to cleanupFiles so the temporary palette is always deleted after export.
    • Inserted a two-pass GIF branch that runs before the standard MP4/WebM exec flow and returns early, keeping GIF fully isolated from the fallback/retry logic:
      • Pass 1 — runs palettegen through the existing buildVideoFilter output so all transforms (trim, scale, rotate, speed, colour corrections) are respected.
      • Pass 2 — applies paletteuse via -lavfi using the generated palette, producing a high-quality GIF with accurate colour mapping.
  • src/components/FormatSelector.tsx: Added "gif" to FORMAT_OPTIONS, changed the button grid from grid-cols-3 to grid-cols-4, and widened the onChange type cast to include "gif".

  • src/components/ExportSettings.tsx:

    • Derived isGif boolean from recipe.format === "gif".
    • Added a conditional amber warning below the estimated size when GIF is selected, advising users to keep clips under 10 seconds.
    • Hid the "Sound on completion" toggle when GIF is active (GIF carries no audio).

Related Issue

Closes #658

Type of Contribution

  • Bug fix
  • New feature
  • Documentation update
  • GSSoC contribution

Participant Info

  • GitHub username: Vagventure
  • Contribution level (Beginner/Intermediate/Advanced): Intermediate

Screen Recording

Recording / Loom link:

reframe_1920x1080.2.mp4

Checklist

  • I have read the contribution guidelines
  • My changes follow the project structure
  • I have tested my changes in Chrome, Firefox, and Safari
  • bun run lint passes (no ESLint errors)
  • bunx tsc --noEmit passes (no TypeScript errors)
  • New interactive elements have aria-label / accessible names
  • No console.log statements left in
  • This PR is related to a valid issue
  • Screen recording attached above (required for UI/feature/design changes)

Signed-off-by: Vagventure <ankitverma0366@gmail.com>
Signed-off-by: Vagventure <ankitverma0366@gmail.com>
Signed-off-by: Vagventure <ankitverma0366@gmail.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

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

👋 Thanks for your PR, @Vagventure!

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

🟠 GSSoC'26 PR detected — thanks for contributing under GirlScript Summer of Code 2026!

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

✅ PR Format Check Passed — @Vagventure

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:intermediate Intermediate level - 35 pts type:bug Bug fix type:design UI/UX design type:docs Documentation type:feature New feature type:performance Performance gssoc'26 GirlScript Summer of Code 2026 labels May 19, 2026
@magic-peach magic-peach added the gssoc:approved Approved for GSSoC'26 label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved for GSSoC'26 gssoc'26 GirlScript Summer of Code 2026 level:intermediate Intermediate level - 35 pts type:bug Bug fix type:design UI/UX design type:docs Documentation type:feature New feature type:performance Performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: GIF export support — add gif to format options via FFmpeg palette generation

2 participants