Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

fix(audio): Save Audio As no longer aborts the app, and is called that

Jareer539482010bae
diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.json
index d87980ed..4526f407 100644
--- a/src/crates/concat/locales/de.json
+++ b/src/crates/concat/locales/de.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "Nächster Key",
"keyframesPane.previousKey": "Vorheriger Key",
"keyframesPane.selectClipEditKeyframes": "Wähle einen Clip, um seine Keyframes zu bearbeiten",
- "lib.exportAudio": "Audio exportieren",
+ "lib.exportAudio": "Audio speichern unter",
"lib.fonts": "Schriften",
"lib.importFont": "Schrift importieren",
"lib.importMedia": "Medien importieren",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "{0} wird verbessert: {1}× unterwegs, Bild für Bild",
"studio.exit": "Beenden",
"studio.export": "Exportieren…",
- "studio.exportAudio": "Audio exportieren",
+ "studio.exportAudio": "Audio speichern unter…",
"studio.exportingAudio": "Audio wird exportiert…",
"studio.fileHasNoPicture": "Diese Datei hat kein Bild zum Verbessern",
"studio.fontImported": "{0} importiert; steht ab jetzt in der Schriftliste",
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index 8f906383..e519c5db 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "Next key",
"keyframesPane.previousKey": "Previous key",
"keyframesPane.selectClipEditKeyframes": "Select a clip to edit its keyframes",
- "lib.exportAudio": "Export audio",
+ "lib.exportAudio": "Save Audio As",
"lib.fonts": "Fonts",
"lib.importFont": "Import a font",
"lib.importMedia": "Import media",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "Enhancing {0}: {1}× on its way, frame by frame",
"studio.exit": "Exit",
"studio.export": "Export…",
- "studio.exportAudio": "Export Audio",
+ "studio.exportAudio": "Save Audio As…",
"studio.exportingAudio": "Exporting the audio…",
"studio.fileHasNoPicture": "This file has no picture to enhance",
"studio.fontImported": "{0} imported; it is in the font list from now on",
diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.json
index e65c5bf1..92ec0ef7 100644
--- a/src/crates/concat/locales/es.json
+++ b/src/crates/concat/locales/es.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "Fotograma clave siguiente",
"keyframesPane.previousKey": "Fotograma clave anterior",
"keyframesPane.selectClipEditKeyframes": "Selecciona un clip para editar sus fotogramas clave",
- "lib.exportAudio": "Exportar audio",
+ "lib.exportAudio": "Guardar audio como",
"lib.fonts": "Fuentes",
"lib.importFont": "Importar una fuente",
"lib.importMedia": "Importar medios",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "Mejorando {0}: {1}× en camino, fotograma a fotograma",
"studio.exit": "Salir",
"studio.export": "Exportar…",
- "studio.exportAudio": "Exportar audio",
+ "studio.exportAudio": "Guardar audio como…",
"studio.exportingAudio": "Exportando el audio…",
"studio.fileHasNoPicture": "Este archivo no tiene imagen que mejorar",
"studio.fontImported": "{0} importada; desde ahora está en la lista de fuentes",
diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.json
index 566f5ff1..3e04d2fc 100644
--- a/src/crates/concat/locales/fa.json
+++ b/src/crates/concat/locales/fa.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "کی‌فریم بعدی",
"keyframesPane.previousKey": "کی‌فریم قبلی",
"keyframesPane.selectClipEditKeyframes": "برای ویرایش کی‌فریم‌ها یک کلیپ انتخاب کنید",
- "lib.exportAudio": "خروجی صدا",
+ "lib.exportAudio": "ذخیره صدا به‌عنوان",
"lib.fonts": "قلم‌ها",
"lib.importFont": "وارد کردن قلم",
"lib.importMedia": "وارد کردن رسانه",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "در حال بهبود کیفیت {0}: {1}× در راه است، فریم به فریم",
"studio.exit": "خروج",
"studio.export": "خروجی گرفتن…",
- "studio.exportAudio": "خروجی صدا",
+ "studio.exportAudio": "ذخیره صدا به‌عنوان…",
"studio.exportingAudio": "در حال خروجی گرفتن از صدا…",
"studio.fileHasNoPicture": "این فایل تصویری برای بهبود کیفیت ندارد",
"studio.fontImported": "{0} وارد شد؛ از این پس در فهرست قلم‌ها است",
diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.json
index bab0d80e..54c10a76 100644
--- a/src/crates/concat/locales/fr.json
+++ b/src/crates/concat/locales/fr.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "Image clé suivante",
"keyframesPane.previousKey": "Image clé précédente",
"keyframesPane.selectClipEditKeyframes": "Sélectionnez un clip pour modifier ses images clés",
- "lib.exportAudio": "Exporter l’audio",
+ "lib.exportAudio": "Enregistrer l’audio sous",
"lib.fonts": "Polices",
"lib.importFont": "Importer une police",
"lib.importMedia": "Importer des médias",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "Amélioration de {0} : ×{1} en cours, image par image",
"studio.exit": "Quitter",
"studio.export": "Exporter…",
- "studio.exportAudio": "Exporter l’audio",
+ "studio.exportAudio": "Enregistrer l’audio sous…",
"studio.exportingAudio": "Export de l’audio…",
"studio.fileHasNoPicture": "Ce fichier n'a pas d'image à améliorer",
"studio.fontImported": "{0} importée ; elle figure désormais dans la liste des polices",
diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.json
index eb2f57b9..629d57b6 100644
--- a/src/crates/concat/locales/hr.json
+++ b/src/crates/concat/locales/hr.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "Sljedeći ključni kadar",
"keyframesPane.previousKey": "Prethodni ključni kadar",
"keyframesPane.selectClipEditKeyframes": "Odaberite klip za uređivanje njegovih ključnih kadrova",
- "lib.exportAudio": "Izvezi zvuk",
+ "lib.exportAudio": "Spremi zvuk kao",
"lib.fonts": "Fontovi",
"lib.importFont": "Uvezi font",
"lib.importMedia": "Uvezi medije",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "Poboljšavanje {0}: {1}× na putu, kadar po kadar",
"studio.exit": "Izlaz",
"studio.export": "Izvoz…",
- "studio.exportAudio": "Izvezi zvuk",
+ "studio.exportAudio": "Spremi zvuk kao…",
"studio.exportingAudio": "Izvoz zvuka…",
"studio.fileHasNoPicture": "Ova datoteka nema slike za poboljšanje",
"studio.fontImported": "{0} uvezen; od sada je na popisu fontova",
diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.json
index ac4899fb..344f3a69 100644
--- a/src/crates/concat/locales/it.json
+++ b/src/crates/concat/locales/it.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "Fotogramma chiave successivo",
"keyframesPane.previousKey": "Fotogramma chiave precedente",
"keyframesPane.selectClipEditKeyframes": "Seleziona una clip per modificarne i fotogrammi chiave",
- "lib.exportAudio": "Esporta audio",
+ "lib.exportAudio": "Salva audio come",
"lib.fonts": "Font",
"lib.importFont": "Importa un font",
"lib.importMedia": "Importa media",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "Miglioramento di {0}: {1}× in arrivo, fotogramma per fotogramma",
"studio.exit": "Esci",
"studio.export": "Esporta…",
- "studio.exportAudio": "Esporta audio",
+ "studio.exportAudio": "Salva audio come…",
"studio.exportingAudio": "Esportazione dell’audio…",
"studio.fileHasNoPicture": "Questo file non ha un'immagine da migliorare",
"studio.fontImported": "{0} importato; da ora è nell’elenco dei font",
diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.json
index 608d3961..8396bbe1 100644
--- a/src/crates/concat/locales/ja.json
+++ b/src/crates/concat/locales/ja.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "次のキー",
"keyframesPane.previousKey": "前のキー",
"keyframesPane.selectClipEditKeyframes": "クリップを選択するとキーフレームを編集できます",
- "lib.exportAudio": "音声を書き出す",
+ "lib.exportAudio": "音声を別名で保存",
"lib.fonts": "フォント",
"lib.importFont": "フォントを読み込む",
"lib.importMedia": "メディアを読み込む",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "{0} を高画質化中:{1}× をフレームごとに処理しています",
"studio.exit": "終了",
"studio.export": "書き出し…",
- "studio.exportAudio": "音声を書き出す",
+ "studio.exportAudio": "音声を別名で保存…",
"studio.exportingAudio": "音声を書き出しています…",
"studio.fileHasNoPicture": "このファイルには高画質化する映像がありません",
"studio.fontImported": "{0} を読み込みました。これ以降フォント一覧に表示されます",
diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.json
index 3adb618f..177b8504 100644
--- a/src/crates/concat/locales/ko.json
+++ b/src/crates/concat/locales/ko.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "다음 키",
"keyframesPane.previousKey": "이전 키",
"keyframesPane.selectClipEditKeyframes": "키프레임을 편집할 클립을 선택하세요",
- "lib.exportAudio": "오디오 내보내기",
+ "lib.exportAudio": "오디오를 다른 이름으로 저장",
"lib.fonts": "글꼴",
"lib.importFont": "글꼴 가져오기",
"lib.importMedia": "미디어 가져오기",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "{0} 향상 중: {1}×로 한 프레임씩 진행합니다",
"studio.exit": "끝내기",
"studio.export": "내보내기…",
- "studio.exportAudio": "오디오 내보내기",
+ "studio.exportAudio": "오디오를 다른 이름으로 저장…",
"studio.exportingAudio": "오디오를 내보내는 중…",
"studio.fileHasNoPicture": "이 파일에는 향상할 영상이 없습니다",
"studio.fontImported": "{0}을(를) 가져왔습니다. 이제부터 글꼴 목록에 표시됩니다",
diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.json
index 84113f37..5c8d6cda 100644
--- a/src/crates/concat/locales/pt-BR.json
+++ b/src/crates/concat/locales/pt-BR.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "Próximo quadro-chave",
"keyframesPane.previousKey": "Quadro-chave anterior",
"keyframesPane.selectClipEditKeyframes": "Selecione um clipe para editar seus quadros-chave",
- "lib.exportAudio": "Exportar áudio",
+ "lib.exportAudio": "Salvar áudio como",
"lib.fonts": "Fontes",
"lib.importFont": "Importar uma fonte",
"lib.importMedia": "Importar mídia",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "Melhorando {0}: {1}× a caminho, quadro a quadro",
"studio.exit": "Sair",
"studio.export": "Exportar…",
- "studio.exportAudio": "Exportar áudio",
+ "studio.exportAudio": "Salvar áudio como…",
"studio.exportingAudio": "Exportando o áudio…",
"studio.fileHasNoPicture": "Este arquivo não tem imagem para melhorar",
"studio.fontImported": "{0} importada; a partir de agora está na lista de fontes",
diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.json
index 164fbd8c..92f9ec04 100644
--- a/src/crates/concat/locales/ru.json
+++ b/src/crates/concat/locales/ru.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "Следующий ключевой кадр",
"keyframesPane.previousKey": "Предыдущий ключевой кадр",
"keyframesPane.selectClipEditKeyframes": "Выберите клип, чтобы редактировать его ключевые кадры",
- "lib.exportAudio": "Экспортировать звук",
+ "lib.exportAudio": "Сохранить аудио как",
"lib.fonts": "Шрифты",
"lib.importFont": "Импортировать шрифт",
"lib.importMedia": "Импорт медиа",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "Улучшение {0}: {1}× на подходе, кадр за кадром",
"studio.exit": "Выход",
"studio.export": "Экспорт…",
- "studio.exportAudio": "Экспортировать звук",
+ "studio.exportAudio": "Сохранить аудио как…",
"studio.exportingAudio": "Экспорт звука…",
"studio.fileHasNoPicture": "В этом файле нет картинки для улучшения",
"studio.fontImported": "{0} импортирован; теперь он в списке шрифтов",
diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.json
index e152b77d..b0504c88 100644
--- a/src/crates/concat/locales/tr.json
+++ b/src/crates/concat/locales/tr.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "Sonraki anahtar kare",
"keyframesPane.previousKey": "Önceki anahtar kare",
"keyframesPane.selectClipEditKeyframes": "Anahtar karelerini düzenlemek için bir klip seçin",
- "lib.exportAudio": "Sesi dışa aktar",
+ "lib.exportAudio": "Sesi farklı kaydet",
"lib.fonts": "Yazı tipleri",
"lib.importFont": "Yazı tipi içe aktar",
"lib.importMedia": "Medya içe aktar",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "{0} iyileştiriliyor: {1}× kare kare yolda",
"studio.exit": "Çıkış",
"studio.export": "Dışa aktar…",
- "studio.exportAudio": "Sesi dışa aktar",
+ "studio.exportAudio": "Sesi farklı kaydet…",
"studio.exportingAudio": "Ses dışa aktarılıyor…",
"studio.fileHasNoPicture": "Bu dosyanın iyileştirilecek görüntüsü yok",
"studio.fontImported": "{0} içe aktarıldı; artık yazı tipi listesinde",
diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.json
index 572ebd95..b4501dee 100644
--- a/src/crates/concat/locales/zh-Hans.json
+++ b/src/crates/concat/locales/zh-Hans.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "下一个关键帧",
"keyframesPane.previousKey": "上一个关键帧",
"keyframesPane.selectClipEditKeyframes": "选择一个片段以编辑其关键帧",
- "lib.exportAudio": "导出音频",
+ "lib.exportAudio": "音频另存为",
"lib.fonts": "字体",
"lib.importFont": "导入字体",
"lib.importMedia": "导入媒体",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "正在增强{0}:{1}× 逐帧处理中",
"studio.exit": "退出",
"studio.export": "导出…",
- "studio.exportAudio": "导出音频",
+ "studio.exportAudio": "音频另存为…",
"studio.exportingAudio": "正在导出音频…",
"studio.fileHasNoPicture": "此文件没有可增强的画面",
"studio.fontImported": "已导入 {0},从现在起会出现在字体列表中",
diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.json
index 90126205..b81a9401 100644
--- a/src/crates/concat/locales/zh-TW.json
+++ b/src/crates/concat/locales/zh-TW.json
@@ -601,7 +601,7 @@
"keyframesPane.nextKey": "下一個關鍵影格",
"keyframesPane.previousKey": "上一個關鍵影格",
"keyframesPane.selectClipEditKeyframes": "選取一個片段以編輯其關鍵影格",
- "lib.exportAudio": "匯出音訊",
+ "lib.exportAudio": "音訊另存為",
"lib.fonts": "字型",
"lib.importFont": "匯入字型",
"lib.importMedia": "匯入媒體",
@@ -862,7 +862,7 @@
"studio.enhancingWayFrameFrame": "正在增強{0}:{1}× 逐影格處理中",
"studio.exit": "結束",
"studio.export": "匯出…",
- "studio.exportAudio": "匯出音訊",
+ "studio.exportAudio": "音訊另存為…",
"studio.exportingAudio": "正在匯出音訊…",
"studio.fileHasNoPicture": "此檔案沒有可增強的畫面",
"studio.fontImported": "已匯入 {0},從現在起會出現在字型清單中",
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index 3e351631..dd56ed96 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -5379,34 +5379,58 @@ impl Studio {
.take(60)
.collect();
let suggested = format!("{}.wav", slug.trim());
- let file = if cfg!(any(target_os = "android", target_os = "ios")) {
- out_dir.join(&suggested)
- } else {
- let Some(chosen) = crate::platform::save_file(
- &t("lib.exportAudio"),
- &out_dir,
- &suggested,
- (t("lib.wavAudio").as_str(), &["wav"]),
- ) else {
- return;
- };
- if chosen
- .extension()
- .is_some_and(|ext| ext.eq_ignore_ascii_case("wav"))
- {
- chosen
+ // The dialog on the next turn of the event loop, never from here:
+ // this is reached from a right-click menu's row, which reports
+ // through a timer, and a blocking dialog opened inside a timer's
+ // callback spins the loop back into Slint's timers - "Recursion in
+ // timer code", and the app aborts (on macOS; Windows and Linux
+ // were spared only by their dialogs not pumping the loop).
+ let name = clip.name.clone();
+ let title = t("lib.exportAudio");
+ let family = t("lib.wavAudio");
+ crate::host::on_ui(move |studio, _, _| {
+ let file = if cfg!(any(target_os = "android", target_os = "ios")) {
+ out_dir.join(&suggested)
} else {
- chosen.with_extension("wav")
- }
- };
+ let Some(chosen) = crate::platform::save_file(
+ &title,
+ &out_dir,
+ &suggested,
+ (family.as_str(), &["wav"]),
+ ) else {
+ return;
+ };
+ if chosen
+ .extension()
+ .is_some_and(|ext| ext.eq_ignore_ascii_case("wav"))
+ {
+ chosen
+ } else {
+ chosen.with_extension("wav")
+ }
+ };
+ studio.write_clip_audio(&name, pieces, duration, file, out_dir);
+ });
+ }
+
+ /// Mixes `pieces` - one clip's sound, `duration` seconds of it - into
+ /// `file`, and puts the file in the bin, selected. The second half of
+ /// [`Studio::export_clip_audio`], after the person has said where.
+ fn write_clip_audio(
+ &mut self,
+ name: &str,
+ pieces: Vec<concat_media::audio::AudioClip>,
+ duration: f64,
+ file: std::path::PathBuf,
+ out_dir: std::path::PathBuf,
+ ) {
let out_dir = file
.parent()
.map(std::path::Path::to_path_buf)
.unwrap_or(out_dir);
let written = file.to_string_lossy().into_owned();
log::info!(
- "export audio: {} ({duration:.2}s, {} piece(s)) to {written}",
- clip.name,
+ "export audio: {name} ({duration:.2}s, {} piece(s)) to {written}",
pieces.len(),
);
self.notify(&t("studio.exportingAudio"), false);