mirror of
https://github.com/woodchen-ink/video2gif.git
synced 2025-07-18 21:52:03 +08:00
Compare commits
11 Commits
v1.0.0-f08
...
main
Author | SHA1 | Date | |
---|---|---|---|
5f5e5350a7 | |||
7808d7a555 | |||
78a6ec111f | |||
d407d3f72e | |||
163f71564f | |||
861b4af2d2 | |||
0f8751a2f2 | |||
302dbc805f | |||
6d8fb24807 | |||
|
06ba7c7cea | ||
7647d15c52 |
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "pip" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "daily"
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
__pycache__/gui.cpython-311.pyc
|
||||
ffmpeg/ffmpeg.exe
|
||||
|
46
gui.py
46
gui.py
@ -140,22 +140,6 @@ class VideoToGifConverter:
|
||||
self.duration_entry.pack(side="left", padx=5)
|
||||
ttk.Label(duration_frame, text="(留空表示全部)").pack(side="left", padx=5)
|
||||
|
||||
# 质量设置
|
||||
quality_frame = ttk.Frame(self.settings_frame)
|
||||
quality_frame.pack(fill="x", padx=5, pady=5)
|
||||
|
||||
ttk.Label(quality_frame, text="质量设置:").pack(side="left", padx=5)
|
||||
self.quality_var = tk.StringVar(value="medium")
|
||||
ttk.Radiobutton(
|
||||
quality_frame, text="高质量", variable=self.quality_var, value="high"
|
||||
).pack(side="left", padx=5)
|
||||
ttk.Radiobutton(
|
||||
quality_frame, text="中等", variable=self.quality_var, value="medium"
|
||||
).pack(side="left", padx=5)
|
||||
ttk.Radiobutton(
|
||||
quality_frame, text="低质量", variable=self.quality_var, value="low"
|
||||
).pack(side="left", padx=5)
|
||||
|
||||
# 输出设置
|
||||
output_frame = ttk.Frame(self.settings_frame)
|
||||
output_frame.pack(fill="x", padx=5, pady=5)
|
||||
@ -220,16 +204,6 @@ class VideoToGifConverter:
|
||||
for file in files:
|
||||
self.files_list.insert(tk.END, file)
|
||||
|
||||
def get_quality_settings(self):
|
||||
"""根据质量设置返回 FFmpeg 参数"""
|
||||
quality = self.quality_var.get()
|
||||
if quality == "high":
|
||||
return ["-quality", "100"]
|
||||
elif quality == "medium":
|
||||
return ["-quality", "75"]
|
||||
else:
|
||||
return ["-quality", "50"]
|
||||
|
||||
def validate_inputs(self):
|
||||
"""验证输入参数"""
|
||||
try:
|
||||
@ -335,15 +309,22 @@ class VideoToGifConverter:
|
||||
# 打印命令用于调试
|
||||
print("调色板生成命令:", " ".join(palette_cmd))
|
||||
|
||||
# 创建 startupinfo 对象(用于隐藏 CMD 窗口)
|
||||
startupinfo = None
|
||||
if platform.system().lower() == "windows":
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||
# 运行调色板生成命令
|
||||
process = subprocess.Popen(
|
||||
palette_cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
startupinfo=(
|
||||
subprocess.STARTUPINFO()
|
||||
startupinfo=startupinfo,
|
||||
creationflags=(
|
||||
subprocess.CREATE_NO_WINDOW
|
||||
if platform.system().lower() == "windows"
|
||||
else None
|
||||
else 0
|
||||
),
|
||||
)
|
||||
_, stderr = process.communicate()
|
||||
@ -387,10 +368,11 @@ class VideoToGifConverter:
|
||||
gif_cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
startupinfo=(
|
||||
subprocess.STARTUPINFO()
|
||||
startupinfo=startupinfo,
|
||||
creationflags=(
|
||||
subprocess.CREATE_NO_WINDOW
|
||||
if platform.system().lower() == "windows"
|
||||
else None
|
||||
else 0
|
||||
),
|
||||
)
|
||||
_, stderr = process.communicate()
|
||||
|
Loading…
x
Reference in New Issue
Block a user