The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
// SPDX-License-Identifier: AGPL-3.0-or-later
// SPDX-FileCopyrightText: 2026 Jareer Abdullah and Concat contributors
import { I18n } from "../i18n.slint";
import { Theme } from "../theme/theme.slint";
import { Glyph, Icon } from "../icons.slint";
import { Button, CopyChip, DialogRow, DialogSection, Field, Progress } from "../primitives/modal.slint";
import { NumberField } from "../primitives/number-field.slint";
import { Select } from "../primitives/select.slint";
import { Switch } from "../inspector/controls.slint";
import { PaneScroll } from "../workspace/pane.slint";
import { Fmt } from "../util.slint";
// The export sheet.
//
// It states the format, asks where the file goes and at what bitrate, and
// starts. What the file will weigh is on the Export button, because that is
// the thing the bitrate decides.
//
// It covers the window and slides up from the bottom edge, and its groups
// are laid out across the width rather than down it: three columns on a
// laptop, two on a narrow window, and one that scrolls on a phone held
// upright. The footer - the Export button, the progress, the result -
// stays pinned under them whatever the body is doing.
export enum ExportPhase { idle, running, done, failed }
export struct ExportData {
open: bool,
/// the file name, without folder or extension
name: string,
/// the whole path, already shortened for display by whoever owns it
path: string,
/// "1920 x 1080 · 30.00 fps"
format: string,
duration: string,
/// "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],
rate: int,
/// the rates offered, the timeline's own first, with its name under
/// it; the export is at the timeline's rate unless another is picked
rates: [string],
rate-details: [string],
/// index into the codec list: H.264, HEVC, AV1, ProRes 4444, VP9 alpha
codec: int,
/// Which of them this device can encode. A phone's chip may lack
/// HEVC or AV1; the picker says so rather than failing on Export.
h264-encodable: bool,
hevc-encodable: bool,
av1-encodable: bool,
/// The two that keep a transparent frame's alpha (#456): ProRes 4444
/// in a .mov, and VP9 with alpha in a .webm, which a phone's FFmpeg
/// does not carry.
prores-encodable: bool,
vp9-alpha-encodable: bool,
/// The timeline's canvas lets something show through.
see-through: bool,
/// The codec picked keeps alpha.
keeps-alpha: bool,
/// The codec picked is held to a bitrate; ProRes is not, its profile
/// sets its rate.
rate-controlled: bool,
ten-bit: bool,
/// The timeline is HDR, so the file can be written HDR or SDR.
hdr-timeline: bool,
/// It is being written HDR: ten bits, HEVC or AV1.
hdr: bool,
/// This platform can write ten bits at all. A phone's hardware
/// encoders take eight, so neither the switch nor HDR is offered there.
deep-available: bool,
/// "HDR (HLG)" or "HDR (PQ)": the timeline's own.
hdr-label: string,
/// The bitrate the file is written at, in Mbps.
target: float,
/// "HEVC 10-bit · hardware": what the file will be encoded as
encoding: string,
/// What the file will weigh at the bitrate.
size-chosen: string,
phase: ExportPhase,
/// 0..1
progress: float,
/// "Rendering video"
stage: string,
eta: string,
/// why it failed, when it did
message: string,
done-size: string,
/// nothing on the timeline to export
empty: bool,
}
// One tile of the summary block.
//
// The block is a rounded rectangle in the hairline colour with 1px gaps
// between its rows, so the separators are the ground showing through rather
// than lines drawn on top — which is why the rules stop exactly at the rounded
// corners instead of running into them.
component Fact inherits Rectangle {
in property <string> label;
in property <string> value;
height: 34px;
background: Theme.raised;
HorizontalLayout {
padding-left: 12px;
padding-right: 12px;
spacing: 12px;
Text {
text: root.label;
color: Theme.fg-muted;
font-size: Theme.fs-sm;
vertical-alignment: center;
}
Rectangle { horizontal-stretch: 1; }
Text {
text: root.value;
color: Theme.fg;
font-family: Theme.font-technical;
font-size: Theme.fs-sm;
vertical-alignment: center;
overflow: elide;
}
}
}
// ── the groups ───────────────────────────────────────────────────────────
//
// One component each, so the sheet can deal them into however many columns
// its width holds without writing any of them twice.
// The picture at the playhead, small, and a strip to scrub it: a last
// look at the cut before the file is written, without leaving the sheet.
// The frame is the monitor's own, which keeps drawing under the sheet.
component PreviewSection inherits DialogSection {
in property <image> frame;
in property <float> playhead;
in property <float> duration;
in property <float> frame-rate;
/// The frame lets something show through (#456): a checker under it,
/// as on the monitor.
in property <bool> see-through;
callback seek(seconds: float);
title: I18n.t("common.preview");
property <float> share: root.duration > 0
? Math.clamp(root.playhead / root.duration, 0, 1) : 0;
Rectangle {
height: self.width * 9 / 16;
border-radius: Theme.r;
background: Theme.stage;
clip: true;
// Under the frame's own rectangle, not the letterbox around it.
if root.see-through && root.frame.width > 0: Image {
property <float> aspect: root.frame.width / Math.max(1, root.frame.height);
width: Math.min(parent.width, parent.height * self.aspect);
height: Math.min(parent.height, parent.width / self.aspect);
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
source: @image-url("../assets/checker.png");
horizontal-tiling: repeat;
vertical-tiling: repeat;
}
Image {
width: 100%;
height: 100%;
source: root.frame;
image-fit: contain;
}
}
// The scrub strip: the playhead's share of the cut, dragged.
Rectangle {
height: 24px;
track := Rectangle {
x: 0;
y: (parent.height - self.height) / 2;
width: parent.width;
height: 4px;
border-radius: 2px;
background: Theme.line-strong;
Rectangle {
x: 0;
y: 0;
width: parent.width * root.share;
height: parent.height;
border-radius: 2px;
background: Theme.accent;
}
}
Rectangle {
x: track.width * root.share - self.width / 2;
y: (parent.height - self.height) / 2;
width: 12px;
height: 12px;
border-radius: 6px;
background: Theme.accent;
}
TouchArea {
mouse-cursor: pointer;
pointer-event(event) => {
if (event.kind == PointerEventKind.down) {
root.seek(Math.clamp(self.mouse-x / self.width, 0, 1) * root.duration);
}
}
moved => {
if (self.pressed) {
root.seek(Math.clamp(self.mouse-x / self.width, 0, 1) * root.duration);
}
}
}
}
Text {
text: Fmt.frames-timecode(root.playhead, root.frame-rate)
+ " / " + Fmt.frames-timecode(root.duration, root.frame-rate);
color: Theme.fg-dim;
font-family: Theme.font-technical;
font-size: Theme.fs-sm;
}
}
component SummarySection inherits DialogSection {
in property <ExportData> data;
title: I18n.t("export.summary");
Rectangle {
border-radius: Theme.r;
// The ground the 1px gaps show through.
background: Theme.line;
clip: true;
VerticalLayout {
spacing: 1px;
Fact { label: I18n.t("export.format"); value: root.data.format + " · " + root.data.encoding; }
Fact { label: I18n.t("common.duration"); value: root.data.duration; }
Fact { label: I18n.t("export.contents"); value: root.data.contents; }
}
}
}
component DestinationSection inherits DialogSection {
in property <ExportData> data;
/// A phone has no folder picker: the file goes where the path under
/// the field says, so there is no Browse to press.
in property <bool> phone;
callback name-edited(name: string);
callback browse();
title: I18n.t("export.destination");
DialogRow {
Field {
value: root.data.name;
technical: true;
edited(text) => { root.name-edited(text); }
}
if !root.phone: Button {
label: I18n.t("export.browse");
glyph: Glyph.import;
clicked => { root.browse(); }
}
}
// The whole path under the field rather than in it, so the part
// you are editing is never the part that gets truncated away.
Text {
text: root.data.path;
color: Theme.fg-dim;
font-family: Theme.font-technical;
font-size: Theme.fs-sm;
overflow: elide;
}
}
component OutputSection inherits DialogSection {
in property <ExportData> data;
callback rate-changed(index: int);
callback bitrate-changed(mbps: float);
callback codec-changed(index: int);
callback ten-bit-changed(on: bool);
callback hdr-changed(on: bool);
title: I18n.t("export.output");
DialogRow {
label: I18n.t("export.resolution");
// The timeline's own size, which is the size it exports at: a
// 9:16 edit is 1080 × 1920. A fact, not a choice.
// https://github.com/jub0t/Concat/issues/109
HorizontalLayout {
alignment: end;
Text {
text: root.data.resolutions[root.data.resolution];
color: Theme.fg;
font-family: Theme.font-technical;
font-size: Theme.fs;
vertical-alignment: center;
}
}
}
DialogRow {
label: I18n.t("common.frameRate");
Select {
current: root.data.rate;
options: root.data.rates;
details: root.data.rate-details;
changed(index) => { root.rate-changed(index); }
}
}
// An HDR timeline is written as it is by default, or rolled off
// to SDR for wherever HDR does not play.
if root.data.hdr-timeline && root.data.deep-available: DialogRow {
label: I18n.t("common.color");
Select {
current: root.data.hdr ? 0 : 1;
options: [root.data.hdr-label, "SDR"];
details: [I18n.t("export.asTheTimeline"), I18n.t("export.toneMapped")];
changed(index) => { root.hdr-changed(index == 0); }
}
}
// The standard, not the encoder: which encoder makes it is the
// platform's business, and the Format line says when the hardware
// one will. H.264 is left out of an HDR file, which it does not
// carry.
if !root.data.hdr: DialogRow {
label: I18n.t("export.codec");
Select {
current: root.data.codec;
options: ["H.264", "HEVC", "AV1", "ProRes 4444", "VP9 alpha"];
details: [
root.data.h264-encodable ? I18n.t("export.playsEverywhere") : I18n.t("export.notOnThisDevice"),
root.data.hevc-encodable ? I18n.t("export.halfTheSize") : I18n.t("export.notOnThisDevice"),
root.data.av1-encodable ? I18n.t("export.smallest") : I18n.t("export.notOnThisDevice"),
root.data.prores-encodable ? I18n.t("export.keepsTransparencyMov") : I18n.t("export.notOnThisDevice"),
root.data.vp9-alpha-encodable ? I18n.t("export.keepsTransparencyWebm") : I18n.t("export.notOnThisDevice"),
];
changed(index) => { root.codec-changed(index); }
}
}
// A transparent timeline in a format that keeps no alpha: said before
// Export rather than found in the file.
if root.data.see-through && !root.data.keeps-alpha: Text {
text: I18n.t("export.noTransparency");
color: Theme.fg-dim;
font-size: Theme.fs-sm;
wrap: word-wrap;
}
if root.data.hdr: DialogRow {
label: I18n.t("export.codec");
Select {
current: root.data.codec - 1;
options: ["HEVC", "AV1"];
details: [
root.data.hevc-encodable ? I18n.t("export.halfTheSize") : I18n.t("export.notOnThisDevice"),
root.data.av1-encodable ? I18n.t("export.smallest") : I18n.t("export.notOnThisDevice"),
];
changed(index) => { root.codec-changed(index + 1); }
}
}
// The bitrate: what this frame and rate are uploaded at (YouTube's
// recommendation, which every platform takes) until it is dragged,
// stepped or typed to another. The encoder keeps to it as an average,
// so the size on the Export button is the size written.
if root.data.rate-controlled: DialogRow {
label: I18n.t("export.bitrate");
HorizontalLayout {
alignment: end;
NumberField {
width: 120px;
value: root.data.target;
minimum: 0.5;
maximum: 400;
step: 0.5;
precision: 1;
px-per-step: 4px;
unit: "Mbps";
changed(value) => { root.bitrate-changed(value); }
}
}
}
// HDR is ten bits always, so the switch is for SDR alone.
// The alpha codecs have their depth set: ProRes 4444 is ten bits,
// VP9 with alpha eight.
if !root.data.hdr && root.data.deep-available && !root.data.keeps-alpha: DialogRow {
label: I18n.t("export.tenBitColour");
HorizontalLayout {
alignment: end;
VerticalLayout {
alignment: center;
Switch {
checked: root.data.ten-bit;
toggled(on) => { root.ten-bit-changed(on); }
}
}
}
}
}
// What is under the groups: the failure, the progress, the result, and
// the button that starts it all.
component ExportFooter inherits VerticalLayout {
in property <ExportData> data;
/// The button runs the footer's width on a phone, and keeps to a
/// button's width on a desk, where the width would make it a banner.
in property <bool> narrow;
/// A phone has no file manager to show the file in.
in property <bool> phone;
callback begin();
callback cancel();
callback reveal();
callback again();
property <bool> running: root.data.phase == ExportPhase.running;
spacing: 10px;
// A failure says what went wrong where the action was, not in a
// separate alert to be dismissed before you can try again.
if root.data.phase == ExportPhase.failed: Rectangle {
border-radius: Theme.r;
background: Theme.danger-soft;
HorizontalLayout {
padding: 10px;
spacing: 8px;
VerticalLayout {
alignment: start;
Icon { glyph: Glyph.close; size: 13px; tint: Theme.danger; }
}
Text {
horizontal-stretch: 1;
text: root.data.message;
color: Theme.danger;
font-size: Theme.fs-sm;
wrap: word-wrap;
}
VerticalLayout {
alignment: start;
CopyChip { text: root.data.message; }
}
}
}
if root.running: HorizontalLayout {
spacing: 8px;
Text {
text: root.data.stage;
color: Theme.fg;
font-size: Theme.fs;
vertical-alignment: center;
}
Text {
horizontal-stretch: 1;
text: "\{Math.round(root.data.progress * 100)}%";
color: Theme.fg-muted;
font-family: Theme.font-technical;
font-size: Theme.fs;
vertical-alignment: center;
}
Text {
text: root.data.eta;
color: Theme.fg-muted;
font-family: Theme.font-technical;
font-size: Theme.fs;
vertical-alignment: center;
}
}
if root.running: Progress { value: root.data.progress; live: true; }
if root.running: HorizontalLayout {
alignment: start;
Button {
label: I18n.t("export.cancelExport");
glyph: Glyph.close;
ghost: true;
clicked => { root.cancel(); }
}
}
if root.data.phase == ExportPhase.done: HorizontalLayout {
spacing: 8px;
alignment: start;
VerticalLayout {
alignment: center;
Icon { glyph: Glyph.check; size: 15px; tint: Theme.green; }
}
Text {
text: I18n.t1("export.exported", "\{root.data.done-size}");
color: Theme.green;
font-size: Theme.fs;
font-weight: Theme.weight-title;
vertical-alignment: center;
}
}
if root.data.phase == ExportPhase.done: HorizontalLayout {
spacing: 6px;
alignment: start;
if !root.phone: Button {
label: I18n.t("export.showInFolder");
glyph: Glyph.import;
clicked => { root.reveal(); }
}
Button {
label: I18n.t("export.exportAgain");
ghost: true;
clicked => { root.again(); }
}
}
if root.data.phase == ExportPhase.idle || root.data.phase == ExportPhase.failed:
HorizontalLayout {
alignment: root.narrow ? stretch : end;
Button {
block: true;
primary: true;
large: true;
min-width: root.narrow ? 0px : 320px;
glyph: Glyph.export;
label: root.data.empty ? I18n.t("export.nothingToExport")
: I18n.t("export.exportEstimate") + root.data.size-chosen;
enabled: !root.data.empty && root.data.name != "";
clicked => { root.begin(); }
}
}
}
// Lays its children out at most `max` wide, centred in whatever width it
// is given: a sheet the width of a 4K monitor is not read across.
component Measure inherits HorizontalLayout {
in property <length> max: 1180px;
Rectangle { horizontal-stretch: 1; }
VerticalLayout {
max-width: root.max;
horizontal-stretch: 1000;
@children
}
Rectangle { horizontal-stretch: 1; }
}
export component ExportDialog inherits Rectangle {
in property <ExportData> data;
/// A finger drives it: the body scrolls under a drag as well as a wheel.
in property <bool> phone;
/// How far the system's bars reach into the window (its
/// safe-area-insets; zero on a desk). The sheet's panel runs behind
/// them; its header, its body and its buttons stay inside (#353).
in property <length> inset-top;
in property <length> inset-bottom;
in property <length> inset-left;
in property <length> inset-right;
/// The monitor's frame and where the playhead is, for the preview
/// group; a scrub there seeks the cut.
in property <image> preview-frame;
in property <float> playhead;
in property <float> duration-seconds;
in property <float> frame-rate;
callback seek(seconds: float);
callback closed();
callback name-edited(name: string);
callback browse();
callback rate-changed(index: int);
callback codec-changed(index: int);
callback ten-bit-changed(on: bool);
callback hdr-changed(on: bool);
callback bitrate-changed(mbps: float);
callback begin();
callback cancel();
callback reveal();
callback again();
property <bool> running: root.data.phase == ExportPhase.running;
/// How many columns the width holds. Three groups a column wide need
/// about 330px each; under two of those the sheet is a phone's single
/// column and scrolls.
property <int> columns: root.width >= 1080px ? 3 : root.width >= 720px ? 2 : 1;
/// How far down the sheet is, as a share of the window: 0 up, 1 gone.
/// A share rather than a length, so a window resized while the sheet is
/// away does not animate it back into view on the way to the new edge.
/// A quick start and a long settle: it arrives with a swoosh and lands
/// softly, and leaves the same way down.
property <float> lowered: root.data.open ? 0 : 1;
animate lowered { duration: 380ms; easing: cubic-bezier(0.16, 1, 0.3, 1); }
// Up while open, and while it is still sliding away after closing, so
// the way out is seen as well as the way in.
visible: root.data.open || root.lowered < 1;
sheet := Rectangle {
x: 0;
y: root.height * root.lowered;
width: root.width;
height: root.height;
background: Theme.panel;
// Nothing under the sheet takes a press while it is up.
TouchArea { }
VerticalLayout {
padding-top: root.inset-top;
padding-bottom: root.inset-bottom;
padding-left: root.inset-left;
padding-right: root.inset-right;
// ── the header ───────────────────────────────────────────────
Rectangle {
height: 52px;
Rectangle {
x: 0;
y: parent.height - 1px;
width: parent.width;
height: 1px;
background: Theme.line;
}
// The close on the trailing edge and the title centred
// against the whole strip. Nothing on the leading edge:
// that corner is the window's traffic lights on a Mac, and
// the format is in the Summary anyway.
HorizontalLayout {
padding-left: Theme.pad;
padding-right: 12px;
spacing: 8px;
Rectangle { horizontal-stretch: 1; }
// Gone, not disabled, while a job is running: there is
// no safe answer to pressing it, so it should not be
// there to press. It points down, the way the sheet
// leaves.
if !root.running: VerticalLayout {
alignment: center;
Rectangle {
width: 32px;
height: 32px;
border-radius: Theme.r-sm;
background: shut.has-hover ? Theme.field : Colors.transparent;
Icon {
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
glyph: Glyph.close;
size: 14px;
tint: shut.has-hover ? Theme.fg : Theme.fg-muted;
}
shut := TouchArea {
mouse-cursor: pointer;
clicked => { root.closed(); }
}
}
}
}
HorizontalLayout {
x: (parent.width - self.preferred-width) / 2;
y: 0;
width: self.preferred-width;
height: parent.height;
spacing: 8px;
VerticalLayout {
alignment: center;
Icon { glyph: Glyph.export; size: 16px; tint: Theme.accent; }
}
Text {
text: I18n.t("common.export");
color: Theme.fg;
font-size: Theme.fs-lg;
font-weight: Theme.weight-title;
vertical-alignment: center;
}
}
}
// ── the groups ───────────────────────────────────────────────
PaneScroll {
vertical-stretch: 1;
finger: root.phone;
Measure {
padding-top: 8px;
padding-bottom: 16px;
if root.running || root.columns == 1: VerticalLayout {
SummarySection { first: true; data: root.data; }
if !root.running: DestinationSection {
data: root.data;
phone: root.phone;
name-edited(name) => { root.name-edited(name); }
browse => { root.browse(); }
}
if !root.running: OutputSection {
data: root.data;
bitrate-changed(mbps) => { root.bitrate-changed(mbps); }
rate-changed(index) => { root.rate-changed(index); }
codec-changed(index) => { root.codec-changed(index); }
ten-bit-changed(on) => { root.ten-bit-changed(on); }
hdr-changed(on) => { root.hdr-changed(on); }
}
}
// Two columns: the picture, what it is and where it
// goes on the left; how it is written on the right.
if !root.running && root.columns == 2: HorizontalLayout {
spacing: 12px;
VerticalLayout {
alignment: start;
horizontal-stretch: 1;
PreviewSection {
first: true;
frame: root.preview-frame;
playhead: root.playhead;
duration: root.duration-seconds;
frame-rate: root.frame-rate;
see-through: root.data.see-through;
seek(seconds) => { root.seek(seconds); }
}
SummarySection { data: root.data; }
DestinationSection {
data: root.data;
phone: root.phone;
name-edited(name) => { root.name-edited(name); }
browse => { root.browse(); }
}
}
VerticalLayout {
alignment: start;
horizontal-stretch: 1;
OutputSection {
first: true;
data: root.data;
bitrate-changed(mbps) => { root.bitrate-changed(mbps); }
rate-changed(index) => { root.rate-changed(index); }
codec-changed(index) => { root.codec-changed(index); }
ten-bit-changed(on) => { root.ten-bit-changed(on); }
hdr-changed(on) => { root.hdr-changed(on); }
}
}
}
// Three columns: the picture and what it is; how it is
// written; where it goes.
if !root.running && root.columns == 3: HorizontalLayout {
spacing: 12px;
VerticalLayout {
alignment: start;
horizontal-stretch: 1;
PreviewSection {
first: true;
frame: root.preview-frame;
playhead: root.playhead;
duration: root.duration-seconds;
frame-rate: root.frame-rate;
see-through: root.data.see-through;
seek(seconds) => { root.seek(seconds); }
}
SummarySection { data: root.data; }
}
VerticalLayout {
alignment: start;
horizontal-stretch: 1;
OutputSection {
first: true;
data: root.data;
bitrate-changed(mbps) => { root.bitrate-changed(mbps); }
rate-changed(index) => { root.rate-changed(index); }
codec-changed(index) => { root.codec-changed(index); }
ten-bit-changed(on) => { root.ten-bit-changed(on); }
hdr-changed(on) => { root.hdr-changed(on); }
}
}
VerticalLayout {
alignment: start;
horizontal-stretch: 1;
DestinationSection {
first: true;
data: root.data;
phone: root.phone;
name-edited(name) => { root.name-edited(name); }
browse => { root.browse(); }
}
}
}
}
}
// ── the footer ───────────────────────────────────────────────
Rectangle {
height: 1px;
background: Theme.line;
}
// The groups pad themselves; the footer is padded to match.
Measure {
padding: 14px;
ExportFooter {
data: root.data;
narrow: root.columns == 1;
phone: root.phone;
begin => { root.begin(); }
cancel => { root.cancel(); }
reveal => { root.reveal(); }
again => { root.again(); }
}
}
}
}
}