Skip to content

The open source AI video agent: turns any coding agent into a video agent, with an editor to change anything it makes.

Exports: a ProRes video's likely size runs from a title card's to detailed footage's (#251)

WEBGRS69f70b8ff477
diff --git a/.changeset/prores-size-range.md b/.changeset/prores-size-range.md
new file mode 100644
index 0000000..7d9e380
--- /dev/null
+++ b/.changeset/prores-size-range.md
@@ -0,0 +1,5 @@
+---
+"openfilm": patch
+---
+
+Exports: a ProRes video's likely size runs from what a title card comes to (about a twenty-fifth of ProRes's rate) to what detailed footage comes to (its rate). A simple film was shown at about ten times its size.
diff --git a/packages/openfilm/studio/ui/src/lib/export-spec.test.ts b/packages/openfilm/studio/ui/src/lib/export-spec.test.ts
index 4204745..54f4cce 100644
--- a/packages/openfilm/studio/ui/src/lib/export-spec.test.ts
+++ b/packages/openfilm/studio/ui/src/lib/export-spec.test.ts
@@ -25,7 +25,27 @@ test('the sizes measured exports came to fall inside the range shown', () => {
assert.ok(video('16:9', 16_523, true)[1] < 21e6 / 8 * 16.523);
});
-test('bars cost nothing; half the length is half the size; a CRF range is 16× wide, fixed-rate codecs ±10%', () => {
+test('ProRes exports measured on Windows (prores_ks) fall inside the range shown, from a title card to detailed footage', () => {
+ /* 5 s at 30 fps, no sound */
+ const prores = (codec: 'prores422hq' | 'prores4444', shortEdge: number) =>
+ exportEstimateBytes({ codec, size: { w: Math.round(shortEdge * 16 / 9), h: shortEdge }, fps: 30, quality: 'high', durationMs: 5_000, audio: false });
+ /* #227: a title card made in the app, a dark background and white words fading in */
+ within(prores('prores422hq', 1080), 13_338_371, 'title card, 422 HQ 1080p');
+ within(prores('prores4444', 720), 9_947_711, 'title card, 4444 720p');
+ within(prores('prores4444', 1080), 17_457_502, 'title card, 4444 1080p, transparent');
+ /* another title card, from 720p to 4K */
+ within(prores('prores422hq', 720), 4_810_000, 'title card, 422 HQ 720p');
+ within(prores('prores422hq', 2160), 27_210_000, 'title card, 422 HQ 4K');
+ within(prores('prores4444', 2160), 38_410_000, 'title card, 4444 4K');
+ /* motion graphics: a turning gradient, fourteen moving shapes, sliding words */
+ within(prores('prores422hq', 1080), 113_490_000, 'motion graphics, 422 HQ 1080p');
+ within(prores('prores4444', 720), 87_930_000, 'motion graphics, 4444 720p');
+ within(prores('prores4444', 1080), 172_010_000, 'motion graphics, 4444 1080p');
+ /* a fractal zoom, every frame full of detail */
+ within(prores('prores422hq', 1080), 135_670_000, 'detailed footage, 422 HQ 1080p');
+});
+
+test('bars cost nothing; half the length is half the size; a CRF range is 16× wide, ProRes from a twenty-fifth of its rate to its rate', () => {
const size = exportFramedDims(stage, '9:16', 'contain', 1080);
assert.deepEqual(size, { w: 1080, h: 1920 });
assert.ok(Math.abs(exportFilmPixels(stage, '9:16', 'contain', size) / (1080 * 607.5) - 1) < 0.01, 'the film, 1080 × 607.5, between bars');
@@ -35,7 +55,7 @@ test('bars cost nothing; half the length is half the size; a CRF range is 16× w
assert.ok(Math.abs(half[0] * 2 - low) <= 2 && Math.abs(half[1] * 2 - high) <= 2);
assert.ok(Math.abs(high / low - 16) < 0.01, "a CRF picture: 0.25× to 4× of a typical film");
const [p0, p1] = exportEstimateBytes({ codec: 'prores422hq', size: stage, fps: 30, quality: 'high', durationMs: 1_000, audio: false });
- assert.ok(Math.abs(p0 / 27.5e6 - 0.9) < 0.01 && Math.abs(p1 / 27.5e6 - 1.1) < 0.01, `${p0}–${p1}`);
+ assert.ok(Math.abs(p0 / 27.5e6 - 0.04) < 0.001 && Math.abs(p1 / 27.5e6 - 1.1) < 0.01, `${p0}–${p1}`);
});
test('a part of the film starts where clips start and ends where clips end, each named by those clips', () => {
diff --git a/packages/openfilm/studio/ui/src/lib/export-spec.ts b/packages/openfilm/studio/ui/src/lib/export-spec.ts
index 88000f7..1feef80 100644
--- a/packages/openfilm/studio/ui/src/lib/export-spec.ts
+++ b/packages/openfilm/studio/ui/src/lib/export-spec.ts
@@ -149,6 +149,9 @@ function givenBitrate(size: { w: number; h: number }, fps: number, quality: Expo
const TYPICAL_VIDEO = { w: 1920, h: 1080, fps: 30, bytes: 150_000 };
const VIDEO_SPREAD: readonly [number, number] = [0.25, 4];
const FIXED_SPREAD: readonly [number, number] = [0.9, 1.1];
+/* ProRes spends what each picture needs, up to about its rate: detailed footage comes to the rate, a title card on a
+ plain background to a twentieth or a tenth of it, a plain frame alone to a fortieth (by its pixels, at any size) */
+const PRORES_SPREAD: readonly [number, number] = [0.04, 1.1];
/** How a CRF file's size follows the settings: the quality's CRF, the codec at its CRF. */
const QUALITY_SIZE: Record<ExportQuality, number> = { standard: 0.58, high: 1, master: 1.6 };
@@ -187,9 +190,9 @@ export function exportEstimateBytes(spec: {
let videoBps: number;
let spread = FIXED_SPREAD;
switch (spec.codec) {
- /* ProRes is a fixed-rate family: 422 HQ about 220 Mbps at 1080p30, 4444 about 330, scaled by pixels × fps */
- case 'prores422hq': videoBps = 220_000_000 * (px / (1920 * 1080)) * (spec.fps / 30); break;
- case 'prores4444': videoBps = 330_000_000 * (px / (1920 * 1080)) * (spec.fps / 30); break;
+ /* ProRes's rate: 422 HQ about 220 Mbps at 1080p30, 4444 about 330, scaled by pixels × fps */
+ case 'prores422hq': videoBps = 220_000_000 * (px / (1920 * 1080)) * (spec.fps / 30); spread = PRORES_SPREAD; break;
+ case 'prores4444': videoBps = 330_000_000 * (px / (1920 * 1080)) * (spec.fps / 30); spread = PRORES_SPREAD; break;
/* HEVC with alpha (VideoToolbox) is given its bitrate */
case 'hevc_alpha': videoBps = givenBitrate(spec.size, spec.fps, spec.quality, 0.8); break;
/* a PNG sequence of motion graphics compresses well: about a byte per pixel */