From e5e869e654fc4dd7d60f099078224ce997d7dd0d Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Sat, 14 Mar 2026 20:51:25 +1100 Subject: [PATCH] feat(export): add native aspect ratio option for background-free exports --- src/components/video-editor/VideoEditor.tsx | 16 +++++++++++++--- src/components/video-editor/VideoPlayback.tsx | 14 +++++++++++++- src/utils/aspectRatioUtils.ts | 18 +++++++++++++----- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx index a41298e5..fd7b3207 100644 --- a/src/components/video-editor/VideoEditor.tsx +++ b/src/components/video-editor/VideoEditor.tsx @@ -1156,9 +1156,10 @@ export default function VideoEditor() { videoPlaybackRef.current?.pause(); } - const aspectRatioValue = getAspectRatioValue(aspectRatio); const sourceWidth = video.videoWidth || 1920; const sourceHeight = video.videoHeight || 1080; + const sourceAspectRatio = sourceHeight > 0 ? sourceWidth / sourceHeight : 16 / 9; + const aspectRatioValue = getAspectRatioValue(aspectRatio, sourceAspectRatio); // Get preview CONTAINER dimensions for scaling const playbackRef = videoPlaybackRef.current; @@ -1241,7 +1242,10 @@ export default function VideoEditor() { exportWidth = sourceWidth; exportHeight = sourceHeight; - if (aspectRatioValue === 1) { + if (aspectRatio === 'native') { + exportWidth = Math.floor(sourceWidth / 2) * 2; + exportHeight = Math.floor(sourceHeight / 2) * 2; + } else if (aspectRatioValue === 1) { // Square (1:1): use smaller dimension to avoid codec limits const baseDimension = Math.floor(Math.min(sourceWidth, sourceHeight) / 2) * 2; exportWidth = baseDimension; @@ -1544,7 +1548,13 @@ export default function VideoEditor() {