Skip to content

Commit 5e8abd7

Browse files
krishs0404claudejrusso1020
authored
feat(cli): add 1440p resolution presets to --resolution (#7418)
* feat(cli): add 1440p resolution presets to --resolution Adds landscape-1440p (2560x1440), portrait-1440p (1440x2560) and square-1440p (1440x1440) next to the existing 4K, 720p and 480p tiers, with the aliases 1440p, 2k and qhd plus 1440p-portrait and 1440p-square. 1440p joins the aspect-agnostic aliases, like 720p and 480p. Every validator derives from CANVAS_DIMENSIONS, so no logic changes: a 4K composition renders down to 1440p through the existing smaller-preset path, and a 1280x720 composition supersamples to 1440p at an exact 2x. A 1920x1080 composition is still refused by the non-integer-scale check (4/3); fractional scale factors are not part of this change. Refs #6309 Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * fix(cli): clarify 1440p aliases and repair skill validation --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]> Co-authored-by: James <[email protected]>
1 parent 91ad7fb commit 5e8abd7

12 files changed

Lines changed: 114 additions & 11 deletions

File tree

‎docs/packages/cli.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ npx hyperframes init my-video --tailwind
178178
| Flag | Description |
179179
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
180180
| `--example, -e` | Example to scaffold. Default is the centered blank. See [Examples](/examples) for the full list. |
181-
| `--resolution` | Canvas preset: `landscape` (1920×1080), `portrait` (1080×1920), `landscape-4k` (3840×2160), `portrait-4k` (2160×3840), `square` (1080×1080), `square-4k` (2160×2160). Aliases: `1080p`, `4k`, `uhd`, `1080p-square`, `square-1080p`, `4k-square`. Default: keep template dimensions. |
181+
| `--resolution` | Canvas preset: `landscape` (1920×1080), `portrait` (1080×1920), `landscape-4k` (3840×2160), `portrait-4k` (2160×3840), `square` (1080×1080), `square-4k` (2160×2160), `landscape-1440p` (2560×1440), `portrait-1440p` (1440×2560), `square-1440p` (1440×1440). Aliases: `1080p`, `4k`, `uhd`, `1440p`, `qhd`, `1080p-square`, `square-1080p`, `4k-square`, `1440p-portrait`, `1440p-square`. Default: keep template dimensions. |
182182
| `--video, -v` | Path to a video file (MP4, WebM, MOV) |
183183
| `--audio, -a` | Path to an audio file (MP3, WAV, M4A) |
184184
| `--tailwind` | Add Tailwind CSS browser-runtime support to the scaffolded HTML |
@@ -1822,7 +1822,7 @@ The flags that come up most:
18221822
| `--format` | `mp4` | `mp4`, `webm`, `mov`, `gif`, `png-sequence`, or `hls`. WebM and MOV carry transparency; `png-sequence` writes RGBA frames to a directory; `hls` writes a VOD playlist directory. |
18231823
| `--fps, -f` | root `data-fps`, otherwise 30 | 1–240, or an ffmpeg rational like `30000/1001` for 29.97 |
18241824
| `--quality, -q` | `looks` | `draft`, `looks` (CRF 16, default), `delivery` (= `high`), `standard`, or `high`. MOV always uses the fixed alpha-preserving ProRes 4444 profile. |
1825-
| `--resolution` | the composition's size | Supersample to a preset via Chrome's `deviceScaleFactor`. Aspect ratio must match and the scale must be a whole multiple. Not with `--hdr`. See [4K rendering](/guides/4k-rendering). |
1825+
| `--resolution` | the composition's size | Render to a preset via Chrome's `deviceScaleFactor`, including `landscape-1440p`, `portrait-1440p`, `square-1440p` (aliases `1440p`, `qhd`). Aspect ratio must match; upscaling requires an integer multiple. 720p→1440p and 4K→1440p work; 1080p→1440p is refused. Not with `--hdr`. See [4K rendering](/guides/4k-rendering). |
18261826
| `--docker` | off | Render inside Docker for [deterministic output](/concepts/determinism) |
18271827
| `--variables` | — | JSON object merged over the composition's `data-composition-variables` defaults |
18281828
| `--variables-file` | — | Read those overrides from a JSON file instead |

‎packages/cli/src/commands/init.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,25 @@ describe("applyResolutionPreset", () => {
625625
});
626626
});
627627

