Skip to content

[BUG] Image Overlays are silently dropped during GIF exports #1578

@Abhishek2005-ard

Description

@Abhishek2005-ard

Describe the Bug

The application features an "Image Overlay" tool that allows users to position a custom image or logo over their video. However, if the user selects GIF as the export format, the overlay is completely ignored, and the exported GIF will not contain the uploaded image.

This happens because the GIF export pipeline in exportVideo uses a dedicated two-pass logic (palettegen and paletteuse) to generate high-quality GIFs. However, this custom branch entirely skips the buildArguments() function and the filter_complex string, meaning the overlayInputName and overlayOptions variables are never passed to FFmpeg.

Steps to Reproduce

  1. Upload a video file to the editor.
  2. Scroll down to the "Image Overlay" section and upload an image (e.g., a logo).
  3. Position the overlay on the video preview.
  4. Go to the "Output format" section and select GIF.
  5. Click Export.
  6. View the resulting GIF—the image overlay is completely missing.

Expected Behavior

The exported GIF should retain the image overlay in the exact position, size, and opacity specified by the user, just like it does for MP4, WebM, and MKV exports.

Proposed Fix

In src/lib/ffmpeg.ts (inside exportVideo), the vfWithPaletteUse filter string needs to be updated to incorporate the overlay filter when an overlay image is provided, before passing the video stream to paletteuse. Additionally, the overlay image needs to be mapped as an input stream to the FFmpeg execution arguments for the second pass.

For example, the filter chain could be updated to:
[0:v][2:v]overlay=W-w-20:H-h-20[with_overlay]; [with_overlay][1:v]paletteuse

Environment

  • File: src/lib/ffmpeg.ts
  • Module: exportVideo (GIF Two-pass export block)

Would you like me to submit a PR to resolve this?

Metadata

Metadata

Labels

bugSomething isn't working correctlytype:bugBug fix

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions