From 0f8751a2f262b1c33af06456ffe07d6b57e2e4b1 Mon Sep 17 00:00:00 2001 From: wood chen Date: Thu, 22 May 2025 10:51:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(gui):=20=E6=9B=B4=E6=96=B0=20FFmpeg=20?= =?UTF-8?q?=E8=B0=83=E8=89=B2=E6=9D=BF=E7=94=9F=E6=88=90=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=B9=B6=E6=94=B9=E8=BF=9B=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + gui.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1ed535d..e448263 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__/gui.cpython-311.pyc +ffmpeg diff --git a/gui.py b/gui.py index b93856c..de17910 100644 --- a/gui.py +++ b/gui.py @@ -224,11 +224,11 @@ class VideoToGifConverter: """根据质量设置返回 FFmpeg 调色板生成参数""" quality = self.quality_var.get() if quality == "high": - return "stats_mode=full:dither=sierra2_4a" + return "max_colors=256" elif quality == "medium": - return "stats_mode=diff:dither=bayer:bayer_scale=3" + return "max_colors=128" else: - return "stats_mode=single:dither=bayer:bayer_scale=5" + return "max_colors=64" def validate_inputs(self): """验证输入参数""" @@ -358,10 +358,13 @@ class VideoToGifConverter: else 0 ), ) - _, stderr = process.communicate() + stdout, stderr = process.communicate() if process.returncode != 0: - raise RuntimeError(f"调色板生成失败: {stderr.decode()}") + error_msg = stderr.decode() + print(f"调色板生成命令: {' '.join(palette_cmd)}") + print(f"错误输出: {error_msg}") + raise RuntimeError(f"调色板生成失败: {error_msg}") # 更新状态显示 self.status_label.config(