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
- Upload a video file to the editor.
- Scroll down to the "Image Overlay" section and upload an image (e.g., a logo).
- Position the overlay on the video preview.
- Go to the "Output format" section and select GIF.
- Click Export.
- 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?
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
GIFas 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
exportVideouses a dedicated two-pass logic (palettegenandpaletteuse) to generate high-quality GIFs. However, this custom branch entirely skips thebuildArguments()function and thefilter_complexstring, meaning theoverlayInputNameandoverlayOptionsvariables are never passed to FFmpeg.Steps to Reproduce
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(insideexportVideo), thevfWithPaletteUsefilter string needs to be updated to incorporate theoverlayfilter when an overlay image is provided, before passing the video stream topaletteuse. 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]paletteuseEnvironment
src/lib/ffmpeg.tsexportVideo(GIF Two-pass export block)Would you like me to submit a PR to resolve this?