-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Description
- I have searched to see if a similar issue already exists.
Is your feature request related to a problem? Please describe.
Yes. The gr.Video component’s watermark option only allows a hardcoded set of image extensions. In gradio/components/video.py (around lines 207–219), validation is:
# TODO: Check other image extensions to see if they work.
valid_watermark_extensions = [".png", ".jpg", ".jpeg"]
if self.watermark.watermark is not None:
...
if Path(self.watermark.watermark).suffix not in valid_watermark_extensions:
raise ValueError(
f"Watermark file does not have a supported extension. "
f"Expected one of {','.join(valid_watermark_extensions)}. "
f"Received: {Path(self.watermark.watermark).suffix}."
)Problems this causes:
- Unnecessary restriction — FFmpeg (used for the overlay) supports many image formats (e.g. WebP, GIF, BMP, TIFF). Users with WebP or other common formats get a clear error instead of the watermark working.
- Inconsistent with docs — The docstring says “Valid formats for the image are: jpeg, png.” Expanding support would require updating the docs, but the real issue is the code restrictiveness.
- Poor UX — Rejecting valid image files by extension alone forces users to convert to PNG/JPEG even when the pipeline could accept more formats.
So the limitation is mostly from the current allowlist and the TODO, not from a known technical constraint.
Describe the solution you'd like
Test which image formats FFmpeg’s overlay filter accepts for the watermark (e.g. WebP, GIF, BMP, TIFF, and any others that are safe and common). Add those extensions to valid_watermark_extensions (or a shared constant) so they are accepted by the Python validation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels