shots record (web): frames at device pixels through Page.captureScreenshot (clip scale = dpr, long side capped at 1920, 3 requests in flight, midpoint timestamps into the ffmpeg concat); Chromium's screencast stayed at CSS size. Warnings for frames smaller than asked and under 20 frames/s; record-web browser test, pitfall 85
This commit is contained in:
parent
2d7cf6ec2b
commit
dda21d2570
10 changed files with 144 additions and 29 deletions
|
|
@ -5,7 +5,7 @@ import { setUpToDate } from '../cli/apple/asc';
|
|||
import { mimeType, previewAttrs, previewFiles, previewSets } from '../cli/apple/previews';
|
||||
import { type ShipConfig, validateConfig } from '../cli/lib/config';
|
||||
import { listingBody } from '../cli/play/listing';
|
||||
import { adbPullArgs, adbRecordArgs, adbRmArgs, clipName, concatArgs, concatList, recordSize, simRecordArgs, trimArgs, validateRecord } from '../cli/shots/devices';
|
||||
import { adbPullArgs, adbRecordArgs, adbRmArgs, captureShortfall, clipName, concatArgs, concatList, RECORD_MAX_SIDE, recordSize, simRecordArgs, trimArgs, validateRecord } from '../cli/shots/devices';
|
||||
import { clipsToRecord } from '../cli/shots/record';
|
||||
import { checkVideo, parseProbe, type ProbeInfo } from '../cli/shots/spec';
|
||||
import { clipFiles, defaultTargets, planClips, posterArgs, timeCode, videoArgs } from '../cli/shots/video';
|
||||
|
|
@ -116,9 +116,23 @@ describe('record', () => {
|
|||
expect(a.slice(3, 12)).toEqual(['-f', 'concat', '-safe', '0', '-i', 'l.txt', '-t', '6.000', '-vf']);
|
||||
expect(a.at(-1)).toBe('o.mp4');
|
||||
});
|
||||
test('record size: 2x, capped, even', () => {
|
||||
expect(recordSize({ w: 440, h: 902 })).toEqual({ width: 780, height: 1600 });
|
||||
expect(recordSize({ w: 301, h: 401 })).toEqual({ width: 602, height: 802 });
|
||||
test('record size: device pixels (clip scale = dpr), long side capped', () => {
|
||||
// a 430x932 @2x context: the screencast gave 430x932, captureScreenshot with scale 2 gives 860x1864
|
||||
expect(recordSize({ w: 430, h: 932, dpr: 2 })).toEqual({ width: 860, height: 1864, scale: 2 });
|
||||
expect(recordSize({ w: 301, h: 401, dpr: 2 })).toEqual({ width: 602, height: 802, scale: 2 });
|
||||
expect(recordSize({ w: 360, h: 640, dpr: 1 })).toEqual({ width: 360, height: 640, scale: 1 });
|
||||
// default 3x phone (2706 px tall) and the 13" iPad: capped at the tallest store video, never below the frame's CSS size
|
||||
const phone = recordSize({ w: 440, h: 902, dpr: 3 });
|
||||
expect(phone.height).toBe(RECORD_MAX_SIDE);
|
||||
expect(phone.width).toBe(937);
|
||||
expect(phone.scale).toBeCloseTo(1920 / 902, 6);
|
||||
expect(recordSize({ w: 1032, h: 1352, dpr: 2 })).toMatchObject({ width: 1466, height: 1920 });
|
||||
expect(recordSize({ w: 440, h: 902 }).scale).toBe(2);
|
||||
});
|
||||
test('capture guardrail: frames smaller than requested', () => {
|
||||
expect(captureShortfall({ w: 860, h: 1864 }, { width: 860, height: 1864 })).toBeNull();
|
||||
expect(captureShortfall({ w: 937, h: 1919 }, { width: 937, height: 1920 })).toBeNull();
|
||||
expect(captureShortfall({ w: 430, h: 932 }, { width: 860, height: 1864 })).toContain('frames are 430x932, asked for 860x1864');
|
||||
});
|
||||
test('config checks', () => {
|
||||
expect(validateRecord({ clips: { a: { seconds: 8, path: '/' } } }, cap)).toEqual([]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue