From 108895496fe84808bd08ee62544fc7a4879cb9e2 Mon Sep 17 00:00:00 2001 From: ax2bboud Date: Thu, 9 Apr 2026 23:14:07 -0400 Subject: [PATCH] feat: add support for GIF output format using ffmpeg conversion --- app.py | 15 +++++++++++++++ templates/index.html | 1 + 2 files changed, 16 insertions(+) diff --git a/app.py b/app.py index 703f435..428b91f 100644 --- a/app.py +++ b/app.py @@ -48,6 +48,21 @@ def run_download(job_id, url, format_choice, format_id): target = [f for f in files if f.endswith(".mp4")] chosen = target[0] if target else files[0] + if format_choice == "gif": + gif_out = os.path.splitext(chosen)[0] + ".gif" + ffmpeg_cmd = [ + "ffmpeg", "-y", "-i", chosen, + "-vf", "fps=15,scale=w='min(480,iw)':h=-2:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse", + gif_out + ] + ff_res = subprocess.run(ffmpeg_cmd, capture_output=True, text=True) + if ff_res.returncode != 0: + job["status"] = "error" + job["error"] = "Failed to create GIF" + return + chosen = gif_out + files.append(gif_out) + for f in files: if f != chosen: try: diff --git a/templates/index.html b/templates/index.html index 0bae3d3..5af8324 100644 --- a/templates/index.html +++ b/templates/index.html @@ -394,6 +394,7 @@

ReClip

+