Skip to content

Commit 1128519

Browse files
committed
🐛 fix: 修复双倍输出时音轨合并逻辑错误
修正双倍输出时音轨合并逻辑,确保带_WITHAMIX后缀的输出强制使用多音轨合并,而主输出使用用户设置的状态。同时优化文件后缀处理逻辑。
1 parent 8234b1e commit 1128519

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/SimpleCutMainFrame.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,21 +193,29 @@ def on_export_button_click(self, event):
193193

194194
paths = [export_name]
195195

196-
if export_double_output:
197-
# 如果导出双倍输出,则添加后缀
198-
paths.append(export_name + '_WITHAMIX')
199-
200196
# 如果没有后缀 添加类型后缀
201-
for it in paths:
202-
if '.' not in export_name:
203-
it += '.mp4'
197+
if '.' not in export_name:
198+
export_name += '.mp4'
199+
200+
# 获取后缀
201+
path_without_suffix, suffix = os.path.splitext(export_name)
202+
203+
if export_double_output:
204+
# 如果导出双倍输出,则给文件名添加后缀
205+
paths.append(path_without_suffix + '_WITHAMIX' + suffix)
204206

205207
# 导出
206208
for it in paths:
207-
if '_WITHAMIX' in paths:
208-
t = threading.Thread(target=self.export_video_file, args=(export_amix, export_mbps, it))
209+
# 第一个输出文件使用用户设置的amix状态
210+
# 第二个输出文件(带_WITHAMIX后缀)强制使用amix=True
211+
if '_WITHAMIX' in it:
212+
# 对于带_WITHAMIX后缀的输出,强制使用多音轨合并
213+
t = threading.Thread(
214+
target=self.export_video_file, args=(True, export_mbps, it))
209215
else:
210-
t = threading.Thread(target=self.export_video_file, args=(export_amix, export_mbps, export_name))
216+
# 使用用户设置的多音轨合并状态
217+
t = threading.Thread(target=self.export_video_file, args=(
218+
False, export_mbps, it))
211219
self.working_thread[it] = t
212220
t.start()
213221

0 commit comments

Comments
 (0)