628+
it("rewrites every dimension fingerprint for landscape-1440p", () => {
629+
withFixture((dir) => {
630+
const file = join(dir, "index.html");
631+
writeFileSync(file, sampleHtml, "utf-8");
632+
633+
applyResolutionPreset(dir, "landscape-1440p");
634+
const out = readFileSync(file, "utf-8");
635+
636+
expect(out).toContain('data-resolution="landscape-1440p"');
637+
expect(out).toContain('data-width="2560"');
638+
expect(out).toContain('data-height="1440"');
639+
expect(out).toContain("width: 2560px");
640+
expect(out).toContain("height: 1440px");
641+
expect(out).toContain('content="width=2560, height=1440"');
642+
expect(out).not.toContain("1920");
643+
expect(out).not.toContain("1080");
644+
});
645+
});
646+
628647
it("swaps to portrait dimensions for portrait-4k", () => {
629648
withFixture((dir) => {
630649
const file = join(dir, "index.html");

‎packages/cli/src/commands/init.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ export default defineCommand({
842842
resolution: {
843843
type: "string",
844844
description:
845-
"Canvas resolution preset: landscape (1920x1080), portrait (1080x1920), landscape-4k (3840x2160), portrait-4k (2160x3840), square (1080x1080), square-4k (2160x2160). Aliases: 1080p, 4k, uhd, 1080p-square, square-1080p, 4k-square. Default: a --video clip's own shape as it plays, 1080 on the short side (4:3 -> 1440x1080), else the template's dimensions (typically 1920x1080).",
845+
"Canvas resolution preset: landscape (1920x1080), portrait (1080x1920), landscape-4k (3840x2160), portrait-4k (2160x3840), square (1080x1080), square-4k (2160x2160), landscape-1440p (2560x1440), portrait-1440p (1440x2560), square-1440p (1440x1440). Aliases: 1080p, 4k, uhd, 1440p, qhd, 1080p-square, square-1080p, 4k-square, 1440p-portrait, 1440p-square. Default: a --video clip's own shape as it plays, 1080 on the short side (4:3 -> 1440x1080), else the template's dimensions (typically 1920x1080).",
846846
},
847847
skill: {
848848
type: "string",
@@ -894,8 +894,9 @@ export default defineCommand({
894894
console.error(
895895
c.error(
896896
`Invalid --resolution: "${args.resolution}". ` +
897-
`Use one of: landscape, portrait, landscape-4k, portrait-4k, square, square-4k ` +
898-
`(or aliases 1080p, 4k, uhd, 1080p-square, square-1080p, 4k-square).`,
897+
`Use one of: landscape, portrait, landscape-4k, portrait-4k, square, square-4k, ` +
898+
`landscape-1440p, portrait-1440p, square-1440p ` +
899+
`(or aliases 1080p, 4k, uhd, 1440p, qhd, 1080p-square, square-1080p, 4k-square, 1440p-portrait, 1440p-square).`,
899900
),
900901
);
901902
failUsage();

‎packages/cli/src/commands/render.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,6 +2089,21 @@ describe("checkRenderResolutionPreflight", () => {
20892089
).toBeUndefined();
20902090
});
20912091

2092+
it("clears a landscape-1440p preset on a portrait 720p composition (an exact 2×)", async () => {
2093+
expect(
2094+
await checkRenderResolutionPreflight(comp(720, 1280), "landscape-1440p", agnostic),
2095+
).toBeUndefined();
2096+
});
2097+
2098+
it("refuses `--resolution 1440p` on a 1920×1080 composition: 4/3 is not an integer scale", async () => {
2099+
const result = await checkRenderResolutionPreflight(
2100+
landscapeHtml,
2101+
"landscape-1440p",
2102+
agnostic,
2103+
);
2104+
expect(result?.kind).toBe("non-integer-scale");
2105+
});
2106+
20922107
it("clears a landscape preset on a square composition", async () => {
20932108
// aspect > 1 → landscape, aspect = 1 → square. Both self-heal.
20942109
expect(

‎packages/cli/src/commands/render.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ export default defineCommand({
384384
resolution: {
385385
type: "string",
386386
description:
387-
"Output resolution preset: landscape (1920x1080), portrait (1080x1920), landscape-4k (3840x2160), portrait-4k (2160x3840), square (1080x1080), square-4k (2160x2160). Aliases: 1080p, 4k, uhd, 1080p-square, square-1080p, 4k-square. The composition is unchanged — Chrome renders at higher DPR (deviceScaleFactor) so the captured screenshot lands at the requested dimensions. Aspect ratio must match the composition; the scale must be an integer multiple. Not yet supported with --hdr.",
387+
"Output resolution preset: landscape (1920x1080), portrait (1080x1920), landscape-4k (3840x2160), portrait-4k (2160x3840), square (1080x1080), square-4k (2160x2160), landscape-1440p (2560x1440), portrait-1440p (1440x2560), square-1440p (1440x1440). Aliases: 1080p, 4k, uhd, 1440p, qhd, 1080p-square, square-1080p, 4k-square, 1440p-portrait, 1440p-square. The composition is unchanged — Chrome renders at higher DPR (deviceScaleFactor) so the captured screenshot lands at the requested dimensions. Aspect ratio must match the composition; upscaling requires an integer multiple. Not yet supported with --hdr.",
388388
},
389389
"page-side-compositing": {
390390
type: "boolean",

‎packages/cli/src/commands/render/plan.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,9 @@ export function createRenderPlan(args: RenderCommandArgs, now = new Date()): Ren
386386
if (!outputResolution) {
387387
errorBox(
388388
"Invalid resolution",
389-
`Got "${args.resolution}". Must be one of: landscape, portrait, landscape-4k, portrait-4k, square, square-4k ` +
390-
`(or aliases 1080p, 4k, uhd, 1080p-square, square-1080p, 4k-square).`,
389+
`Got "${args.resolution}". Must be one of: landscape, portrait, landscape-4k, portrait-4k, square, square-4k, ` +
390+
`landscape-1440p, portrait-1440p, square-1440p ` +
391+
`(or aliases 1080p, 4k, uhd, 1440p, qhd, 1080p-square, square-1080p, 4k-square, 1440p-portrait, 1440p-square).`,
391392
);
392393
failUsage();
393394
}

‎packages/core/src/index.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ describe("@hyperframes/core public API exports", () => {
1212
expect(core.CANVAS_DIMENSIONS["portrait-4k"]).toEqual({ width: 2160, height: 3840 });
1313
expect(core.CANVAS_DIMENSIONS.square).toEqual({ width: 1080, height: 1080 });
1414
expect(core.CANVAS_DIMENSIONS["square-4k"]).toEqual({ width: 2160, height: 2160 });
15+
expect(core.CANVAS_DIMENSIONS["landscape-1440p"]).toEqual({ width: 2560, height: 1440 });
16+
expect(core.CANVAS_DIMENSIONS["portrait-1440p"]).toEqual({ width: 1440, height: 2560 });
17+
expect(core.CANVAS_DIMENSIONS["square-1440p"]).toEqual({ width: 1440, height: 1440 });
1518
});
1619

1720
it("exports VALID_CANVAS_RESOLUTIONS derived from CANVAS_DIMENSIONS", () => {
@@ -22,6 +25,9 @@ describe("@hyperframes/core public API exports", () => {
2225
"portrait-4k",
2326
"square",
2427
"square-4k",
28+
"landscape-1440p",
29+
"portrait-1440p",
30+
"square-1440p",
2531
"landscape-720p",
2632
"portrait-720p",
2733
"square-720p",
@@ -41,6 +47,12 @@ describe("@hyperframes/core public API exports", () => {
4147
expect(core.normalizeResolutionFlag("square-4k")).toBe("square-4k");
4248
expect(core.normalizeResolutionFlag("1080p-square")).toBe("square");
4349
expect(core.normalizeResolutionFlag("4k-square")).toBe("square-4k");
50+
expect(core.normalizeResolutionFlag("1440p")).toBe("landscape-1440p");
51+
expect(core.normalizeResolutionFlag("2k")).toBeUndefined();
52+
expect(core.normalizeResolutionFlag("QHD")).toBe("landscape-1440p");
53+
expect(core.normalizeResolutionFlag("1440p-portrait")).toBe("portrait-1440p");
54+
expect(core.normalizeResolutionFlag("1440p-square")).toBe("square-1440p");
55+
expect(core.normalizeResolutionFlag("portrait-1440p")).toBe("portrait-1440p");
4456
expect(core.normalizeResolutionFlag("8k")).toBeUndefined();
4557
expect(core.normalizeResolutionFlag(undefined)).toBeUndefined();
4658
});
@@ -51,6 +63,9 @@ describe("@hyperframes/core public API exports", () => {
5163
expect(core.isAspectAgnosticResolutionAlias("hd")).toBe(true);
5264
expect(core.isAspectAgnosticResolutionAlias("4k")).toBe(true);
5365
expect(core.isAspectAgnosticResolutionAlias("uhd")).toBe(true);
66+
expect(core.isAspectAgnosticResolutionAlias("1440p")).toBe(true);
67+
expect(core.isAspectAgnosticResolutionAlias("2k")).toBe(false);
68+
expect(core.isAspectAgnosticResolutionAlias("qhd")).toBe(true);
5469
// Case-insensitive.
5570
expect(core.isAspectAgnosticResolutionAlias("1080P")).toBe(true);
5671
expect(core.isAspectAgnosticResolutionAlias("UHD")).toBe(true);
@@ -59,6 +74,7 @@ describe("@hyperframes/core public API exports", () => {
5974
expect(core.isAspectAgnosticResolutionAlias("portrait-1080p")).toBe(false);
6075
expect(core.isAspectAgnosticResolutionAlias("4k-square")).toBe(false);
6176
expect(core.isAspectAgnosticResolutionAlias("1080p-square")).toBe(false);
77+
expect(core.isAspectAgnosticResolutionAlias("1440p-portrait")).toBe(false);
6278
// Canonical presets → false.
6379
expect(core.isAspectAgnosticResolutionAlias("landscape")).toBe(false);
6480
expect(core.isAspectAgnosticResolutionAlias("portrait")).toBe(false);

‎packages/parsers/src/outputResolutionCompatibility.test.ts‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,46 @@ describe("checkOutputResolutionCompatibility", () => {
145145
},
146146
);
147147

148+
it.each([
149+
[1280, 720, "landscape-1440p"],
150+
[720, 1280, "portrait-1440p"],
151+
[720, 720, "square-1440p"],
152+
[2560, 1440, "landscape-1440p"],
153+
[3840, 2160, "landscape-1440p"],
154+
[2160, 3840, "portrait-1440p"],
155+
[2160, 2160, "square-1440p"],
156+
] as const)(
157+
"allows %i×%i to %s (an exact multiple or a smaller preset)",
158+
(compositionWidth, compositionHeight, outputResolution) => {
159+
expect(
160+
checkOutputResolutionCompatibility({
161+
compositionWidth,
162+
compositionHeight,
163+
outputResolution,
164+
}),
165+
).toEqual({ ok: true });
166+
},
167+
);
168+
169+
it("refuses 1920×1080 to landscape-1440p: 4/3 is not an integer scale factor", () => {
170+
const result = checkOutputResolutionCompatibility({
171+
compositionWidth: 1920,
172+
compositionHeight: 1080,
173+
outputResolution: "landscape-1440p",
174+
});
175+
expect(result.kind).toBe("non-integer-scale");
176+
});
177+
178+
it("keeps the 1440p tier when suggesting a swap for the wrong orientation", () => {
179+
const result = checkOutputResolutionCompatibility({
180+
compositionWidth: 2560,
181+
compositionHeight: 1440,
182+
outputResolution: "portrait-1440p",
183+
});
184+
expect(result.kind).toBe("aspect-mismatch");
185+
expect(result.suggestedResolution).toBe("landscape-1440p");
186+
});
187+
148188
it("keeps the 480p tier when suggesting a swap for the wrong orientation", () => {
149189
const result = checkOutputResolutionCompatibility({
150190
compositionWidth: 1920,

‎packages/parsers/src/types.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export const CANVAS_DIMENSIONS = {
2323
"portrait-4k": { width: 2160, height: 3840 },
2424
square: { width: 1080, height: 1080 },
2525
"square-4k": { width: 2160, height: 2160 },
26+
"landscape-1440p": { width: 2560, height: 1440 },
27+
"portrait-1440p": { width: 1440, height: 2560 },
28+
"square-1440p": { width: 1440, height: 1440 },
2629
"landscape-720p": { width: 1280, height: 720 },
2730
"portrait-720p": { width: 720, height: 1280 },
2831
"square-720p": { width: 720, height: 720 },
@@ -56,6 +59,10 @@ const RESOLUTION_ALIASES: Record<string, CanvasResolution> = {
5659
"1080p-square": "square",
5760
"square-1080p": "square",
5861
"4k-square": "square-4k",
62+
"1440p": "landscape-1440p",
63+
qhd: "landscape-1440p",
64+
"1440p-portrait": "portrait-1440p",
65+
"1440p-square": "square-1440p",
5966
"720p": "landscape-720p",
6067
"720p-portrait": "portrait-720p",
6168
"720p-square": "square-720p",
@@ -83,6 +90,8 @@ const ASPECT_AGNOSTIC_RESOLUTION_ALIASES: ReadonlySet<string> = new Set([
8390
"hd",
8491
"4k",
8592
"uhd",
93+
"1440p",
94+
"qhd",
8695
"720p",
8796
"480p",
8897
]);

‎skills-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"files": 78
1111
},
1212
"hyperframes-cli": {
13-
"hash": "adcd30f21c700eba",
13+
"hash": "53ea8e568639d20a",
1414
"files": 13
1515
},
1616
"hyperframes-registry": {

0 commit comments

Comments
 (0)