Skip to content

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

fix(export): the resolution is the timeline's own, and the ladder reads as the project would come out

Jareere4d3507c8718
diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.json
index 9b017840..d63d384b 100644
--- a/src/crates/concat/locales/de.json
+++ b/src/crates/concat/locales/de.json
@@ -576,6 +576,7 @@
"export.showInFolder": "Im Ordner zeigen",
"export.smallest": "Am kleinsten",
"export.summary": "Zusammenfassung",
+ "export.timelineSize": "Zeitleiste",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "10-Bit-Farbe",
"export.toneMapped": "Tonegemappt, läuft überall",
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index 3535c6e5..b83694a6 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -576,6 +576,7 @@
"export.showInFolder": "Show in folder",
"export.smallest": "Smallest",
"export.summary": "Summary",
+ "export.timelineSize": "Timeline",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "10-bit colour",
"export.toneMapped": "Tone-mapped, plays anywhere",
diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.json
index 1bf4fbdb..12db5b78 100644
--- a/src/crates/concat/locales/es.json
+++ b/src/crates/concat/locales/es.json
@@ -576,6 +576,7 @@
"export.showInFolder": "Mostrar en la carpeta",
"export.smallest": "El más pequeño",
"export.summary": "Resumen",
+ "export.timelineSize": "Línea de tiempo",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "Color de 10 bits",
"export.toneMapped": "Convertido a SDR, se ve en todas partes",
diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.json
index 9c5a7d31..330c583c 100644
--- a/src/crates/concat/locales/fa.json
+++ b/src/crates/concat/locales/fa.json
@@ -576,6 +576,7 @@
"export.showInFolder": "نمایش در پوشه",
"export.smallest": "کوچک‌ترین",
"export.summary": "خلاصه",
+ "export.timelineSize": "خط زمان",
"export.targetBitrate": "نرخ بیت هدف",
"export.tenBitColour": "رنگ 10-bit",
"export.toneMapped": "با Tone Mapping، همه‌جا پخش می‌شود",
diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.json
index 57975ffe..aa8bec8e 100644
--- a/src/crates/concat/locales/fr.json
+++ b/src/crates/concat/locales/fr.json
@@ -576,6 +576,7 @@
"export.showInFolder": "Afficher dans le dossier",
"export.smallest": "Le plus petit",
"export.summary": "Résumé",
+ "export.timelineSize": "Timeline",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "Couleur 10 bits",
"export.toneMapped": "Ramené en SDR, lisible partout",
diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.json
index bac9f472..0d7318b7 100644
--- a/src/crates/concat/locales/hr.json
+++ b/src/crates/concat/locales/hr.json
@@ -576,6 +576,7 @@
"export.showInFolder": "Prikaži u mapi",
"export.smallest": "Najmanje",
"export.summary": "Sažetak",
+ "export.timelineSize": "Vremenska crta",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "10-bitna boja",
"export.toneMapped": "Mapirano u SDR, radi svugdje",
diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.json
index 393a5ed8..31215980 100644
--- a/src/crates/concat/locales/it.json
+++ b/src/crates/concat/locales/it.json
@@ -576,6 +576,7 @@
"export.showInFolder": "Mostra nella cartella",
"export.smallest": "Il più piccolo",
"export.summary": "Riepilogo",
+ "export.timelineSize": "Timeline",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "Colore a 10 bit",
"export.toneMapped": "Convertito in SDR, si vede ovunque",
diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.json
index 50e363de..345d9d13 100644
--- a/src/crates/concat/locales/ja.json
+++ b/src/crates/concat/locales/ja.json
@@ -576,6 +576,7 @@
"export.showInFolder": "フォルダで表示",
"export.smallest": "最小",
"export.summary": "概要",
+ "export.timelineSize": "タイムライン",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "10ビットカラー",
"export.toneMapped": "トーンマッピング済み、どこでも再生可",
diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.json
index 808b3e4a..f6df7ef7 100644
--- a/src/crates/concat/locales/ko.json
+++ b/src/crates/concat/locales/ko.json
@@ -576,6 +576,7 @@
"export.showInFolder": "폴더에서 보기",
"export.smallest": "가장 작음",
"export.summary": "요약",
+ "export.timelineSize": "타임라인",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "10비트 색상",
"export.toneMapped": "톤 매핑, 어디서나 재생",
diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.json
index 40b0c7ae..2632661d 100644
--- a/src/crates/concat/locales/pt-BR.json
+++ b/src/crates/concat/locales/pt-BR.json
@@ -576,6 +576,7 @@
"export.showInFolder": "Mostrar na pasta",
"export.smallest": "O menor",
"export.summary": "Resumo",
+ "export.timelineSize": "Linha do tempo",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "Cor de 10 bits",
"export.toneMapped": "Convertido para SDR, toca em qualquer lugar",
diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.json
index a6f69790..3fbf7ac6 100644
--- a/src/crates/concat/locales/ru.json
+++ b/src/crates/concat/locales/ru.json
@@ -576,6 +576,7 @@
"export.showInFolder": "Показать в папке",
"export.smallest": "Самый маленький",
"export.summary": "Сводка",
+ "export.timelineSize": "Таймлайн",
"export.targetBitrate": "Целевой битрейт",
"export.tenBitColour": "10-битный цвет",
"export.toneMapped": "Приведено к SDR, играет везде",
diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.json
index 8a06b920..e1d7b43e 100644
--- a/src/crates/concat/locales/tr.json
+++ b/src/crates/concat/locales/tr.json
@@ -576,6 +576,7 @@
"export.showInFolder": "Klasörde göster",
"export.smallest": "En küçük",
"export.summary": "Özet",
+ "export.timelineSize": "Zaman çizelgesi",
"export.targetBitrate": "Target bitrate",
"export.tenBitColour": "10 bit renk",
"export.toneMapped": "Ton eşlemeli, her yerde oynar",
diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.json
index 10978372..678643c1 100644
--- a/src/crates/concat/locales/zh-Hans.json
+++ b/src/crates/concat/locales/zh-Hans.json
@@ -576,6 +576,7 @@
"export.showInFolder": "在文件夹中显示",
"export.smallest": "最小",
"export.summary": "摘要",
+ "export.timelineSize": "时间线",
"export.targetBitrate": "目标码率",
"export.tenBitColour": "10 位色彩",
"export.toneMapped": "色调映射,随处可播",
diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.json
index 21983652..b6dac5e2 100644
--- a/src/crates/concat/locales/zh-TW.json
+++ b/src/crates/concat/locales/zh-TW.json
@@ -576,6 +576,7 @@
"export.showInFolder": "在資料夾中顯示",
"export.smallest": "最小",
"export.summary": "摘要",
+ "export.timelineSize": "時間軸",
"export.targetBitrate": "目標位元率",
"export.tenBitColour": "10 位元色彩",
"export.toneMapped": "色調映射,到處可播",
diff --git a/src/crates/concat/src/panes/export.rs b/src/crates/concat/src/panes/export.rs
index 5779c526..ee0fd2b0 100644
--- a/src/crates/concat/src/panes/export.rs
+++ b/src/crates/concat/src/panes/export.rs
@@ -25,6 +25,7 @@ use crate::studio::{
AUDIO_BPS, EXPORT_CRF, EXPORT_RATES, EXPORT_SHORT_SIDES, EXPORT_TIERS, Studio, home_folder,
};
use crate::ui::{ExportData, ExportPhase};
+use slint::{ModelRc, SharedString, VecModel};
/// Everything that can happen to the export sheet.
#[derive(Clone, Debug)]
@@ -139,11 +140,18 @@ impl ExportPane {
self.open = true;
self.phase = ExportPhase::Idle;
self.message.clear();
+ // The timeline's own size: the one rung that can be picked.
+ self.resolution = Self::own_rung(studio);
}
ExportMsg::Close => self.open = false,
ExportMsg::NameEdited(name) => self.name = name,
ExportMsg::ResolutionChanged(index) => {
- self.resolution = (index.max(0) as usize).min(3);
+ // Only the timeline's own rung is taken; the sheet greys the
+ // rest, and this is the same rule for a caller that did not.
+ let index = index.max(0) as usize;
+ if index == Self::own_rung(studio) {
+ self.resolution = index;
+ }
}
ExportMsg::RateChanged(index) => self.rate = (index.max(0) as usize).min(2),
ExportMsg::QualityChanged(index) => self.quality = (index.max(0) as usize).min(2),
@@ -216,11 +224,39 @@ impl ExportPane {
}
}
- /// The frame the export renders at: the sheet's short side, scaled
- /// along the project's aspect and rounded to even dimensions, which is
- /// what the encoder's chroma subsampling needs.
- pub fn size(&self, studio: &Studio) -> (u32, u32) {
- let short = EXPORT_SHORT_SIDES[self.resolution.min(EXPORT_SHORT_SIDES.len() - 1)];
+ /// The resolution ladder for this project: the standard short sides,
+ /// with the project's own among them where it is not already - a
+ /// custom frame has its own rung - from largest to smallest.
+ fn ladder(studio: &Studio) -> Vec<u32> {
+ let mut rungs: Vec<u32> = EXPORT_SHORT_SIDES.to_vec();
+ let own = Self::own_short(studio);
+ if !rungs.contains(&own) {
+ rungs.push(own);
+ }
+ rungs.sort_unstable_by(|a, b| b.cmp(a));
+ rungs
+ }
+
+ /// The project's short side, in pixels.
+ fn own_short(studio: &Studio) -> u32 {
+ let (width, height) = studio.output_size();
+ width.min(height).max(2)
+ }
+
+ /// The rung of the ladder that is the project's own size: the one
+ /// the sheet lets be picked, since an edit exports at the size it was
+ /// cut at. https://github.com/jub0t/Concat/issues/109
+ fn own_rung(studio: &Studio) -> usize {
+ let own = Self::own_short(studio);
+ Self::ladder(studio)
+ .iter()
+ .position(|rung| *rung == own)
+ .unwrap_or(0)
+ }
+
+ /// `short` scaled along the project's aspect and rounded to even
+ /// dimensions, which is what the encoder's chroma subsampling needs.
+ fn frame_for(studio: &Studio, short: u32) -> (u32, u32) {
let (project_w, project_h) = studio.output_size();
let (project_w, project_h) = (project_w.max(1) as f64, project_h.max(1) as f64);
let even = |side: f64| ((side / 2.0).round() as u32 * 2).max(2);
@@ -231,6 +267,14 @@ impl ExportPane {
}
}
+ /// The frame the export renders at: the sheet's rung of the ladder,
+ /// along the project's aspect.
+ pub fn size(&self, studio: &Studio) -> (u32, u32) {
+ let ladder = Self::ladder(studio);
+ let short = ladder[self.resolution.min(ladder.len() - 1)];
+ Self::frame_for(studio, short)
+ }
+
/// A rough size of the file at one quality tier, in bytes.
pub fn size_bytes(&self, studio: &Studio, tier: usize) -> f32 {
let (width, height) = self.size(studio);
@@ -423,6 +467,36 @@ impl ExportPane {
}
.into(),
resolution: self.resolution as i32,
+ resolutions: {
+ let sizes: Vec<SharedString> = Self::ladder(studio)
+ .iter()
+ .map(|rung| {
+ let (width, height) = Self::frame_for(studio, *rung);
+ format!("{width} × {height}").into()
+ })
+ .collect();
+ ModelRc::new(VecModel::from(sizes))
+ },
+ resolution_details: {
+ let names: Vec<SharedString> = Self::ladder(studio)
+ .iter()
+ .map(|rung| match rung {
+ 2160 => "4K".into(),
+ 1440 => "QHD".into(),
+ 1080 => "1080p".into(),
+ 720 => "720p".into(),
+ _ => t("export.timelineSize").into(),
+ })
+ .collect();
+ ModelRc::new(VecModel::from(names))
+ },
+ resolution_disabled: {
+ let own = Self::own_rung(studio);
+ let off: Vec<bool> = (0..Self::ladder(studio).len())
+ .map(|rung| rung != own)
+ .collect();
+ ModelRc::new(VecModel::from(off))
+ },
rate: self.rate as i32,
quality: self.quality as i32,
codec: concat_media::VideoCodec::ALL
diff --git a/src/crates/concat/ui/dialogs/export.slint b/src/crates/concat/ui/dialogs/export.slint
index e1373767..dffcf943 100644
--- a/src/crates/concat/ui/dialogs/export.slint
+++ b/src/crates/concat/ui/dialogs/export.slint
@@ -37,6 +37,12 @@ export struct ExportData {
/// "8 clips · 3 titles"
contents: string,
resolution: int,
+ /// the resolution ladder as this project would come out at each
+ /// rung - "1080 × 1920" on a 9:16 edit - with its names, and which
+ /// rungs cannot be picked: every one but the timeline's own
+ resolutions: [string],
+ resolution-details: [string],
+ resolution-disabled: [bool],
rate: int,
quality: int,
/// index into the codec list: H.264, HEVC, AV1
@@ -337,10 +343,15 @@ component OutputSection inherits DialogSection {
DialogRow {
label: I18n.t("export.resolution");
+ // The timeline's own size, and the ladder it sits on for scale:
+ // a 9:16 edit is 1080 × 1920, not 1920 × 1080, and it exports at
+ // the size it was cut at - the other rungs are shown and cannot be
+ // picked. https://github.com/jub0t/Concat/issues/109
Select {
current: root.data.resolution;
- options: ["3840 × 2160", "2560 × 1440", "1920 × 1080", "1280 × 720"];
- details: ["4K", "QHD", "1080p", "720p"];
+ options: root.data.resolutions;
+ details: root.data.resolution-details;
+ disabled: root.data.resolution-disabled;
changed(index) => { root.resolution-changed(index); }
}
}
diff --git a/src/crates/concat/ui/primitives/select.slint b/src/crates/concat/ui/primitives/select.slint
index 729ebb0f..19d66e71 100644
--- a/src/crates/concat/ui/primitives/select.slint
+++ b/src/crates/concat/ui/primitives/select.slint
@@ -31,6 +31,10 @@ export component Select inherits Rectangle {
/// `options` is fine; a row past its end simply has none.
in property <[Glyph]> icons;
in property <bool> enabled: true;
+ /// Rows that are shown and cannot be picked, by index: greyed, and a
+ /// press or Enter on one does nothing. Shorter than `options` leaves
+ /// the rest pickable.
+ in property <[bool]> disabled;
/// drop the field background, for a select used as panel chrome
in property <bool> flat;
/// Size `natural-width` to the current option rather than the widest.
@@ -112,8 +116,13 @@ export component Select inherits Rectangle {
animate background { duration: 120ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
+ /// Whether row `index` is one of the `disabled`.
+ pure function off(index: int) -> bool {
+ return index < root.disabled.length && root.disabled[index];
+ }
+
function commit(index: int) {
- if (index >= 0 && index < root.options.length) {
+ if (index >= 0 && index < root.options.length && !root.off(index)) {
root.current = index;
root.changed(index);
}
@@ -322,7 +331,8 @@ export component Select inherits Rectangle {
for option[index] in root.options: Rectangle {
height: root.row-h;
border-radius: Theme.r-sm;
- background: index == root.active ? Theme.accent : Colors.transparent;
+ background: index == root.active && !root.off(index)
+ ? Theme.accent : Colors.transparent;
HorizontalLayout {
padding-left: 6px;
@@ -341,7 +351,8 @@ export component Select inherits Rectangle {
Text {
horizontal-stretch: 1;
text: option;
- color: index == root.active ? Theme.on-accent : Theme.fg-muted;
+ color: root.off(index) ? Theme.fg-dim
+ : index == root.active ? Theme.on-accent : Theme.fg-muted;
font-size: Theme.fs;
vertical-alignment: center;
overflow: elide;
@@ -349,7 +360,7 @@ export component Select inherits Rectangle {
if index < root.details.length: Text {
text: root.details[index];
- color: index == root.active ? Theme.on-accent : Theme.fg-dim;
+ color: index == root.active && !root.off(index) ? Theme.on-accent : Theme.fg-dim;
font-family: Theme.font-technical;
font-size: Theme.fs-sm;
vertical-alignment: center;
@@ -366,11 +377,11 @@ export component Select inherits Rectangle {
}
TouchArea {
- mouse-cursor: pointer;
+ mouse-cursor: root.off(index) ? MouseCursor.default : MouseCursor.pointer;
// pointer-enter has no dedicated callback; has-hover
// drives the highlight instead.
changed has-hover => {
- if (self.has-hover) {
+ if (self.has-hover && !root.off(index)) {
root.active = index;
}
}