Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(format): leave Auto out of mixed timelines and keep its frame still
EtienneLescot74460bfdb2ca
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsxindex db66f27c3..b3f27f15c 100644--- a/src/components/ai-edition/RightPanes.tsx+++ b/src/components/ai-edition/RightPanes.tsx@@ -2354,7 +2354,8 @@ export function VideoEffectsPane() {// the project (padding, camera layout, crop) has to say where it currently stands.const autoDims = useMemo(() => (document ? pickOutputDims(document, "auto") : null), [document]);// Auto only frames a timeline of one composition. Mixed clips leave the choice to the user,- // so the row goes dead and says why instead of guessing which clip should win.+ // so the row is not offered at all; it only stays listed, dead and saying why, while it is+ // still the project's format, or the button would name an entry the menu does not have.const autoAvailable = useMemo(() => (document ? isAutoFormatAvailable(document) : true),[document],@@ -2501,27 +2502,29 @@ export function VideoEffectsPane() {><div className={styles.actionMenu} role="menu" aria-label={ts("effects.format")}>{/* Auto leads: it is the one entry that is a rule rather than a shape. */}- <button- type="button"- role="menuitem"- className={`${styles.actionMenuRow}${- settings.aspectRatio === "auto" ? ` ${styles.isActive}` : ""- }`}- disabled={!autoAvailable}- onClick={() => {- setRatioMenuOpen(false);- void set({ aspectRatio: "auto" });- }}- >- <span className={styles.actionMenuMain}>{ts("effects.formatAuto")}</span>- {!autoAvailable ? (- <span className={styles.actionMenuCount}>{ts("effects.formatAutoMixed")}</span>- ) : autoDims ? (- <span className={styles.actionMenuCount}>- {`${autoDims.width}×${autoDims.height}`}- </span>- ) : null}- </button>+ {autoAvailable || settings.aspectRatio === "auto" ? (+ <button+ type="button"+ role="menuitem"+ className={`${styles.actionMenuRow}${+ settings.aspectRatio === "auto" ? ` ${styles.isActive}` : ""+ }`}+ disabled={!autoAvailable}+ onClick={() => {+ setRatioMenuOpen(false);+ void set({ aspectRatio: "auto" });+ }}+ >+ <span className={styles.actionMenuMain}>{ts("effects.formatAuto")}</span>+ {!autoAvailable ? (+ <span className={styles.actionMenuCount}>{ts("effects.formatAutoMixed")}</span>+ ) : autoDims ? (+ <span className={styles.actionMenuCount}>+ {`${autoDims.width}×${autoDims.height}`}+ </span>+ ) : null}+ </button>+ ) : null}{ASPECT_RATIO_PRESETS.map((ratio) => (<buttontype="button"diff --git a/src/lib/ai-edition/document/outputFormat.test.ts b/src/lib/ai-edition/document/outputFormat.test.tsindex 812d16771..61aa52b04 100644--- a/src/lib/ai-edition/document/outputFormat.test.ts+++ b/src/lib/ai-edition/document/outputFormat.test.ts@@ -311,7 +311,7 @@ describe("Auto", () => {});const auto = (d: AxcutDocument) => resolveAspectRatioValue(d, "auto");- it("is the reference clip's cropped shape at 0% padding", () => {+ it("is the clip's cropped shape at 0% padding", () => {const d = withEditor(doc([asset("a1", 1920, 1080)], [clip("c1", "a1", { x: 0.25, y: 0, width: 0.5, height: 1 })]),{ padding: 0 },@@ -324,7 +324,7 @@ describe("Auto", () => {expect(auto(d)).toBeCloseTo(0.8 * (16 / 9) + 0.2, 6);});- it("widens for side by side only when the reference clip carries a camera", () => {+ it("widens for side by side only when the clip carries a camera", () => {const editor = { padding: 0, webcamLayoutPreset: "dual-frame" };const h = 1080 / 1920;const withCam = withEditor(@@ -336,18 +336,25 @@ describe("Auto", () => {expect(auto(without)).toBeCloseTo(16 / 9, 6);});- it("stays on the clip that sets the output size once the timeline turns mixed", () => {- // Auto is no longer offered here; a project saved on it keeps a stable frame until the- // user picks a format.- const d = withEditor(+ it("keeps its frame when a larger clip of another shape is added after the first", () => {+ // A project on Auto that turns mixed: Auto is no longer offered, and the frame must not+ // jump to the new clip's shape. Only the output size follows the larger clip.+ const before = withEditor(doc([asset("screen", 1280, 720)], [clip("c1", "screen")]), {+ padding: 0,+ });+ const after = withEditor(doc(- [asset("small", 1280, 720), asset("big", 1080, 1920)],- [clip("c1", "small"), clip("c2", "big")],+ [asset("screen", 1280, 720), asset("phone", 1080, 1920)],+ [+ clip("c1", "screen"),+ { ...clip("c2", "phone"), timelineStartSec: 10, timelineEndSec: 20 },+ ],),{ padding: 0 },);- expect(isAutoFormatAvailable(d)).toBe(false);- expect(auto(d)).toBeCloseTo(1080 / 1920, 6);+ expect(isAutoFormatAvailable(after)).toBe(false);+ expect(auto(after)).toBeCloseTo(auto(before), 6);+ expect(pickOutputDims(after, "auto")).toEqual({ width: 1920, height: 1080 });});describe("is offered only for a timeline of one composition", () => {diff --git a/src/lib/ai-edition/document/outputFormat.ts b/src/lib/ai-edition/document/outputFormat.tsindex e03fcb730..a2726d8af 100644--- a/src/lib/ai-edition/document/outputFormat.ts+++ b/src/lib/ai-edition/document/outputFormat.ts@@ -170,29 +170,11 @@ export function referenceClipDims(probedAssetDims: Record<string, Dims> = {},): Dims {return (- referenceClip(document, probedAssetDims)?.dims ??- pickExtremeDims(collectUsedAssetDims(document, probedAssetDims), "largest") ??+ pickExtremeDims(collectEffectiveClipDims(document, probedAssetDims), "largest") ??FALLBACK_OUTPUT_DIMS);}-/** The clip behind `referenceClipDims`, for the questions its dims alone can't answer- * (does it carry a camera?). Same pick as `pickExtremeDims`: the first strictly largest. */-function referenceClip(- document: AxcutDocument,- probedAssetDims: Record<string, Dims>,-): { clip: AxcutClip; dims: Dims } | null {- const assetById = new Map(document.assets.map((a) => [a.id, a]));- let best: { clip: AxcutClip; dims: Dims } | null = null;- for (const clip of document.timeline.clips) {- const dims = clipEffectiveDims(clip, assetById, probedAssetDims);- if (dims && (!best || dims.width * dims.height > best.dims.width * best.dims.height)) {- best = { clip, dims };- }- }- return best;-}-/*** The layout a clip actually gets: the project's preset, once the clip's own camera is* resolved. Same predicate as the scene (`clipHasCamera`), so Auto and the render agree on@@ -234,26 +216,45 @@ export function isAutoFormatAvailable(return compositions.size <= 1;}+/**+ * The clip that opens the timeline, among those whose dimensions are known: where Auto reads+ * the composition it frames.+ */+function firstClip(+ document: AxcutDocument,+ probedAssetDims: Record<string, Dims>,+): { clip: AxcutClip; dims: Dims } | null {+ const assetById = new Map(document.assets.map((a) => [a.id, a]));+ let first: { clip: AxcutClip; dims: Dims } | null = null;+ for (const clip of document.timeline.clips) {+ const dims = clipEffectiveDims(clip, assetById, probedAssetDims);+ if (dims && (!first || clip.timelineStartSec < first.clip.timelineStartSec)) {+ first = { clip, dims };+ }+ }+ return first;+}+/*** What "Auto" resolves to: the frame shaped around the composition instead of the other way* round (`autoFrameAspect` over `restingCompositionAspect`).** Auto is only offered while the timeline holds one composition (`isAutoFormatAvailable`), so- * any clip describes it; `referenceClip`, the clip that sets the output size, is the one read.- * A project saved on Auto can still become mixed later, when a clip of another shape is added:- * the frame then stays on that same reference clip, so adding a smaller clip moves nothing, and- * the menu shows Auto as unavailable until the user picks a format.+ * any clip describes it, and the first one is read. That choice only matters for a project that+ * was on Auto and then became mixed: its frame keeps the first clip's shape, so a clip added+ * after it, larger or not, moves nothing until the user picks a format. The output's SIZE still+ * follows the largest clip (`referenceClipDims`), so no clip is drawn past its own resolution.** Zoom, device frames, shadow and captions are left out on purpose: they happen inside the* frame, in every format alike, and would make the shape move with the playhead.*/function autoAspectRatioValue(document: AxcutDocument, probedAssetDims: Record<string, Dims>) {const settings = getEditorSettings(document);- const reference = referenceClip(document, probedAssetDims);- const preset = reference- ? clipLayoutPreset(reference.clip, document.assets, settings.webcamLayoutPreset)+ const first = firstClip(document, probedAssetDims);+ const preset = first+ ? clipLayoutPreset(first.clip, document.assets, settings.webcamLayoutPreset): "no-webcam";- const screen = reference?.dims ?? referenceClipDims(document, probedAssetDims);+ const screen = first?.dims ?? referenceClipDims(document, probedAssetDims);return autoFrameAspect(restingCompositionAspect(screen, preset), settings.padding);}diff --git a/technical-documentation/architecture/export-pipeline.md b/technical-documentation/architecture/export-pipeline.mdindex 57542810c..a0a952cf2 100644--- a/technical-documentation/architecture/export-pipeline.md+++ b/technical-documentation/architecture/export-pipeline.md@@ -133,16 +133,17 @@ and **one** encoder + muxer pair:width / height / bitrate, and passes `width` / `height` to `exportMulti`.Only "Source" quality targets those source dims; 720p / 1080p target afixed short side regardless.- **Auto** resolves in that same function: the reference clip's cropped- screen, laid out with the camera layout at rest (`restingCompositionAspect`),- plus an even padding border (`autoFrameAspect`). The preview and the scene- pad an Auto frame with the matching border (`paddedContentSize`,+ **Auto** resolves in that same function: the first clip's cropped screen,+ laid out with the camera layout at rest (`restingCompositionAspect`), plus+ an even padding border (`autoFrameAspect`). The preview and the scene pad an+ Auto frame with the matching border (`paddedContentSize`,`compositeLayout.ts`), so the composition fills it with the same margin onall four sides. Auto is only offered while every clip has the same ratio,crop included, and the same effective layout: picture-in-picture, a blocklayout, or no camera (`isAutoFormatAvailable`). With mixed clips the menu- disables it, and a project already on Auto keeps the reference clip's frame- until the user picks a format.+ leaves it out. A project already on Auto keeps it listed, disabled, and keeps+ the first clip's frame, so a clip added after it moves nothing, until the+ user picks a format. The output size still follows the largest clip.## Output formats and codecsdiff --git a/technical-documentation/testing/manual-e2e-checklist.md b/technical-documentation/testing/manual-e2e-checklist.mdindex e2e914212..3263e5dd5 100644--- a/technical-documentation/testing/manual-e2e-checklist.md+++ b/technical-documentation/testing/manual-e2e-checklist.md@@ -436,7 +436,7 @@ The percentage is computed in the renderer against a predicted frame total, and- [ ] Open the top-bar language control by its `aria-label`, choose a non-English locale, and confirm visible UI strings change.- [ ] Switch back to English and confirm the top bar, transport, inspector, and export labels return to English.- [ ] Select a different aspect ratio from the timeline aspect-ratio menu and confirm the preview frame changes shape.-- [ ] Pick **Auto** in the Format menu, drag padding from 0 to 100, and confirm the frame reshapes live with one border thickness on all four sides; switch the camera layout to side by side, then top / bottom, and confirm the frame widens, then turns portrait, with a square camera. Export and confirm the file has the preview frame's shape and the same even border. Then add a clip of another shape, a differently cropped clip, or a clip without a camera, and confirm the Auto row is disabled with the reason shown and the frame does not move.+- [ ] Pick **Auto** in the Format menu, drag padding from 0 to 100, and confirm the frame reshapes live with one border thickness on all four sides; switch the camera layout to side by side, then top / bottom, and confirm the frame widens, then turns portrait, with a square camera. Export and confirm the file has the preview frame's shape and the same even border. Then add a clip of another shape, a differently cropped clip, or a clip without a camera, and confirm the frame does not move and the Auto row stays listed, disabled with the reason shown; pick 16:9, reopen the menu, and confirm Auto is no longer offered.- [ ] Press `Esc` or click outside an open menu, popover, or dialog and confirm it closes.### App menu, About, and updates