Open source CapCut alternative.
TypeScript
fix(cut): normalize, clamp, and cap aspect handling end to end [rebuild]
David Le767dc2987282
diff --git a/site/src/cut/components/Editor.tsx b/site/src/cut/components/Editor.tsxindex 58ab22a6..9d584e57 100644--- a/site/src/cut/components/Editor.tsx+++ b/site/src/cut/components/Editor.tsx@@ -186,6 +186,7 @@ export function Editor({if (rendering || !s.loaded || s.projectId !== projectId || s.clips.length === 0) return;rendering = true;const doc = {+ aspect: s.aspect,assets: s.assets,clips: s.clips,audioClips: s.audioClips,@@ -195,7 +196,7 @@ export function Editor({fadeOut: s.fadeOut,};try {- await renderPreviewProxy(projectId, doc, s.aspect);+ await renderPreviewProxy(projectId, doc);refreshShareCard(projectId);} finally {rendering = false;diff --git a/site/src/cut/components/ExportDialog.tsx b/site/src/cut/components/ExportDialog.tsxindex f964c313..6263705c 100644--- a/site/src/cut/components/ExportDialog.tsx+++ b/site/src/cut/components/ExportDialog.tsx@@ -61,6 +61,7 @@ export function ExportDialog() {void useExports.getState().start(s.projectId,{+ aspect: s.aspect,assets: s.assets,clips: s.clips,audioClips: s.audioClips,diff --git a/site/src/cut/components/ImageGenPanel.tsx b/site/src/cut/components/ImageGenPanel.tsxindex 5c9b140f..8cfedf53 100644--- a/site/src/cut/components/ImageGenPanel.tsx+++ b/site/src/cut/components/ImageGenPanel.tsx@@ -11,6 +11,7 @@ import { genPulseOverlay, useGenPulse } from "@/cut/lib/genNotify";import { useElapsed } from "@/cut/hooks/useElapsed";import { signInUrl, useGenerate, useSignedIn, type GenerateJob } from "@/cut/lib/generate";import {+ IMAGE_ASPECTS,IMAGE_RESOLUTION_LABEL,useImageGen,type ImageAspect,@@ -89,9 +90,7 @@ export function ImageGenPanel({ projectId }: { projectId: string }) {useEffect(() => {useImageGen.getState()- .setAspect(- nearestAspect(useEditor.getState().aspect, Object.keys(ASPECT_WORD) as ImageAspect[])- );+ .setAspect(nearestAspect(useEditor.getState().aspect, IMAGE_ASPECTS));}, []);const go = () => {diff --git a/site/src/cut/components/OverlayLayer.tsx b/site/src/cut/components/OverlayLayer.tsxindex 8c3f5ebc..099978cf 100644--- a/site/src/cut/components/OverlayLayer.tsx+++ b/site/src/cut/components/OverlayLayer.tsx@@ -63,7 +63,8 @@ export function OverlayLayer({ stageWidth }: { stageWidth: number }) {else boxes.current.delete(id);}, []);- const stageHeight = (stageWidth * frameOf(aspect).h) / frameOf(aspect).w;+ const frame = frameOf(aspect);+ const stageHeight = (stageWidth * frame.h) / frame.w;// Figma-style smart snapping: while dragging an item, pull its left/center/// right edges to the frame edges, safe margins, center line, and the edges@@ -226,7 +227,7 @@ function SubtitleCaption({const currentTime = useEditor((s) => s.currentTime);const skimTime = useEditor((s) => s.skimTime);const playing = useEditor((s) => s.playing);- const aspect = useEditor((s) => s.aspect);+ const frame = frameOf(useEditor((s) => s.aspect));const t = !playing && skimTime !== null ? skimTime : currentTime;const cues = laneCues(subtitles, lane);@@ -242,7 +243,7 @@ function SubtitleCaption({cue.id === cues[0]?.id,trackPos(subtitles, style, lane),undefined,- frameOf(aspect).w+ frame.w);// Karaoke: the word under the playhead lights up as it is spoken.const wordIndex = subtitles.wordHighlight@@ -269,7 +270,7 @@ function SubtitleCaption({textDecorationThickness: "0.07em",textUnderlineOffset: "0.14em",};- const scale = stageWidth / frameOf(aspect).w;+ const scale = stageWidth / frame.w;return (<divref={(el) => registerBox(subtitleBoxId(lane), el)}diff --git a/site/src/cut/components/Timeline.tsx b/site/src/cut/components/Timeline.tsxindex d78a63a1..72004226 100644--- a/site/src/cut/components/Timeline.tsx+++ b/site/src/cut/components/Timeline.tsx@@ -1776,6 +1776,7 @@ function exportSegment(asset: MediaAsset, clip: VideoClip | AudioClip) {const doc: ExportDoc ="track" in clip? {+ aspect: s.aspect,assets: [asset],clips: [{ ...clip, start: 0, track: 0, hidden: undefined }],audioClips: [],@@ -1783,6 +1784,7 @@ function exportSegment(asset: MediaAsset, clip: VideoClip | AudioClip) {subtitles: emptySubtitles(),}: {+ aspect: s.aspect,assets: [asset],clips: [],audioClips: [{ ...clip, start: 0, hidden: undefined }],diff --git a/site/src/cut/lib/aiTools.ts b/site/src/cut/lib/aiTools.tsindex ae08e817..d84ec892 100644--- a/site/src/cut/lib/aiTools.ts+++ b/site/src/cut/lib/aiTools.ts@@ -44,6 +44,7 @@ import { synthesizeMusic } from "./audioGen";import { composeMusicPrompt } from "./composeGen";import { stockAssetInDoc } from "./genvideo/docWriter";import { resolveVoice, synthesizeSpeech, SPEECH_VOICES } from "./tts";+import { defaultVideoAspects } from "./videoModels";import { DUCK_DEFAULT, generateSubtitlesReadout } from "./voiceover";import {ANIM_DEFAULT_SECONDS,@@ -55,14 +56,13 @@ import {MAX_SUBTITLE_LANES,mediaUrl,nearestAspect,+ normalizeAspect,overlayAnimStyle,- parseRatio,rectOf,regionLabel,SPEED_FLOOR,TRANSITION_STYLE_IDS,type AnimStyle,- type Aspect,type AudioClip,type ColorGrade,type FontId,@@ -817,7 +817,7 @@ export async function runAiTool(aspect:input.aspect === "16:9" || input.aspect === "9:16"? input.aspect- : nearestAspect(useEditor.getState().aspect, ["16:9", "9:16"] as const),+ : nearestAspect(useEditor.getState().aspect, defaultVideoAspects()),chatId: chatOwner() ?? undefined,});const stillAsset =@@ -1707,10 +1707,7 @@ export async function runAiTool(}case "set_aspect": {- const a =- typeof input.aspect === "string" && parseRatio(input.aspect)- ? (input.aspect as Aspect)- : null;+ const a = typeof input.aspect === "string" ? normalizeAspect(input.aspect) : null;if (!a)throw new ToolError('aspect must be "W:H" with whole numbers up to a 4:1 shape, e.g. "9:16", "16:9", "1:1", or "9:5".'diff --git a/site/src/cut/lib/exportClient.ts b/site/src/cut/lib/exportClient.tsindex e2f5f289..faf8079a 100644--- a/site/src/cut/lib/exportClient.ts+++ b/site/src/cut/lib/exportClient.ts@@ -80,13 +80,19 @@ export function originalSettings(assets: MediaAsset[]): ExportSettings {const base = frameOf(aspect);+ const longBase = Math.max(base.w, base.h);const srcLong = Math.max(0,...getClipSpans(clips, assets).map((sp) =>Math.max(sp.asset.width ?? 0, sp.asset.height ?? 0)));- const k = Math.min(2, Math.max(1, srcLong / Math.max(base.w, base.h) || 1));+ // The 4K long-side cap wins over the 1080 base floor: a very wide custom+ // ratio (whose base already exceeds 3840) scales down to stay encodable.+ const k = Math.min(+ 3840 / longBase,+ Math.min(2, Math.max(1, srcLong / longBase || 1))+ );const even = (n: number) => 2 * Math.round((n * k) / 2);return { width: even(base.w), height: even(base.h), fps: 30, crf: 19, preset: "medium" };}@@ -157,6 +163,9 @@ export async function deleteExport(projectId: string, file: string) {}export interface ExportDoc {+ /** Output frame ratio the cut renders at — keeps burn-in layout (caption+ * wrap) in the same design space as the live preview. */+ aspect: Aspect;assets: MediaAsset[];/** Every video clip, any track (track 0 folds sequentially, others composite). */clips: VideoClip[];@@ -372,8 +381,9 @@ async function buildExportPayload(i === 0,pos,doc.subtitles.wordHighlight ? wi : undefined,- // Wrap in design space (1080 short side), whatever the render size.- Math.round((1080 * settings.width) / Math.min(settings.width, settings.height))+ // Wrap in design space (1080 short side) from the project ratio —+ // the same width the preview passes, whatever the render size.+ frameOf(doc.aspect).w),settings.width,settings.height@@ -540,9 +550,9 @@ export function cancelExportJob(jobId: string, backend: CutBackend = getBackend(* Renders through the same pipeline (overlays and all), writing the project's* preview.mp4. Best-effort: silently no-ops if a slot is busy or there's no* footage yet. */-export async function renderPreviewProxy(projectId: string, doc: ExportDoc, aspect: Aspect) {+export async function renderPreviewProxy(projectId: string, doc: ExportDoc) {const backend = getBackend(); // pinned: the proxy render outlives navigation- const settings: ExportSettings = { ...scaledFrame(aspect, 360), fps: 24, crf: 30, preset: "veryfast" };+ const settings: ExportSettings = { ...scaledFrame(doc.aspect, 360), fps: 24, crf: 30, preset: "veryfast" };let res: Response;try {const payload = await buildExportPayload(projectId, doc, settings, "preview");@@ -604,7 +614,7 @@ function cardSettings(aspect: Aspect): ExportSettings {** Best-effort throughout — a project with no footage, an unconfigured* backend, or a busy render slot simply keeps the card it already had. */-async function renderShareCard(projectId: string, doc: ExportDoc, aspect: Aspect): Promise<void> {+async function renderShareCard(projectId: string, doc: ExportDoc): Promise<void> {const backend = getBackend(); // pinned: the card render outlives navigationif (backend.kind !== "cloud") return;try {@@ -619,7 +629,7 @@ async function renderShareCard(projectId: string, doc: ExportDoc, aspect: Aspectconst payload = await buildExportPayload(projectId,docFirstSeconds(doc, CARD_SECONDS),- cardSettings(aspect),+ cardSettings(doc.aspect),"card");res = await postExport(projectId, payload, "card.mp4", backend);@@ -637,17 +647,14 @@ async function renderShareCard(projectId: string, doc: ExportDoc, aspect: Aspectexport function refreshShareCard(projectId: string): void {const s = useEditor.getState();if (!s.loaded || s.projectId !== projectId || s.clips.length === 0) return;- void renderShareCard(- projectId,- {- assets: s.assets,- clips: s.clips,- audioClips: s.audioClips,- overlays: s.overlays,- subtitles: s.subtitles,- fadeIn: s.fadeIn,- fadeOut: s.fadeOut,- },- s.aspect- ).catch(() => {});+ void renderShareCard(projectId, {+ aspect: s.aspect,+ assets: s.assets,+ clips: s.clips,+ audioClips: s.audioClips,+ overlays: s.overlays,+ subtitles: s.subtitles,+ fadeIn: s.fadeIn,+ fadeOut: s.fadeOut,+ }).catch(() => {});}diff --git a/site/src/cut/lib/genScene.ts b/site/src/cut/lib/genScene.tsindex d669de18..35150756 100644--- a/site/src/cut/lib/genScene.ts+++ b/site/src/cut/lib/genScene.ts@@ -11,6 +11,7 @@ import { projectWriteMode, withProjectDoc } from "./genvideo/docWriter";import type { RefAsset, Shot, VideoEvent, VideoPhase, VideoProject } from "./genvideo/types";import { useEditor } from "./store";import { nearestAspect, type Aspect } from "./types";+import { defaultVideoAspects } from "./videoModels";// Brief-to-video ("generate a video") controller. It owns one VideoOrchestrator// per open project and runs it browser-side, exactly where generation and the@@ -263,7 +264,7 @@ function newProject(projectId: string, params: StartSceneParams): VideoProject {// The plan owns its shape from the start (start() applies params.aspect to// an empty timeline before this runs), so a background render can never// pick up another open project's aspect.- aspect: nearestAspect(useEditor.getState().aspect, ["9:16", "16:9"] as const),+ aspect: nearestAspect(useEditor.getState().aspect, defaultVideoAspects()),style: params.style?.trim() ?? "",suiteLabel: "donkey-hosted",...(params.chatId ? { chatId: params.chatId } : {}),diff --git a/site/src/cut/lib/generate.ts b/site/src/cut/lib/generate.tsindex 976ef197..9945f3a7 100644--- a/site/src/cut/lib/generate.ts+++ b/site/src/cut/lib/generate.ts@@ -20,10 +20,10 @@ import { hostedPost } from "./hosted";import { enrichAsset, importFileToProject, uploadProjectImage } from "./media";import { refsToInlineImages, videoSafeInline, visualRefs, type InlineImage } from "./refMedia";import { useGenNotify } from "./genNotify";-import { useImageGen } from "./imageGen";+import { IMAGE_ASPECTS, useImageGen } from "./imageGen";import { useEditor } from "./store";import { mediaSlug, nearestAspect, type MediaAsset, type RenderRecord } from "./types";-import { videoModel } from "./videoModels";+import { defaultVideoAspects, videoModel } from "./videoModels";import { walkLadder, type VideoAttempt } from "./videoLadder";// AI generation jobs, held outside the panels so a tab switch (which unmounts@@ -604,8 +604,7 @@ export const useGenerate = create<GenerateState>((set, get) => {return (async () => {try {const aspect =- opts?.aspect ??- nearestAspect(useEditor.getState().aspect, ["16:9", "9:16", "1:1"] as const);+ opts?.aspect ?? nearestAspect(useEditor.getState().aspect, IMAGE_ASPECTS);const resolution = opts?.resolution ?? useImageGen.getState().resolution;// The job (and the landed asset's name) keeps the user's own words;// only the render sees the composed prompt. The image model takes@@ -741,7 +740,7 @@ export const useGenerate = create<GenerateState>((set, get) => {: {}),parameters: {aspectRatio:- opts?.aspect ?? nearestAspect(useEditor.getState().aspect, ["16:9", "9:16"] as const),+ opts?.aspect ?? nearestAspect(useEditor.getState().aspect, defaultVideoAspects()),...(opts?.negativePrompt ? { negativePrompt: opts.negativePrompt } : {}),},});diff --git a/site/src/cut/lib/genvideo/editorBridge.ts b/site/src/cut/lib/genvideo/editorBridge.tsindex bc628856..c87aae2e 100644--- a/site/src/cut/lib/genvideo/editorBridge.ts+++ b/site/src/cut/lib/genvideo/editorBridge.ts@@ -24,6 +24,7 @@import { useEditor } from "../store";import { nearestAspect, TRANSITION_STYLE_IDS, type TransitionStyle } from "../types";+import { defaultVideoAspects } from "../videoModels";import { docPlaceGenAudio, docPlaceGenClip, projectWriteMode, withProjectDoc } from "./docWriter";import type { AudioClipInfo, EditorBridge, TimelineInfo } from "./editor";@@ -75,7 +76,7 @@ export class StoreEditorBridge implements EditorBridge {durationFrames: Math.round(clipEnd * GEN_FPS),// The pipeline renders in the shapes the models support; a custom// project ratio maps to the closest one and letterboxes on the timeline.- aspect: nearestAspect(s.aspect, ["9:16", "16:9"] as const),+ aspect: nearestAspect(s.aspect, defaultVideoAspects()),};return this.lastTimeline;}diff --git a/site/src/cut/lib/imageGen.ts b/site/src/cut/lib/imageGen.tsindex 2668891e..9f3f60c9 100644--- a/site/src/cut/lib/imageGen.ts+++ b/site/src/cut/lib/imageGen.ts@@ -10,6 +10,10 @@ import { addRefOnce, sameRef, type AssetRef } from "./assetRef";/** The shape the next generated image is composed in. */export type ImageAspect = "16:9" | "9:16" | "1:1";+/** Every shape the image model renders — the registry list AI-path defaults+ * and panel seeds clamp the project aspect onto. */+export const IMAGE_ASPECTS: readonly ImageAspect[] = ["16:9", "9:16", "1:1"];+export const IMAGE_ASPECT_LABEL: Record<ImageAspect, string> = {"16:9": "Landscape (16:9)","9:16": "Portrait (9:16)",diff --git a/site/src/cut/lib/store.ts b/site/src/cut/lib/store.tsindex c0911cb7..5bca542c 100644--- a/site/src/cut/lib/store.ts+++ b/site/src/cut/lib/store.ts@@ -32,7 +32,7 @@ import { fetchSignedMediaUrls } from "./backend/cloud";import { markSignedBatch } from "./mediaLinks";import { cloudTranscribeSpec, type CloudTranscribeSpec } from "./cloudTranscribe";import { trackLocale } from "./subtitles";-import { ANIM_STYLE_IDS, emptySubtitles, IMAGE_CLIP_SECONDS, LOOK_IDS, MAX_SUBTITLE_LANES, mediaUrl, migrateLegacyTransitions, parseRatio, SPEED_FLOOR, SPEED_MIN, TRANSITION_MAX } from "./types";+import { ANIM_STYLE_IDS, emptySubtitles, IMAGE_CLIP_SECONDS, LOOK_IDS, MAX_SUBTITLE_LANES, mediaUrl, migrateLegacyTransitions, normalizeAspect, SPEED_FLOOR, SPEED_MIN, TRANSITION_MAX } from "./types";import { readTextStyle } from "./textStyle";import { loadUiState, saveUiState } from "./uiState";import { captureTimelineFrames } from "./visualFrames";@@ -115,8 +115,11 @@ export interface EditorState {clips: VideoClip[];audioClips: AudioClip[];overlays: TextOverlay[];- /** Output frame (9:16 vertical or 16:9 widescreen), persisted per project. */+ /** Output frame ratio ("W:H", short side 1080), persisted per project. */aspect: Aspect;+ /** The aspect was chosen deliberately (picker, set_aspect, or saved in the+ * doc) — the first-import orientation guess stands down. Not a doc field. */+ aspectTouched: boolean;/** Whole-video fades, seconds (0 = off): in from black at the start, out to* black at the end of the cut. Applied to the final picture and mix. */fadeIn: number;@@ -791,6 +794,7 @@ export const useEditor = create<EditorState>((baseSet, get) => {overlays: [],templates: [],aspect: "9:16",+ aspectTouched: false,fadeIn: 0,fadeOut: 0,selection: null,@@ -834,6 +838,7 @@ export const useEditor = create<EditorState>((baseSet, get) => {overlays: [],templates: [],aspect: "9:16",+ aspectTouched: false,fadeIn: 0,fadeOut: 0,selection: null,@@ -912,7 +917,8 @@ export const useEditor = create<EditorState>((baseSet, get) => {audioClips: doc.audioClips,overlays: doc.overlays,templates: doc.templates ?? [],- aspect: doc.aspect ?? "9:16",+ aspect: normalizeAspect(doc.aspect) ?? "9:16",+ aspectTouched: doc.aspect !== undefined,fadeIn: doc.fadeIn ?? 0,fadeOut: doc.fadeOut ?? 0,// View state lives in IndexedDB; doc.ui covers projects saved@@ -1088,7 +1094,8 @@ export const useEditor = create<EditorState>((baseSet, get) => {},setAspect: (a) => {- if (parseRatio(a)) set({ aspect: a });+ const n = normalizeAspect(a);+ if (n) set({ aspect: n, aspectTouched: true });},setProjectFade: (patch) => {const clamp = (v: number | undefined) =>@@ -1103,8 +1110,10 @@ export const useEditor = create<EditorState>((baseSet, get) => {set((s) => {// The first video in an untouched project decides the starting frame// (landscape footage → 16:9, portrait → 9:16); the user can switch it- // any time from the top bar.+ // any time from the top bar. A deliberately chosen aspect wins — the+ // guess never overrides it.const guess =+ !s.aspectTouched &&(asset.type === "video" || asset.type === "image") &&asset.width !== undefined &&asset.height !== undefined &&diff --git a/site/src/cut/lib/subtitles.ts b/site/src/cut/lib/subtitles.tsindex 512a2755..3e15b919 100644--- a/site/src/cut/lib/subtitles.ts+++ b/site/src/cut/lib/subtitles.ts@@ -285,7 +285,7 @@ export function wrapCaption(text: string): string {* line centered without wrapping, so this is what guarantees captions stay in* bounds — bigger styles (and the punchy opener) wrap to fewer words per line.*/-export function wrapCaptionForSize(text: string, size: number, frameW = 1080): string {+export function wrapCaptionForSize(text: string, size: number, frameW: number): string {const words = text.trim().replace(/\s+/g, " ").split(" ").filter(Boolean);if (words.length === 0) return "";// ~88% of the frame width, with a conservative bold-glyph advance@@ -343,9 +343,9 @@ export function cueOverlay(cue: SubtitleCue,style: CaptionStyle = CAPTION_STYLES.clean,isOpener = false,- pos?: { x?: number; y?: number; size?: number; font?: FontId; accentMode?: WordAccentMode; accentColor?: string },- wordIndex?: number,- frameW = 1080+ pos: { x?: number; y?: number; size?: number; font?: FontId; accentMode?: WordAccentMode; accentColor?: string } | undefined,+ wordIndex: number | undefined,+ frameW: number): TextOverlay {const kl = wordIndex !== undefined ? karaokeLook(style, pos) : null;const size = Math.round(diff --git a/site/src/cut/lib/types.ts b/site/src/cut/lib/types.tsindex ddb94a46..e4d65dee 100644--- a/site/src/cut/lib/types.ts+++ b/site/src/cut/lib/types.ts@@ -23,6 +23,17 @@ export function parseRatio(a: string | undefined | null): { w: number; h: numberreturn { w, h };}+/** Reduce a valid ratio to lowest terms as the one canonical string —+ * "18:32" and "09:16" both become "9:16", so preset checks and literal+ * comparisons see a single spelling. Null when the ratio is invalid. */+export function normalizeAspect(a: string | undefined | null): Aspect | null {+ const r = parseRatio(a);+ if (!r) return null;+ const gcd = (x: number, y: number): number => (y === 0 ? x : gcd(y, x % y));+ const g = gcd(r.w, r.h);+ return `${r.w / g}:${r.h / g}`;+}+/** Output frame in pixels. The short side is pinned to 1080 — the design* short side that text scaling and overlay math assume — and the long side* follows the ratio, rounded to even for the encoder. */diff --git a/site/src/cut/lib/videoModels.ts b/site/src/cut/lib/videoModels.tsindex eb5fb5c0..9599bbb3 100644--- a/site/src/cut/lib/videoModels.ts+++ b/site/src/cut/lib/videoModels.ts@@ -46,3 +46,9 @@ export const VIDEO_MODELS: VideoModelOption[] = [export function videoModel(tier: VideoTier): VideoModelOption {return VIDEO_MODELS.find((m) => m.tier === tier) ?? VIDEO_MODELS[0];}++/** The default model's supported shapes — what AI-path renders and pipeline+ * seeds clamp the project aspect onto when no tier was picked. */+export function defaultVideoAspects(): VideoAspect[] {+ return VIDEO_MODELS[0].aspects;+}diff --git a/site/src/cut/server/cloud/projects.ts b/site/src/cut/server/cloud/projects.tsindex 55251b4b..b52abf08 100644--- a/site/src/cut/server/cloud/projects.ts+++ b/site/src/cut/server/cloud/projects.ts@@ -1,6 +1,6 @@// Cloud twin of the engine's project CRUD (server/projects.ts + http/projects.ts):// docs and metadata in Postgres, media bytes in R2. Every query scopes by userId.-import { parseRatio, type ProjectDoc, type ProjectFolder, type ProjectSummary } from "@/cut/lib/types";+import { normalizeAspect, type ProjectDoc, type ProjectFolder, type ProjectSummary } from "@/cut/lib/types";import type { Prisma } from "@/generated/prisma/client";import { prisma } from "@/lib/prisma";import {@@ -156,7 +156,7 @@ export const projectsCloud = {: existing.overlayClips,overlays: Array.isArray(body.overlays) ? body.overlays : existing.overlays,templates: Array.isArray(body.templates) ? body.templates : existing.templates,- aspect: parseRatio(body.aspect) ? body.aspect : existing.aspect,+ aspect: normalizeAspect(body.aspect) ?? existing.aspect,fadeIn: typeof body.fadeIn === "number" ? body.fadeIn : existing.fadeIn,fadeOut: typeof body.fadeOut === "number" ? body.fadeOut : existing.fadeOut,subtitles:diff --git a/site/src/cut/server/http/projects.ts b/site/src/cut/server/http/projects.tsindex 1d73fe8a..8578851d 100644--- a/site/src/cut/server/http/projects.ts+++ b/site/src/cut/server/http/projects.ts@@ -1,5 +1,5 @@import { execFile } from "node:child_process";-import { parseRatio, type ProjectDoc } from "@/cut/lib/types";+import { normalizeAspect, type ProjectDoc } from "@/cut/lib/types";import { detectSilence, extractAudio, makeContactSheets, makeFreezeFrame, probeDims, probeDuration } from "../frames";import {createProject,@@ -122,7 +122,7 @@ export const projectsApi = {: existing.overlayClips,overlays: Array.isArray(body.overlays) ? body.overlays : existing.overlays,templates: Array.isArray(body.templates) ? body.templates : existing.templates,- aspect: parseRatio(body.aspect) ? body.aspect : existing.aspect,+ aspect: normalizeAspect(body.aspect) ?? existing.aspect,fadeIn: typeof body.fadeIn === "number" ? body.fadeIn : existing.fadeIn,fadeOut: typeof body.fadeOut === "number" ? body.fadeOut : existing.fadeOut,subtitles: