Skip to content

Square (1:1) and vertical (9:16) export presets #5

Description

@nftechie

Context

Exports always keep the source's aspect ratio. ExportSettings.renderSize(for:) fits the screen into a resolution box, and FrameComposer letterboxes the screen onto that canvas. For LinkedIn, Instagram, TikTok and Shorts, people want 1:1 and 9:16 videos.

Where to look

  • Sources/SnapcapCore/Model/Project.swift: ExportResolution, ExportSettings, and renderSize(for:), which never upscales, keeps dimensions even, and applies H.264 limits of 4096×2304 and 2304×4096.
  • Sources/SnapcapCore/Render/CompositionBuilder.swift: vc.renderSize = project.export.renderSize(for: screenSize).
  • Sources/SnapcapCore/Render/FrameComposer.swift: fit(_:into:) aspect-fits the screen on black.
  • Sources/SnapcapCore/Layout/OverlayLayout.swift: the bubble's position and size are relative to the canvas (size uses the shorter side), so it adapts automatically. Check how it looks.
  • Sources/Snapcap/Views/EditorView.swift: PlayerStage sizes the stage from project.source.pixelSize. The preview must use the export canvas's aspect ratio and place the screen the same way the export does. The export pickers are in EditorInspector, and the setup window has matching pickers in Sources/Snapcap/Views/RecorderView.swift.
  • Tests/SnapcapCoreTests/LayoutTests.swift: renderSizeNeverUpscalesAndStaysEven.

Proposal

  • Add ExportSettings.aspect: original, square or portrait9x16. Decode it leniently with original as the default; the fingerprint picks it up automatically.
  • Canvas size: for 1:1, use the resolution box's short side (1080p → 1080×1080); for 9:16, 1080p → 1080×1920. For original resolution, derive the size from the source's shorter side. Keep dimensions even and respect the H.264 limits.
  • Screen placement: fit (letterbox on a background color) or fill (crop), with a horizontal focus slider (focusX, 0…1) for fill.
  • Consider a bottom-center default bubble position for 9:16. The existing normalized x/y still works.

Acceptance criteria

  • The editor offers Original, 1:1 and 9:16, and the exported MP4 has the expected dimensions for every resolution and codec, with unit tests for renderSize.
  • The editor preview shows the same framing as the export, for both screen placement and bubble position.
  • Existing projects default to Original and render exactly as before, so the current ExportTests stay green.
  • Fit and fill both work, and fill respects the focus position.
  • An export test for 9:16 checks the dimensions and that the bubble lands where OverlayLayout says it should.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestexportRendering and exporting videouxUser experience and interface polish

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions