@tmhs/screencast-mcp 0.49.0 → 0.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/backdrop.js +1 -11
- package/dist/tools/bugReport.js +5 -28
- package/dist/tools/burnSubtitles.js +2 -2
- package/dist/tools/callout.js +1 -42
- package/dist/tools/contactSheet.js +3 -25
- package/dist/tools/cursor.js +2 -22
- package/dist/tools/denoise.js +2 -2
- package/dist/tools/findText.js +1 -3
- package/dist/tools/keystrokeOverlay.js +3 -44
- package/dist/tools/normalizeAudio.js +3 -4
- package/dist/tools/pipeline.js +16 -19
- package/dist/tools/redactRegion.js +2 -10
- package/dist/tools/reframe.js +3 -3
- package/dist/tools/stepGuide.js +1 -2
- package/dist/tools/titleCard.js +1 -1
- package/dist/tools/waitForChange.js +29 -15
- package/dist/tools/zoom.js +3 -18
- package/dist/utils/audio.js +4 -0
- package/dist/utils/backdrop.js +12 -1
- package/dist/utils/bugReport.js +23 -0
- package/dist/utils/callout.js +42 -0
- package/dist/utils/captions.js +1 -0
- package/dist/utils/cursor.js +22 -1
- package/dist/utils/diff.js +6 -4
- package/dist/utils/frameQueue.js +50 -0
- package/dist/utils/keystrokes.js +44 -1
- package/dist/utils/media.js +10 -0
- package/dist/utils/ocrScan.js +2 -0
- package/dist/utils/produce.js +2 -0
- package/dist/utils/sheet.js +25 -2
- package/dist/utils/zoom.js +18 -0
- package/package.json +1 -1
package/dist/tools/backdrop.js
CHANGED
|
@@ -5,20 +5,10 @@ import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
|
5
5
|
import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
|
|
6
6
|
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
7
7
|
import { runEditJob } from "../utils/jobs.js";
|
|
8
|
-
import { buildBackdropArgs,
|
|
8
|
+
import { buildBackdropArgs, backdropOptionsSchema } from "../utils/backdrop.js";
|
|
9
9
|
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
10
10
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
11
11
|
const STILL = /\.(png|jpe?g|bmp|tiff?|webp)$/i;
|
|
12
|
-
export const backdropOptionsSchema = {
|
|
13
|
-
preset: z.enum(BACKDROP_PRESET_NAMES).optional(),
|
|
14
|
-
colors: z.array(z.string()).min(1).max(MAX_BACKDROP_COLORS).optional(),
|
|
15
|
-
image: z.string().min(1).optional(),
|
|
16
|
-
padding: z.number().int().nonnegative().max(2000).optional(),
|
|
17
|
-
radius: z.number().int().nonnegative().max(1000).optional(),
|
|
18
|
-
shadow: z.number().int().nonnegative().max(200).optional(),
|
|
19
|
-
shadowOpacity: z.number().min(0).max(1).optional(),
|
|
20
|
-
aspect: z.enum(["16:9", "9:16", "1:1", "4:5"]).optional(),
|
|
21
|
-
};
|
|
22
12
|
const o = backdropOptionsSchema;
|
|
23
13
|
const inputSchema = {
|
|
24
14
|
input: z.string().min(1).describe("Path to the source video or image (png/jpg)."),
|
package/dist/tools/bugReport.js
CHANGED
|
@@ -10,18 +10,15 @@ import { runEditJob } from "../utils/jobs.js";
|
|
|
10
10
|
import { planPipeline } from "../utils/pipeline.js";
|
|
11
11
|
import { exportAnimation } from "../utils/animExport.js";
|
|
12
12
|
import { DEFAULT_MAX_BYTES } from "../utils/anim.js";
|
|
13
|
-
import { evenTimes, DEFAULT_SHEET_COUNT, DEFAULT_TILE_WIDTH } from "../utils/sheet.js";
|
|
14
|
-
import { scanVideoFrames, scanMatches } from "../utils/ocrScan.js";
|
|
15
|
-
import {
|
|
13
|
+
import { evenTimes, DEFAULT_SHEET_COUNT, DEFAULT_TILE_WIDTH, renderContactSheet } from "../utils/sheet.js";
|
|
14
|
+
import { scanVideoFrames, scanMatches, DEFAULT_SCAN_FRAMES, MAX_SCAN_FRAMES } from "../utils/ocrScan.js";
|
|
15
|
+
import { parseEventsJsonl } from "../utils/events.js";
|
|
16
16
|
import { ocrStatus, parseFfmpegVersion, versionText } from "../utils/capabilities.js";
|
|
17
17
|
import { getMonitors } from "../utils/monitors.js";
|
|
18
18
|
import { resolveOutputDir, subdir, stamp, rand } from "../utils/paths.js";
|
|
19
19
|
import { encodeInlineImages, DEFAULT_MAX_IMAGE_WIDTH } from "../utils/images.js";
|
|
20
|
-
import {
|
|
21
|
-
import { redactRegionSchema } from "
|
|
22
|
-
import { renderContactSheet } from "./contactSheet.js";
|
|
23
|
-
import { DEFAULT_SCAN_FRAMES, MAX_SCAN_FRAMES } from "./findText.js";
|
|
24
|
-
import { DEFAULT_CLIP_SEC, DEFAULT_ERROR_PATTERN, DEFAULT_SCAN_EVERY_SEC, DEFAULT_SECRET_PATTERN, MAX_CLIP_SEC, MAX_STEPS, REPORT_FILES, buildReportMarkdown, clipWindow, errorFindings, maskSecrets, mergeRedactions, reconstructSteps, } from "../utils/bugReport.js";
|
|
20
|
+
import { DEFAULT_CLIP_SEC, DEFAULT_ERROR_PATTERN, DEFAULT_SCAN_EVERY_SEC, DEFAULT_SECRET_PATTERN, MAX_CLIP_SEC, MAX_STEPS, REPORT_FILES, buildReportMarkdown, clipWindow, errorFindings, maskSecrets, mergeRedactions, reconstructSteps, resolveSource, } from "../utils/bugReport.js";
|
|
21
|
+
import { redactRegionSchema } from "../utils/media.js";
|
|
25
22
|
const { version: serverVersion } = createRequire(import.meta.url)("../../package.json");
|
|
26
23
|
const inputSchema = {
|
|
27
24
|
input: z.string().min(1).optional().describe("Recording path (uses its .events.jsonl)."),
|
|
@@ -44,26 +41,6 @@ const inputSchema = {
|
|
|
44
41
|
overwrite: z.boolean().optional().describe("Replace a report already in outputDir."),
|
|
45
42
|
};
|
|
46
43
|
const r3 = (n) => Math.round(n * 1000) / 1000;
|
|
47
|
-
export async function resolveSource(args) {
|
|
48
|
-
if (args.sessionId !== undefined) {
|
|
49
|
-
const record = getStore().get(args.sessionId);
|
|
50
|
-
if (!record)
|
|
51
|
-
throw new ScreencastError(`No session with id "${args.sessionId}".`);
|
|
52
|
-
if (record.status === "recording" || record.status === "paused") {
|
|
53
|
-
throw new ScreencastError("The recording is still running; stop_recording it first.");
|
|
54
|
-
}
|
|
55
|
-
await whenFinalized(record.id);
|
|
56
|
-
if (!existsSync(record.outputPath))
|
|
57
|
-
throw new ScreencastError(`The session's recording is missing: ${record.outputPath}`);
|
|
58
|
-
const events = record.events?.path;
|
|
59
|
-
return { path: record.outputPath, eventsPath: events && existsSync(events) ? events : null, record };
|
|
60
|
-
}
|
|
61
|
-
const path = args.input;
|
|
62
|
-
if (!existsSync(path))
|
|
63
|
-
throw new ScreencastError(`Input file not found: ${path}`);
|
|
64
|
-
const { jsonl } = eventPaths(path);
|
|
65
|
-
return { path, eventsPath: existsSync(jsonl) ? jsonl : null };
|
|
66
|
-
}
|
|
67
44
|
async function displayRows() {
|
|
68
45
|
if (process.platform !== "win32")
|
|
69
46
|
return null;
|
|
@@ -5,7 +5,7 @@ import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
|
5
5
|
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
6
6
|
import { requireFfmpeg, probeMedia, hasFilter } from "../utils/ffmpeg.js";
|
|
7
7
|
import { runEditJob } from "../utils/jobs.js";
|
|
8
|
-
import { buildBurnSubtitlesArgs } from "../utils/captions.js";
|
|
8
|
+
import { buildBurnSubtitlesArgs, CAPTION_STYLE_NAMES } from "../utils/captions.js";
|
|
9
9
|
import { bundledFontPath } from "../utils/fonts.js";
|
|
10
10
|
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
11
11
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
@@ -13,7 +13,7 @@ const inputSchema = {
|
|
|
13
13
|
input: z.string().min(1).describe("Path to the source video."),
|
|
14
14
|
subtitles: z.string().min(1).describe("Path to an .srt (e.g. from transcribe) or .ass subtitle file."),
|
|
15
15
|
style: z
|
|
16
|
-
.enum(
|
|
16
|
+
.enum(CAPTION_STYLE_NAMES)
|
|
17
17
|
.optional()
|
|
18
18
|
.describe("clean (default for .srt): outlined line. social: big bold text on a dark box. .ass keeps its own " +
|
|
19
19
|
"styling unless set."),
|
package/dist/tools/callout.js
CHANGED
|
@@ -6,51 +6,10 @@ import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
|
6
6
|
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
7
7
|
import { requireFfmpeg } from "../utils/ffmpeg.js";
|
|
8
8
|
import { runEditJob, probeDuration } from "../utils/jobs.js";
|
|
9
|
-
import { buildCalloutArgs } from "../utils/callout.js";
|
|
9
|
+
import { buildCalloutArgs, calloutItemSchema, fontFileSchema } from "../utils/callout.js";
|
|
10
10
|
import { prepareCalloutAssets } from "../utils/calloutAssets.js";
|
|
11
11
|
import { stillEdit } from "../utils/media.js";
|
|
12
12
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
13
|
-
const timing = {
|
|
14
|
-
from: z.number().nonnegative().optional(),
|
|
15
|
-
to: z.number().positive().optional(),
|
|
16
|
-
color: z.string().optional(),
|
|
17
|
-
};
|
|
18
|
-
export const fontFileSchema = z
|
|
19
|
-
.string()
|
|
20
|
-
.min(1)
|
|
21
|
-
.optional()
|
|
22
|
-
.describe("Font: a .ttf/.otf/.ttc path or a C:\\Windows\\Fonts file name. Default: bundled Inter, with a " +
|
|
23
|
-
"covering system font for scripts it lacks (CJK, emoji, Arabic, ...).");
|
|
24
|
-
export const calloutItemSchema = z.discriminatedUnion("type", [
|
|
25
|
-
z.object({
|
|
26
|
-
type: z.literal("box"),
|
|
27
|
-
x: z.number(),
|
|
28
|
-
y: z.number(),
|
|
29
|
-
width: z.number().positive(),
|
|
30
|
-
height: z.number().positive(),
|
|
31
|
-
thickness: z.number().positive().optional().describe("Outline px (default 4)."),
|
|
32
|
-
fill: z.boolean().optional().describe("Fill instead of outline."),
|
|
33
|
-
...timing,
|
|
34
|
-
}),
|
|
35
|
-
z.object({
|
|
36
|
-
type: z.literal("text"),
|
|
37
|
-
x: z.number(),
|
|
38
|
-
y: z.number(),
|
|
39
|
-
text: z.string().min(1),
|
|
40
|
-
size: z.number().positive().optional().describe("Font size px (default 32)."),
|
|
41
|
-
background: z.boolean().optional().describe("Dark panel behind the text (default true)."),
|
|
42
|
-
...timing,
|
|
43
|
-
}),
|
|
44
|
-
z.object({
|
|
45
|
-
type: z.literal("arrow"),
|
|
46
|
-
x1: z.number(),
|
|
47
|
-
y1: z.number(),
|
|
48
|
-
x2: z.number().describe("Head (x2,y2) is the point the arrow points at."),
|
|
49
|
-
y2: z.number(),
|
|
50
|
-
thickness: z.number().positive().optional().describe("Shaft px (default 8)."),
|
|
51
|
-
...timing,
|
|
52
|
-
}),
|
|
53
|
-
]);
|
|
54
13
|
const inputSchema = {
|
|
55
14
|
input: z.string().min(1).describe("Path to the source video or image (png/jpg; from/to are ignored for an image)."),
|
|
56
15
|
items: z
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
import { existsSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { tmpdir } from "node:os";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
5
3
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
6
4
|
import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
|
|
7
5
|
import { requireFfmpeg, runFfmpeg, runCapture, probeMedia } from "../utils/ffmpeg.js";
|
|
8
6
|
import { jobTimeoutMs } from "../utils/jobs.js";
|
|
9
7
|
import { buildSceneScanArgs, parseSceneScan, pickSceneFrames, DEFAULT_SCENE_THRESHOLD, } from "../utils/media.js";
|
|
10
|
-
import { evenTimes,
|
|
11
|
-
import {
|
|
12
|
-
import { resolveOutput, subdir, stamp, rand, sequencePattern } from "../utils/paths.js";
|
|
8
|
+
import { evenTimes, buildPosterArgs, DEFAULT_SHEET_COUNT, MAX_SHEET_COUNT, DEFAULT_TILE_WIDTH, renderContactSheet, } from "../utils/sheet.js";
|
|
9
|
+
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
13
10
|
import { encodeInlineImages, DEFAULT_MAX_IMAGE_WIDTH } from "../utils/images.js";
|
|
14
|
-
import { mapPool } from "../utils/pool.js";
|
|
15
11
|
const inputSchema = {
|
|
16
12
|
input: z.string().min(1).describe("Path to the source video."),
|
|
17
13
|
count: z
|
|
@@ -56,24 +52,6 @@ const inputSchema = {
|
|
|
56
52
|
.optional()
|
|
57
53
|
.describe(`Max inline image width (default ${DEFAULT_MAX_IMAGE_WIDTH}).`),
|
|
58
54
|
};
|
|
59
|
-
export async function renderContactSheet(input, times, output, opts, signal) {
|
|
60
|
-
const grid = sheetGrid(times.length, opts.columns);
|
|
61
|
-
const work = mkdtempSync(join(tmpdir(), "screencast-sheet-"));
|
|
62
|
-
try {
|
|
63
|
-
const font = bundledFontPath("bold");
|
|
64
|
-
await mapPool(times, async (t, i) => {
|
|
65
|
-
const labelFile = join(work, `label_${i}.txt`);
|
|
66
|
-
writeFileSync(labelFile, formatTimecode(t));
|
|
67
|
-
const tile = join(work, `tile_${String(i).padStart(3, "0")}.png`);
|
|
68
|
-
await runFfmpeg(buildTileArgs(input, t, tile, opts.tileWidth, font, labelFile), 60_000, { signal });
|
|
69
|
-
});
|
|
70
|
-
await runFfmpeg(buildSheetArgs(sequencePattern(work, "tile_%03d.png"), grid, output), 60_000, { signal });
|
|
71
|
-
}
|
|
72
|
-
finally {
|
|
73
|
-
rmSync(work, { recursive: true, force: true });
|
|
74
|
-
}
|
|
75
|
-
return grid;
|
|
76
|
-
}
|
|
77
55
|
export function register(server) {
|
|
78
56
|
server.registerTool("contact_sheet", {
|
|
79
57
|
title: "Contact Sheet",
|
package/dist/tools/cursor.js
CHANGED
|
@@ -1,35 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { existsSync, mkdtempSync,
|
|
3
|
+
import { existsSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
6
6
|
import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
|
|
7
7
|
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
8
8
|
import { runEditJob } from "../utils/jobs.js";
|
|
9
|
-
import {
|
|
10
|
-
import { buildCursorArgs, cursorSpritePath, planCursor, transformCursor, DEFAULT_CURSOR_SIZE, DEFAULT_HIDE_AFTER_SEC, } from "../utils/cursor.js";
|
|
9
|
+
import { buildCursorArgs, cursorSpritePath, transformCursor, DEFAULT_CURSOR_SIZE, DEFAULT_HIDE_AFTER_SEC, cursorOptionsSchema, loadCursor, } from "../utils/cursor.js";
|
|
11
10
|
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
12
11
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
13
|
-
export const cursorOptionsSchema = {
|
|
14
|
-
events: z.string().optional(),
|
|
15
|
-
size: z.number().min(0.25).max(8).optional(),
|
|
16
|
-
smoothing: z.number().min(0).max(1).optional(),
|
|
17
|
-
hideAfterSec: z.number().min(0).max(600).optional(),
|
|
18
|
-
clicks: z.boolean().optional(),
|
|
19
|
-
spotlight: z.boolean().optional(),
|
|
20
|
-
};
|
|
21
12
|
const o = cursorOptionsSchema;
|
|
22
|
-
export function loadCursor(input, events, opts, endSec) {
|
|
23
|
-
const path = events ?? eventPaths(input).jsonl;
|
|
24
|
-
if (!existsSync(path)) {
|
|
25
|
-
throw new ScreencastError(`No event log for ${input} (looked for ${path}). Record with start_recording cursor: "events" ` +
|
|
26
|
-
"(no OS cursor in the video, events logged), or pass events: <path to .events.jsonl>.");
|
|
27
|
-
}
|
|
28
|
-
const plan = planCursor(parseEventsJsonl(readFileSync(path, "utf8")), opts, endSec);
|
|
29
|
-
if (plan.path.length === 0)
|
|
30
|
-
throw new ScreencastError(`The event log ${path} has no cursor positions to draw.`);
|
|
31
|
-
return plan;
|
|
32
|
-
}
|
|
33
13
|
const inputSchema = {
|
|
34
14
|
input: z.string().min(1).describe("Path to the recording."),
|
|
35
15
|
events: o.events.describe("Event log (default: the input's .events.jsonl)."),
|
package/dist/tools/denoise.js
CHANGED
|
@@ -4,13 +4,13 @@ import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
|
4
4
|
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
5
5
|
import { requireFfmpeg, runCapture, probeMedia } from "../utils/ffmpeg.js";
|
|
6
6
|
import { runEditJob, jobTimeoutMs } from "../utils/jobs.js";
|
|
7
|
-
import { buildDenoiseArgs, buildNoiseFloorArgs, parseNoiseFloor } from "../utils/audio.js";
|
|
7
|
+
import { buildDenoiseArgs, buildNoiseFloorArgs, parseNoiseFloor, DENOISE_STRENGTHS } from "../utils/audio.js";
|
|
8
8
|
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
9
9
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
10
10
|
const inputSchema = {
|
|
11
11
|
input: z.string().min(1).describe("Path to the source video or audio file."),
|
|
12
12
|
strength: z
|
|
13
|
-
.enum(
|
|
13
|
+
.enum(DENOISE_STRENGTHS)
|
|
14
14
|
.optional()
|
|
15
15
|
.describe("How hard to reduce noise: light (6 dB), medium (12 dB, default), strong (20 dB)."),
|
|
16
16
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
package/dist/tools/findText.js
CHANGED
|
@@ -9,15 +9,13 @@ import { resolveCaptureTarget } from "../utils/resolveTarget.js";
|
|
|
9
9
|
import { captureStill } from "../utils/still.js";
|
|
10
10
|
import { buildHighlightArgs, targetSize } from "../utils/diff.js";
|
|
11
11
|
import { findMatches, redactionRects } from "../utils/ocr.js";
|
|
12
|
-
import { readFrames, scanVideoFrames, scanMatches } from "../utils/ocrScan.js";
|
|
12
|
+
import { readFrames, scanVideoFrames, scanMatches, DEFAULT_SCAN_FRAMES, MAX_SCAN_FRAMES } from "../utils/ocrScan.js";
|
|
13
13
|
import { windowMatchReport } from "../utils/windows.js";
|
|
14
14
|
import { confirmCapture, describeTarget } from "../utils/consent.js";
|
|
15
15
|
import { subdir, stamp, rand, stillOutput } from "../utils/paths.js";
|
|
16
16
|
import { encodeInlineImages, DEFAULT_MAX_IMAGE_WIDTH } from "../utils/images.js";
|
|
17
17
|
const IMAGE_EXTENSIONS = new Set([".png", ".jpg", ".jpeg", ".bmp", ".gif", ".webp", ".tif", ".tiff"]);
|
|
18
18
|
const MAX_LINES = 300;
|
|
19
|
-
export const DEFAULT_SCAN_FRAMES = 30;
|
|
20
|
-
export const MAX_SCAN_FRAMES = 120;
|
|
21
19
|
const inputSchema = {
|
|
22
20
|
target: z
|
|
23
21
|
.string()
|
|
@@ -1,57 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { existsSync, mkdtempSync,
|
|
3
|
+
import { existsSync, mkdtempSync, rmSync } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
5
5
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
6
6
|
import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
|
|
7
7
|
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
8
8
|
import { runEditJob } from "../utils/jobs.js";
|
|
9
|
-
import {
|
|
10
|
-
import { resolveTextFont } from "../utils/fonts.js";
|
|
11
|
-
import { planBadges, groupBadges, buildKeystrokeArgs, BADGE_POSITIONS, DEFAULT_LINGER_SEC, } from "../utils/keystrokes.js";
|
|
9
|
+
import { groupBadges, buildKeystrokeArgs, DEFAULT_LINGER_SEC, keystrokeOptionsSchema, loadBadges, prepareKeystrokeAssets, } from "../utils/keystrokes.js";
|
|
12
10
|
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
13
11
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
14
|
-
import { fontFileSchema } from "
|
|
15
|
-
export const keystrokeOptionsSchema = {
|
|
16
|
-
events: z.string().optional(),
|
|
17
|
-
clicks: z.boolean().optional(),
|
|
18
|
-
typing: z.boolean().optional(),
|
|
19
|
-
keys: z.enum(["shortcuts", "masked"]).optional(),
|
|
20
|
-
lingerSec: z.number().positive().max(10).optional(),
|
|
21
|
-
position: z.enum(BADGE_POSITIONS).optional(),
|
|
22
|
-
size: z.number().min(8).max(400).optional(),
|
|
23
|
-
color: z.string().optional(),
|
|
24
|
-
fontFile: z.string().min(1).optional(),
|
|
25
|
-
};
|
|
12
|
+
import { fontFileSchema } from "../utils/callout.js";
|
|
26
13
|
const o = keystrokeOptionsSchema;
|
|
27
|
-
export function loadBadges(input, events, opts) {
|
|
28
|
-
const path = events ?? eventPaths(input).jsonl;
|
|
29
|
-
if (!existsSync(path)) {
|
|
30
|
-
throw new ScreencastError(`No event log for ${input} (looked for ${path}). Record with start_recording events: true ` +
|
|
31
|
-
'(keys: "shortcuts" to name shortcuts), or pass events: <path to .events.jsonl>.');
|
|
32
|
-
}
|
|
33
|
-
const log = parseEventsJsonl(readFileSync(path, "utf8"));
|
|
34
|
-
return { badges: planBadges(log, opts), shortcutsLogged: log.filter((e) => e.type === "key").length, path };
|
|
35
|
-
}
|
|
36
|
-
export function prepareKeystrokeAssets(labels, workDir, tag = "", fontFile) {
|
|
37
|
-
const font = resolveTextFont(labels.join(" "), { weight: "bold", fontFile });
|
|
38
|
-
const textFiles = {};
|
|
39
|
-
labels.forEach((label, i) => {
|
|
40
|
-
if (workDir === null) {
|
|
41
|
-
textFiles[label] = `<badge ${i}>`;
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const f = join(workDir, `${tag}badge_${i}.txt`);
|
|
45
|
-
writeFileSync(f, label);
|
|
46
|
-
textFiles[label] = f;
|
|
47
|
-
});
|
|
48
|
-
return {
|
|
49
|
-
fontFile: font.fontFile,
|
|
50
|
-
textFiles,
|
|
51
|
-
...(font.fallback && { fallbackFont: font.fontFile }),
|
|
52
|
-
warnings: font.warning ? [font.warning] : [],
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
14
|
const inputSchema = {
|
|
56
15
|
input: z.string().min(1).describe("Path to the recording."),
|
|
57
16
|
events: o.events.describe("Event log (default: the input's .events.jsonl)."),
|
|
@@ -4,15 +4,14 @@ import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
|
4
4
|
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
5
5
|
import { requireFfmpeg, runCapture, probeMedia } from "../utils/ffmpeg.js";
|
|
6
6
|
import { runEditJob, jobTimeoutMs } from "../utils/jobs.js";
|
|
7
|
-
import { loudnessTarget, buildLoudnessMeasureArgs, buildLoudnessApplyArgs, parseLoudnorm, } from "../utils/audio.js";
|
|
7
|
+
import { loudnessTarget, buildLoudnessMeasureArgs, buildLoudnessApplyArgs, parseLoudnorm, loudnessTargetSchema, } from "../utils/audio.js";
|
|
8
8
|
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
9
9
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
10
10
|
const inputSchema = {
|
|
11
11
|
input: z.string().min(1).describe("Path to the source video or audio file."),
|
|
12
|
-
target:
|
|
13
|
-
.union([z.enum(["youtube", "podcast", "broadcast"]), z.number()])
|
|
12
|
+
target: loudnessTargetSchema
|
|
14
13
|
.optional()
|
|
15
|
-
.describe("youtube (-14 LUFS, default), podcast (-16), broadcast (-23), or a LUFS number."),
|
|
14
|
+
.describe("youtube (-14 LUFS, default), podcast (-16), broadcast (-23), or a LUFS number (-70 to -5)."),
|
|
16
15
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
17
16
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
18
17
|
};
|
package/dist/tools/pipeline.js
CHANGED
|
@@ -9,25 +9,22 @@ import { jobTimeoutMs, runEditJob } from "../utils/jobs.js";
|
|
|
9
9
|
import { planPipeline, probeArgs, sidecarCues, MAX_PIPELINE_STEPS } from "../utils/pipeline.js";
|
|
10
10
|
import { calloutFonts, prepareCalloutAssets } from "../utils/calloutAssets.js";
|
|
11
11
|
import { exportAnimation } from "../utils/animExport.js";
|
|
12
|
-
import {
|
|
13
|
-
import { assertEditContainer } from "../utils/media.js";
|
|
14
|
-
import { readClicks, zoomKeyframeSchema } from "./zoom.js";
|
|
15
|
-
import { redactRegionSchema } from "./redactRegion.js";
|
|
12
|
+
import { assertEditContainer, redactRegionSchema, REDACT_STYLES } from "../utils/media.js";
|
|
16
13
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
17
|
-
import { PLATFORMS } from "../utils/produce.js";
|
|
14
|
+
import { PLATFORMS, ASPECTS, REFRAME_FITS } from "../utils/produce.js";
|
|
18
15
|
import { buildChapters, ffmetadata, markerPoints, markersOrChapters, retimeMarkers, writeMarkers } from "../utils/chapters.js";
|
|
19
|
-
import { cursorOptionsSchema, loadCursor } from "
|
|
20
|
-
import {
|
|
21
|
-
import { backdropOptionsSchema } from "./backdrop.js";
|
|
22
|
-
import { keystrokeOptionsSchema, loadBadges, prepareKeystrokeAssets } from "./keystrokeOverlay.js";
|
|
23
|
-
import { MAX_ZOOM } from "../utils/zoom.js";
|
|
16
|
+
import { cursorSpritePath, cursorOptionsSchema, loadCursor } from "../utils/cursor.js";
|
|
17
|
+
import { MAX_ZOOM, readClicks, zoomKeyframeSchema } from "../utils/zoom.js";
|
|
24
18
|
import { buildIdleScanArgs, intersect, parseFreezes, parseSilences, DEFAULT_MIN_IDLE_SEC } from "../utils/idle.js";
|
|
25
|
-
import { buildLoudnessMeasureArgs, buildNoiseFloorArgs, loudnessTarget, parseLoudnorm, parseNoiseFloor } from "../utils/audio.js";
|
|
26
|
-
import { buildTranscribeArgs, formatSrt, normalizeCues, parseSrt, resolveWhisperModel } from "../utils/captions.js";
|
|
19
|
+
import { buildLoudnessMeasureArgs, buildNoiseFloorArgs, loudnessTarget, parseLoudnorm, parseNoiseFloor, DENOISE_STRENGTHS, loudnessTargetSchema } from "../utils/audio.js";
|
|
20
|
+
import { buildTranscribeArgs, formatSrt, normalizeCues, parseSrt, resolveWhisperModel, CAPTION_STYLE_NAMES } from "../utils/captions.js";
|
|
27
21
|
import { eventPaths } from "../utils/events.js";
|
|
28
22
|
import { bundledFontPath } from "../utils/fonts.js";
|
|
29
23
|
import { retimeAss, retimeCues } from "../utils/timeline.js";
|
|
30
24
|
import { applyOverrides, recipeSteps, RECIPES } from "../utils/recipes.js";
|
|
25
|
+
import { calloutItemSchema, fontFileSchema } from "../utils/callout.js";
|
|
26
|
+
import { backdropOptionsSchema } from "../utils/backdrop.js";
|
|
27
|
+
import { keystrokeOptionsSchema, loadBadges, prepareKeystrokeAssets } from "../utils/keystrokes.js";
|
|
31
28
|
function transcribeBlocker() {
|
|
32
29
|
if (!hasFilter("whisper"))
|
|
33
30
|
return "this ffmpeg has no whisper filter (FFmpeg 8 with whisper.cpp).";
|
|
@@ -39,8 +36,8 @@ function transcribeBlocker() {
|
|
|
39
36
|
return "no whisper model (set SCREENCAST_WHISPER_MODEL).";
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
|
-
const aspect = z.enum(
|
|
43
|
-
const fit = z.enum(
|
|
39
|
+
const aspect = z.enum(ASPECTS);
|
|
40
|
+
const fit = z.enum(REFRAME_FITS).optional();
|
|
44
41
|
const step = z.discriminatedUnion("op", [
|
|
45
42
|
z.object({
|
|
46
43
|
op: z.literal("trim"),
|
|
@@ -60,7 +57,7 @@ const step = z.discriminatedUnion("op", [
|
|
|
60
57
|
z.object({
|
|
61
58
|
op: z.literal("redact"),
|
|
62
59
|
regions: z.array(redactRegionSchema).min(1),
|
|
63
|
-
style: z.enum(
|
|
60
|
+
style: z.enum(REDACT_STYLES).optional(),
|
|
64
61
|
pad: z.number().int().nonnegative().optional(),
|
|
65
62
|
color: z.string().optional(),
|
|
66
63
|
}),
|
|
@@ -77,14 +74,14 @@ const step = z.discriminatedUnion("op", [
|
|
|
77
74
|
z.object({ op: z.literal("cut_idle"), minIdleSec: z.number().positive().optional(), keepSec: z.number().min(0).optional() }),
|
|
78
75
|
z.object({
|
|
79
76
|
op: z.literal("audio"),
|
|
80
|
-
normalize:
|
|
81
|
-
denoise: z.enum(
|
|
77
|
+
normalize: loudnessTargetSchema.optional(),
|
|
78
|
+
denoise: z.enum(DENOISE_STRENGTHS).optional(),
|
|
82
79
|
}),
|
|
83
80
|
z.object({
|
|
84
81
|
op: z.literal("burn_subtitles"),
|
|
85
|
-
subtitles: z.string().optional(),
|
|
82
|
+
subtitles: z.string().min(1).optional(),
|
|
86
83
|
transcribe: z.boolean().optional(),
|
|
87
|
-
style: z.enum(
|
|
84
|
+
style: z.enum(CAPTION_STYLE_NAMES).optional(),
|
|
88
85
|
}),
|
|
89
86
|
z.object({ op: z.literal("backdrop"), ...backdropOptionsSchema }),
|
|
90
87
|
z.object({ op: z.literal("keystroke_overlay"), ...keystrokeOptionsSchema }),
|
|
@@ -4,16 +4,8 @@ import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
|
4
4
|
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
5
5
|
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
6
6
|
import { runEditJob } from "../utils/jobs.js";
|
|
7
|
-
import { buildRedactArgs, stillEdit } from "../utils/media.js";
|
|
7
|
+
import { buildRedactArgs, stillEdit, redactRegionSchema, REDACT_STYLES } from "../utils/media.js";
|
|
8
8
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
9
|
-
export const redactRegionSchema = z.object({
|
|
10
|
-
x: z.number().int().nonnegative(),
|
|
11
|
-
y: z.number().int().nonnegative(),
|
|
12
|
-
width: z.number().int().positive(),
|
|
13
|
-
height: z.number().int().positive(),
|
|
14
|
-
start: z.number().nonnegative().optional(),
|
|
15
|
-
end: z.number().positive().optional(),
|
|
16
|
-
});
|
|
17
9
|
const inputSchema = {
|
|
18
10
|
input: z.string().min(1).describe("Path to the source video or image (png/jpg; time ranges are ignored for an image)."),
|
|
19
11
|
regions: z
|
|
@@ -21,7 +13,7 @@ const inputSchema = {
|
|
|
21
13
|
.min(1)
|
|
22
14
|
.describe("Pixel rectangles (x, y, width, height), each optionally limited to start..end seconds."),
|
|
23
15
|
style: z
|
|
24
|
-
.enum(
|
|
16
|
+
.enum(REDACT_STYLES)
|
|
25
17
|
.optional()
|
|
26
18
|
.describe("box (default): irreversible fill; blur/pixelate are partially recoverable."),
|
|
27
19
|
pad: z
|
package/dist/tools/reframe.js
CHANGED
|
@@ -4,16 +4,16 @@ import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
|
4
4
|
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
5
5
|
import { requireFfmpeg } from "../utils/ffmpeg.js";
|
|
6
6
|
import { runEditJob, probeDuration } from "../utils/jobs.js";
|
|
7
|
-
import { buildReframeArgs } from "../utils/produce.js";
|
|
7
|
+
import { buildReframeArgs, ASPECTS, REFRAME_FITS } from "../utils/produce.js";
|
|
8
8
|
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
9
9
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
10
10
|
const inputSchema = {
|
|
11
11
|
input: z.string().min(1).describe("Path to the source video."),
|
|
12
12
|
aspect: z
|
|
13
|
-
.enum(
|
|
13
|
+
.enum(ASPECTS)
|
|
14
14
|
.describe("Target aspect ratio."),
|
|
15
15
|
fit: z
|
|
16
|
-
.enum(
|
|
16
|
+
.enum(REFRAME_FITS)
|
|
17
17
|
.optional()
|
|
18
18
|
.describe("pad (default): letterbox, nothing lost. crop: fill and center-crop."),
|
|
19
19
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
package/dist/tools/stepGuide.js
CHANGED
|
@@ -11,10 +11,9 @@ import { inputSteps } from "../utils/steps.js";
|
|
|
11
11
|
import { readMarkers } from "../utils/chapters.js";
|
|
12
12
|
import { ocrStatus } from "../utils/capabilities.js";
|
|
13
13
|
import { readFrames, scanMatches } from "../utils/ocrScan.js";
|
|
14
|
-
import { DEFAULT_SECRET_PATTERN } from "../utils/bugReport.js";
|
|
14
|
+
import { DEFAULT_SECRET_PATTERN, resolveSource } from "../utils/bugReport.js";
|
|
15
15
|
import { resolveOutputDir, subdir, stamp, rand } from "../utils/paths.js";
|
|
16
16
|
import { GUIDE_FILES, HTML_IMAGE_LADDER, HTML_MAX_BYTES, MAX_GUIDE_STEPS, assignSections, base64Bytes, buildHtmlImageArgs, buildGuideHtml, buildGuideMarkdown, buildStepFrameArgs, buildStepShotArgs, caption, guideSteps, htmlImageName, labelAt, nextHtmlRung, shotFilter, } from "../utils/stepGuide.js";
|
|
17
|
-
import { resolveSource } from "./bugReport.js";
|
|
18
17
|
import { mapPool } from "../utils/pool.js";
|
|
19
18
|
const OCR_BATCH = 10;
|
|
20
19
|
const HTML_SAMPLE = 5;
|
package/dist/tools/titleCard.js
CHANGED
|
@@ -6,9 +6,9 @@ import { requireFfmpeg } from "../utils/ffmpeg.js";
|
|
|
6
6
|
import { runEditJob } from "../utils/jobs.js";
|
|
7
7
|
import { buildTitleCardArgs, DEFAULT_TITLE_DURATION } from "../utils/produce.js";
|
|
8
8
|
import { resolveTextFont } from "../utils/fonts.js";
|
|
9
|
-
import { fontFileSchema } from "./callout.js";
|
|
10
9
|
import { resolveOutput, subdir, stamp, rand, tempPath } from "../utils/paths.js";
|
|
11
10
|
import { assertEditContainer } from "../utils/media.js";
|
|
11
|
+
import { fontFileSchema } from "../utils/callout.js";
|
|
12
12
|
const inputSchema = {
|
|
13
13
|
text: z.string().min(1).describe("Title text. Multiple lines are allowed (use \\n)."),
|
|
14
14
|
duration: z.number().positive().optional().describe("Card length in seconds (default 3)."),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { errorResponse, okResponse } from "../utils/errors.js";
|
|
3
3
|
import { READ_ONLY, looseOutput } from "../utils/toolSpec.js";
|
|
4
|
-
import { requireFfmpeg, runFfmpeg,
|
|
4
|
+
import { requireFfmpeg, runFfmpeg, runFfmpegFrames } from "../utils/ffmpeg.js";
|
|
5
5
|
import { resolveCaptureTarget } from "../utils/resolveTarget.js";
|
|
6
6
|
import { buildScreenshotArgs } from "../utils/targets.js";
|
|
7
|
-
import { detectionSize, targetSize,
|
|
7
|
+
import { detectionSize, targetSize, buildRawStreamArgs, targetDiffOptions, DEFAULT_PIXEL_THRESHOLD, } from "../utils/diff.js";
|
|
8
8
|
import { waitLoop } from "../utils/waitLoop.js";
|
|
9
|
+
import { FrameQueue } from "../utils/frameQueue.js";
|
|
9
10
|
import { windowMatchReport } from "../utils/windows.js";
|
|
10
11
|
import { confirmCapture, describeTarget } from "../utils/consent.js";
|
|
11
12
|
import { subdir, stamp, rand } from "../utils/paths.js";
|
|
@@ -81,23 +82,36 @@ export function register(server) {
|
|
|
81
82
|
await confirmCapture(server, `Watch ${describeTarget(args.target, window)} for up to ${timeoutMs / 1000} s, until it ${mode === "settle" ? "stops changing" : "changes"}?`, extra.signal);
|
|
82
83
|
const area = targetSize(target, monitors);
|
|
83
84
|
const size = detectionSize(area.width, area.height);
|
|
84
|
-
const grab = () => runFfmpegBuffer(buildRawGrabArgs(target, monitors, size), 15_000, { signal: extra.signal });
|
|
85
85
|
const opts = targetDiffOptions(area, size, args.pixelThreshold);
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
const frames = new FrameQueue();
|
|
87
|
+
const stop = new AbortController();
|
|
88
|
+
const capture = runFfmpegFrames(buildRawStreamArgs(target, monitors, size, 1000 / interval), size.width * size.height, (f) => frames.push(f), timeoutMs + 60_000, { signal: AbortSignal.any([extra.signal, stop.signal]) }).then(() => frames.end(), (err) => frames.fail(err));
|
|
89
|
+
let loop;
|
|
90
|
+
let endedAt = 0;
|
|
91
|
+
try {
|
|
92
|
+
loop = await waitLoop({
|
|
93
|
+
grab: () => frames.next(15_000),
|
|
94
|
+
mode,
|
|
95
|
+
width: size.width,
|
|
96
|
+
height: size.height,
|
|
97
|
+
diff: opts,
|
|
98
|
+
timeoutMs,
|
|
99
|
+
settleMs,
|
|
100
|
+
intervalMs: interval,
|
|
101
|
+
signal: extra.signal,
|
|
102
|
+
sleep: async () => { },
|
|
103
|
+
});
|
|
104
|
+
endedAt = Date.now();
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
stop.abort();
|
|
108
|
+
await capture;
|
|
109
|
+
}
|
|
110
|
+
const { outcome, regions, everChanged, startedAt: started } = loop;
|
|
97
111
|
const result = {
|
|
98
112
|
outcome,
|
|
99
113
|
mode,
|
|
100
|
-
elapsedSec: Number(((
|
|
114
|
+
elapsedSec: Number(((endedAt - started) / 1000).toFixed(2)),
|
|
101
115
|
...(mode === "settle" ? { changedWhileWaiting: everChanged } : {}),
|
|
102
116
|
regions,
|
|
103
117
|
origin: { x: area.x, y: area.y },
|
package/dist/tools/zoom.js
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { existsSync
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
3
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
4
|
import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
|
|
5
5
|
import { requireFfmpeg, runFfmpegFrames, probeMedia } from "../utils/ffmpeg.js";
|
|
6
6
|
import { runEditJob, jobTimeoutMs } from "../utils/jobs.js";
|
|
7
7
|
import { analysisSize } from "../utils/diff.js";
|
|
8
|
-
import { keyframesToViews, buildZoomArgs, createAutoZoomPlanner, planClickZoom, buildAnalysisArgs, DEFAULT_TRANSITION_SEC, DEFAULT_AUTO_MAX_ZOOM, DEFAULT_RING_COLOR, MAX_ZOOM, } from "../utils/zoom.js";
|
|
9
|
-
import { eventPaths
|
|
8
|
+
import { keyframesToViews, buildZoomArgs, createAutoZoomPlanner, planClickZoom, buildAnalysisArgs, DEFAULT_TRANSITION_SEC, DEFAULT_AUTO_MAX_ZOOM, DEFAULT_RING_COLOR, MAX_ZOOM, readClicks, zoomKeyframeSchema, } from "../utils/zoom.js";
|
|
9
|
+
import { eventPaths } from "../utils/events.js";
|
|
10
10
|
import { validateColor } from "../utils/validate.js";
|
|
11
11
|
export const MAX_RINGS = 200;
|
|
12
|
-
export function readClicks(path) {
|
|
13
|
-
if (!existsSync(path))
|
|
14
|
-
return null;
|
|
15
|
-
return parseEventsJsonl(readFileSync(path, "utf8"))
|
|
16
|
-
.filter((e) => e.type === "down" && e.inFrame)
|
|
17
|
-
.map((e) => ({ t: e.t, x: e.x, y: e.y }));
|
|
18
|
-
}
|
|
19
12
|
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
20
13
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
21
|
-
export const zoomKeyframeSchema = z.object({
|
|
22
|
-
t: z.number().nonnegative(),
|
|
23
|
-
x: z.number().optional(),
|
|
24
|
-
y: z.number().optional(),
|
|
25
|
-
width: z.number().positive().optional(),
|
|
26
|
-
height: z.number().positive().optional(),
|
|
27
|
-
full: z.boolean().optional(),
|
|
28
|
-
});
|
|
29
14
|
const inputSchema = {
|
|
30
15
|
input: z.string().min(1).describe("Path to the source video."),
|
|
31
16
|
keyframes: z
|
package/dist/utils/audio.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { extname } from "node:path";
|
|
2
2
|
import { ScreencastError } from "./errors.js";
|
|
3
3
|
import { isAudioOnlyPath } from "./media.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export const LOUDNESS_PRESET_NAMES = ["youtube", "podcast", "broadcast"];
|
|
6
|
+
export const loudnessTargetSchema = z.union([z.enum(LOUDNESS_PRESET_NAMES), z.number().min(-70).max(-5)]);
|
|
4
7
|
export const LOUDNESS_PRESETS = {
|
|
5
8
|
youtube: { i: -14, tp: -1, lra: 11 },
|
|
6
9
|
podcast: { i: -16, tp: -1.5, lra: 11 },
|
|
@@ -76,6 +79,7 @@ export function buildLoudnessApplyArgs(input, output, t, m) {
|
|
|
76
79
|
output,
|
|
77
80
|
];
|
|
78
81
|
}
|
|
82
|
+
export const DENOISE_STRENGTHS = ["light", "medium", "strong"];
|
|
79
83
|
export const DENOISE_NR = { light: 6, medium: 12, strong: 20 };
|
|
80
84
|
export function buildNoiseFloorArgs(input) {
|
|
81
85
|
return [
|
package/dist/utils/backdrop.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ScreencastError } from "./errors.js";
|
|
2
2
|
import { validateColor } from "./validate.js";
|
|
3
|
-
import { ASPECT_DIMS } from "./produce.js";
|
|
3
|
+
import { ASPECT_DIMS, ASPECTS } from "./produce.js";
|
|
4
4
|
import { resolveQuality } from "./targets.js";
|
|
5
5
|
import { stillOutput } from "./paths.js";
|
|
6
|
+
import { z } from "zod";
|
|
6
7
|
export const BACKDROP_PRESETS = {
|
|
7
8
|
desktop: ["#1B2330", "#0A0D12"],
|
|
8
9
|
rec: ["#FF4545", "#5C0F1A"],
|
|
@@ -149,3 +150,13 @@ export function buildBackdropArgs(input, output, opts, src, still = false, quali
|
|
|
149
150
|
: [...head, "-map", "0:a?", ...resolveQuality(quality), "-c:a", "copy", "-movflags", "+faststart", output];
|
|
150
151
|
return { args, layout };
|
|
151
152
|
}
|
|
153
|
+
export const backdropOptionsSchema = {
|
|
154
|
+
preset: z.enum(BACKDROP_PRESET_NAMES).optional(),
|
|
155
|
+
colors: z.array(z.string()).min(1).max(MAX_BACKDROP_COLORS).optional(),
|
|
156
|
+
image: z.string().min(1).optional(),
|
|
157
|
+
padding: z.number().int().nonnegative().max(2000).optional(),
|
|
158
|
+
radius: z.number().int().nonnegative().max(1000).optional(),
|
|
159
|
+
shadow: z.number().int().nonnegative().max(200).optional(),
|
|
160
|
+
shadowOpacity: z.number().min(0).max(1).optional(),
|
|
161
|
+
aspect: z.enum(ASPECTS).optional(),
|
|
162
|
+
};
|
package/dist/utils/bugReport.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ScreencastError } from "./errors.js";
|
|
2
2
|
import { findMatches, normalizeForMatch, regexRanges } from "./ocr.js";
|
|
3
3
|
import { formatTimecode } from "./sheet.js";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import { eventPaths, whenFinalized } from "./events.js";
|
|
6
|
+
import { getStore } from "../context.js";
|
|
4
7
|
export const DEFAULT_CLIP_SEC = 30;
|
|
5
8
|
export const MAX_CLIP_SEC = 600;
|
|
6
9
|
export const DEFAULT_SCAN_EVERY_SEC = 1;
|
|
@@ -170,3 +173,23 @@ export function buildReportMarkdown(r) {
|
|
|
170
173
|
: `Not scanned for secrets${red.manual > 0 ? ` (${red.manual} region${red.manual === 1 ? "" : "s"} boxed out by hand)` : ""}: review the clip before posting.`, `Generated by screencast-mcp bug_report, ${r.createdAt}.`, "</sub>", "");
|
|
171
174
|
return out.join("\n");
|
|
172
175
|
}
|
|
176
|
+
export async function resolveSource(args) {
|
|
177
|
+
if (args.sessionId !== undefined) {
|
|
178
|
+
const record = getStore().get(args.sessionId);
|
|
179
|
+
if (!record)
|
|
180
|
+
throw new ScreencastError(`No session with id "${args.sessionId}".`);
|
|
181
|
+
if (record.status === "recording" || record.status === "paused") {
|
|
182
|
+
throw new ScreencastError("The recording is still running; stop_recording it first.");
|
|
183
|
+
}
|
|
184
|
+
await whenFinalized(record.id);
|
|
185
|
+
if (!existsSync(record.outputPath))
|
|
186
|
+
throw new ScreencastError(`The session's recording is missing: ${record.outputPath}`);
|
|
187
|
+
const events = record.events?.path;
|
|
188
|
+
return { path: record.outputPath, eventsPath: events && existsSync(events) ? events : null, record };
|
|
189
|
+
}
|
|
190
|
+
const path = args.input;
|
|
191
|
+
if (!existsSync(path))
|
|
192
|
+
throw new ScreencastError(`Input file not found: ${path}`);
|
|
193
|
+
const { jsonl } = eventPaths(path);
|
|
194
|
+
return { path, eventsPath: existsSync(jsonl) ? jsonl : null };
|
|
195
|
+
}
|
package/dist/utils/callout.js
CHANGED
|
@@ -4,6 +4,7 @@ import { enableExpr } from "./media.js";
|
|
|
4
4
|
import { resolveQuality } from "./targets.js";
|
|
5
5
|
import { validateColor } from "./validate.js";
|
|
6
6
|
import { stillOutput } from "./paths.js";
|
|
7
|
+
import { z } from "zod";
|
|
7
8
|
const nonNeg = (v, label) => {
|
|
8
9
|
if (!Number.isFinite(v) || v < 0)
|
|
9
10
|
throw new ScreencastError(`${label} must be a non-negative number.`);
|
|
@@ -88,3 +89,44 @@ export function buildCalloutArgs(input, output, items, assets, quality = "standa
|
|
|
88
89
|
output,
|
|
89
90
|
];
|
|
90
91
|
}
|
|
92
|
+
const timing = {
|
|
93
|
+
from: z.number().nonnegative().optional(),
|
|
94
|
+
to: z.number().positive().optional(),
|
|
95
|
+
color: z.string().optional(),
|
|
96
|
+
};
|
|
97
|
+
export const fontFileSchema = z
|
|
98
|
+
.string()
|
|
99
|
+
.min(1)
|
|
100
|
+
.optional()
|
|
101
|
+
.describe("Font: a .ttf/.otf/.ttc path or a C:\\Windows\\Fonts file name. Default: bundled Inter, with a " +
|
|
102
|
+
"covering system font for scripts it lacks (CJK, emoji, Arabic, ...).");
|
|
103
|
+
export const calloutItemSchema = z.discriminatedUnion("type", [
|
|
104
|
+
z.object({
|
|
105
|
+
type: z.literal("box"),
|
|
106
|
+
x: z.number(),
|
|
107
|
+
y: z.number(),
|
|
108
|
+
width: z.number().positive(),
|
|
109
|
+
height: z.number().positive(),
|
|
110
|
+
thickness: z.number().positive().optional().describe("Outline px (default 4)."),
|
|
111
|
+
fill: z.boolean().optional().describe("Fill instead of outline."),
|
|
112
|
+
...timing,
|
|
113
|
+
}),
|
|
114
|
+
z.object({
|
|
115
|
+
type: z.literal("text"),
|
|
116
|
+
x: z.number(),
|
|
117
|
+
y: z.number(),
|
|
118
|
+
text: z.string().min(1),
|
|
119
|
+
size: z.number().positive().optional().describe("Font size px (default 32)."),
|
|
120
|
+
background: z.boolean().optional().describe("Dark panel behind the text (default true)."),
|
|
121
|
+
...timing,
|
|
122
|
+
}),
|
|
123
|
+
z.object({
|
|
124
|
+
type: z.literal("arrow"),
|
|
125
|
+
x1: z.number(),
|
|
126
|
+
y1: z.number(),
|
|
127
|
+
x2: z.number().describe("Head (x2,y2) is the point the arrow points at."),
|
|
128
|
+
y2: z.number(),
|
|
129
|
+
thickness: z.number().positive().optional().describe("Shaft px (default 8)."),
|
|
130
|
+
...timing,
|
|
131
|
+
}),
|
|
132
|
+
]);
|
package/dist/utils/captions.js
CHANGED
|
@@ -81,6 +81,7 @@ export function normalizeCues(cues) {
|
|
|
81
81
|
export function formatSrt(cues) {
|
|
82
82
|
return cues.map((c, i) => `${i + 1}\n${fmt(c.start)} --> ${fmt(c.end)}\n${c.text}\n`).join("\n");
|
|
83
83
|
}
|
|
84
|
+
export const CAPTION_STYLE_NAMES = ["clean", "social"];
|
|
84
85
|
export const CAPTION_STYLES = {
|
|
85
86
|
clean: "FontName=Inter,FontSize=16,PrimaryColour=&H00FFFFFF,OutlineColour=&H00000000,BorderStyle=1,Outline=1.5,Shadow=0,MarginV=16",
|
|
86
87
|
social: "FontName=Inter,Bold=1,FontSize=22,PrimaryColour=&H00FFFFFF,BackColour=&H99000000,BorderStyle=3,Outline=6,Shadow=0,MarginV=40",
|
package/dist/utils/cursor.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import { ScreencastError } from "./errors.js";
|
|
3
3
|
import { escapeFilterPath } from "./fonts.js";
|
|
4
|
-
import { MOVE_SAMPLE_MS } from "./events.js";
|
|
4
|
+
import { MOVE_SAMPLE_MS, eventPaths, parseEventsJsonl } from "./events.js";
|
|
5
5
|
import { mapTime, mapWindow } from "./timeline.js";
|
|
6
6
|
import { resolveQuality } from "./targets.js";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
7
9
|
export const CURSOR_SPRITE = { w: 114, h: 168, hotX: 9, hotY: 9, arrowH: 135 };
|
|
8
10
|
export function cursorSpritePath() {
|
|
9
11
|
return fileURLToPath(new URL("../../assets/cursor/arrow.png", import.meta.url));
|
|
@@ -315,3 +317,22 @@ export function buildCursorArgs(input, output, plan, style, frame, sprite, comma
|
|
|
315
317
|
commands,
|
|
316
318
|
};
|
|
317
319
|
}
|
|
320
|
+
export const cursorOptionsSchema = {
|
|
321
|
+
events: z.string().optional(),
|
|
322
|
+
size: z.number().min(0.25).max(8).optional(),
|
|
323
|
+
smoothing: z.number().min(0).max(1).optional(),
|
|
324
|
+
hideAfterSec: z.number().min(0).max(600).optional(),
|
|
325
|
+
clicks: z.boolean().optional(),
|
|
326
|
+
spotlight: z.boolean().optional(),
|
|
327
|
+
};
|
|
328
|
+
export function loadCursor(input, events, opts, endSec) {
|
|
329
|
+
const path = events ?? eventPaths(input).jsonl;
|
|
330
|
+
if (!existsSync(path)) {
|
|
331
|
+
throw new ScreencastError(`No event log for ${input} (looked for ${path}). Record with start_recording cursor: "events" ` +
|
|
332
|
+
"(no OS cursor in the video, events logged), or pass events: <path to .events.jsonl>.");
|
|
333
|
+
}
|
|
334
|
+
const plan = planCursor(parseEventsJsonl(readFileSync(path, "utf8")), opts, endSec);
|
|
335
|
+
if (plan.path.length === 0)
|
|
336
|
+
throw new ScreencastError(`The event log ${path} has no cursor positions to draw.`);
|
|
337
|
+
return plan;
|
|
338
|
+
}
|
package/dist/utils/diff.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ScreencastError } from "./errors.js";
|
|
2
|
-
import { targetInputArgs
|
|
2
|
+
import { targetInputArgs } from "./targets.js";
|
|
3
3
|
import { stillOutput } from "./paths.js";
|
|
4
4
|
export const ANALYSIS_WIDTH = 320;
|
|
5
5
|
export const SOURCE_PX_PER_ANALYSIS_PX = 4;
|
|
@@ -161,12 +161,14 @@ export function buildRawFrameArgs(input, size) {
|
|
|
161
161
|
"-f", "rawvideo", "-",
|
|
162
162
|
];
|
|
163
163
|
}
|
|
164
|
-
export function
|
|
164
|
+
export function buildRawStreamArgs(target, monitors, size, fps) {
|
|
165
165
|
return [
|
|
166
|
-
"-v", "error",
|
|
166
|
+
"-v", "error",
|
|
167
|
+
"-probesize", "32", "-analyzeduration", "0",
|
|
168
|
+
"-f", "gdigrab", "-framerate", String(Math.round(fps * 1000) / 1000),
|
|
167
169
|
...targetInputArgs(target, monitors),
|
|
168
|
-
"-frames:v", "1",
|
|
169
170
|
"-vf", `scale=${size.width}:${size.height}:flags=area,format=gray`,
|
|
171
|
+
"-flush_packets", "1",
|
|
170
172
|
"-f", "rawvideo", "-",
|
|
171
173
|
];
|
|
172
174
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ScreencastError } from "./errors.js";
|
|
2
|
+
export class FrameQueue {
|
|
3
|
+
waiters = [];
|
|
4
|
+
error = null;
|
|
5
|
+
ended = false;
|
|
6
|
+
push(frame) {
|
|
7
|
+
const waiting = this.waiters;
|
|
8
|
+
this.waiters = [];
|
|
9
|
+
for (const w of waiting)
|
|
10
|
+
w.resolve(frame);
|
|
11
|
+
}
|
|
12
|
+
fail(error) {
|
|
13
|
+
if (this.error === null)
|
|
14
|
+
this.error = error;
|
|
15
|
+
this.rejectAll(this.error);
|
|
16
|
+
}
|
|
17
|
+
end() {
|
|
18
|
+
this.ended = true;
|
|
19
|
+
this.rejectAll(new ScreencastError("The screen capture ended unexpectedly."));
|
|
20
|
+
}
|
|
21
|
+
next(timeoutMs) {
|
|
22
|
+
if (this.error !== null)
|
|
23
|
+
return Promise.reject(this.error);
|
|
24
|
+
if (this.ended)
|
|
25
|
+
return Promise.reject(new ScreencastError("The screen capture ended unexpectedly."));
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const timer = setTimeout(() => {
|
|
28
|
+
this.waiters = this.waiters.filter((w) => w !== waiter);
|
|
29
|
+
reject(new ScreencastError(`No frame from the screen capture within ${Math.round(timeoutMs / 1000)}s.`));
|
|
30
|
+
}, timeoutMs);
|
|
31
|
+
const waiter = {
|
|
32
|
+
resolve: (f) => {
|
|
33
|
+
clearTimeout(timer);
|
|
34
|
+
resolve(f);
|
|
35
|
+
},
|
|
36
|
+
reject: (e) => {
|
|
37
|
+
clearTimeout(timer);
|
|
38
|
+
reject(e);
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
this.waiters.push(waiter);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
rejectAll(error) {
|
|
45
|
+
const waiting = this.waiters;
|
|
46
|
+
this.waiters = [];
|
|
47
|
+
for (const w of waiting)
|
|
48
|
+
w.reject(error);
|
|
49
|
+
}
|
|
50
|
+
}
|
package/dist/utils/keystrokes.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ScreencastError } from "./errors.js";
|
|
2
|
-
import { escapeFilterPath } from "./fonts.js";
|
|
2
|
+
import { escapeFilterPath, resolveTextFont } from "./fonts.js";
|
|
3
3
|
import { sumExpr } from "./expr.js";
|
|
4
4
|
import { resolveQuality } from "./targets.js";
|
|
5
5
|
import { validateColor } from "./validate.js";
|
|
6
6
|
import { mapWindow } from "./timeline.js";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { eventPaths, parseEventsJsonl } from "./events.js";
|
|
7
11
|
export const BADGE_POSITIONS = ["bottom", "bottom-left", "bottom-right", "top", "top-left", "top-right"];
|
|
8
12
|
export const DEFAULT_LINGER_SEC = 1.2;
|
|
9
13
|
export const DOUBLE_CLICK_SEC = 0.5;
|
|
@@ -153,3 +157,42 @@ export function buildKeystrokeArgs(input, output, groups, assets, style, frame,
|
|
|
153
157
|
output,
|
|
154
158
|
];
|
|
155
159
|
}
|
|
160
|
+
export const keystrokeOptionsSchema = {
|
|
161
|
+
events: z.string().optional(),
|
|
162
|
+
clicks: z.boolean().optional(),
|
|
163
|
+
typing: z.boolean().optional(),
|
|
164
|
+
keys: z.enum(["shortcuts", "masked"]).optional(),
|
|
165
|
+
lingerSec: z.number().positive().max(10).optional(),
|
|
166
|
+
position: z.enum(BADGE_POSITIONS).optional(),
|
|
167
|
+
size: z.number().min(8).max(400).optional(),
|
|
168
|
+
color: z.string().optional(),
|
|
169
|
+
fontFile: z.string().min(1).optional(),
|
|
170
|
+
};
|
|
171
|
+
export function loadBadges(input, events, opts) {
|
|
172
|
+
const path = events ?? eventPaths(input).jsonl;
|
|
173
|
+
if (!existsSync(path)) {
|
|
174
|
+
throw new ScreencastError(`No event log for ${input} (looked for ${path}). Record with start_recording events: true ` +
|
|
175
|
+
'(keys: "shortcuts" to name shortcuts), or pass events: <path to .events.jsonl>.');
|
|
176
|
+
}
|
|
177
|
+
const log = parseEventsJsonl(readFileSync(path, "utf8"));
|
|
178
|
+
return { badges: planBadges(log, opts), shortcutsLogged: log.filter((e) => e.type === "key").length, path };
|
|
179
|
+
}
|
|
180
|
+
export function prepareKeystrokeAssets(labels, workDir, tag = "", fontFile) {
|
|
181
|
+
const font = resolveTextFont(labels.join(" "), { weight: "bold", fontFile });
|
|
182
|
+
const textFiles = {};
|
|
183
|
+
labels.forEach((label, i) => {
|
|
184
|
+
if (workDir === null) {
|
|
185
|
+
textFiles[label] = `<badge ${i}>`;
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const f = join(workDir, `${tag}badge_${i}.txt`);
|
|
189
|
+
writeFileSync(f, label);
|
|
190
|
+
textFiles[label] = f;
|
|
191
|
+
});
|
|
192
|
+
return {
|
|
193
|
+
fontFile: font.fontFile,
|
|
194
|
+
textFiles,
|
|
195
|
+
...(font.fallback && { fallbackFont: font.fontFile }),
|
|
196
|
+
warnings: font.warning ? [font.warning] : [],
|
|
197
|
+
};
|
|
198
|
+
}
|
package/dist/utils/media.js
CHANGED
|
@@ -3,6 +3,7 @@ import { ScreencastError } from "./errors.js";
|
|
|
3
3
|
import { resolveQuality } from "./targets.js";
|
|
4
4
|
import { validateColor, validateEvenDimension } from "./validate.js";
|
|
5
5
|
import { isStillImage, stillOutput } from "./paths.js";
|
|
6
|
+
import { z } from "zod";
|
|
6
7
|
const DEFAULT_EDIT_QUALITY = "standard";
|
|
7
8
|
function numberOrNull(v) {
|
|
8
9
|
if (v === undefined)
|
|
@@ -463,6 +464,7 @@ export function buildClipArgs(input, output, seg, quality = DEFAULT_EDIT_QUALITY
|
|
|
463
464
|
output,
|
|
464
465
|
];
|
|
465
466
|
}
|
|
467
|
+
export const REDACT_STYLES = ["box", "blur", "pixelate"];
|
|
466
468
|
function normalizeRegions(regions, pad, dims) {
|
|
467
469
|
return regions.map((r, i) => {
|
|
468
470
|
const x0 = requireNonNegativeInt(r.x, `region[${i}] x`);
|
|
@@ -572,3 +574,11 @@ export function buildRedactArgs(input, output, regions, opts = {}, dims, still =
|
|
|
572
574
|
output,
|
|
573
575
|
];
|
|
574
576
|
}
|
|
577
|
+
export const redactRegionSchema = z.object({
|
|
578
|
+
x: z.number().int().nonnegative(),
|
|
579
|
+
y: z.number().int().nonnegative(),
|
|
580
|
+
width: z.number().int().positive(),
|
|
581
|
+
height: z.number().int().positive(),
|
|
582
|
+
start: z.number().nonnegative().optional(),
|
|
583
|
+
end: z.number().positive().optional(),
|
|
584
|
+
});
|
package/dist/utils/ocrScan.js
CHANGED
package/dist/utils/produce.js
CHANGED
|
@@ -215,6 +215,8 @@ export function buildMusicBedArgs(video, music, output, videoDuration, hasVideoA
|
|
|
215
215
|
output,
|
|
216
216
|
];
|
|
217
217
|
}
|
|
218
|
+
export const ASPECTS = ["16:9", "9:16", "1:1", "4:5"];
|
|
219
|
+
export const REFRAME_FITS = ["pad", "crop"];
|
|
218
220
|
export const ASPECT_DIMS = {
|
|
219
221
|
"16:9": { w: 1920, h: 1080 },
|
|
220
222
|
"9:16": { w: 1080, h: 1920 },
|
package/dist/utils/sheet.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { ScreencastError } from "./errors.js";
|
|
2
|
-
import { escapeFilterPath } from "./fonts.js";
|
|
3
|
-
import { stillOutput } from "./paths.js";
|
|
2
|
+
import { escapeFilterPath, bundledFontPath } from "./fonts.js";
|
|
3
|
+
import { stillOutput, sequencePattern } from "./paths.js";
|
|
4
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
|
+
import { mapPool } from "./pool.js";
|
|
8
|
+
import { runFfmpeg } from "./ffmpeg.js";
|
|
4
9
|
export const DEFAULT_SHEET_COUNT = 12;
|
|
5
10
|
export const MAX_SHEET_COUNT = 48;
|
|
6
11
|
export const DEFAULT_TILE_WIDTH = 320;
|
|
@@ -57,3 +62,21 @@ export function buildPosterArgs(input, durationSec, output, width) {
|
|
|
57
62
|
...stillOutput(output),
|
|
58
63
|
];
|
|
59
64
|
}
|
|
65
|
+
export async function renderContactSheet(input, times, output, opts, signal) {
|
|
66
|
+
const grid = sheetGrid(times.length, opts.columns);
|
|
67
|
+
const work = mkdtempSync(join(tmpdir(), "screencast-sheet-"));
|
|
68
|
+
try {
|
|
69
|
+
const font = bundledFontPath("bold");
|
|
70
|
+
await mapPool(times, async (t, i) => {
|
|
71
|
+
const labelFile = join(work, `label_${i}.txt`);
|
|
72
|
+
writeFileSync(labelFile, formatTimecode(t));
|
|
73
|
+
const tile = join(work, `tile_${String(i).padStart(3, "0")}.png`);
|
|
74
|
+
await runFfmpeg(buildTileArgs(input, t, tile, opts.tileWidth, font, labelFile), 60_000, { signal });
|
|
75
|
+
});
|
|
76
|
+
await runFfmpeg(buildSheetArgs(sequencePattern(work, "tile_%03d.png"), grid, output), 60_000, { signal });
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
rmSync(work, { recursive: true, force: true });
|
|
80
|
+
}
|
|
81
|
+
return grid;
|
|
82
|
+
}
|
package/dist/utils/zoom.js
CHANGED
|
@@ -2,6 +2,9 @@ import { ScreencastError } from "./errors.js";
|
|
|
2
2
|
import { diffFrames } from "./diff.js";
|
|
3
3
|
import { resolveQuality } from "./targets.js";
|
|
4
4
|
import { sumExpr } from "./expr.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
7
|
+
import { parseEventsJsonl } from "./events.js";
|
|
5
8
|
export const DEFAULT_TRANSITION_SEC = 0.6;
|
|
6
9
|
export const MAX_ZOOM = 6;
|
|
7
10
|
export const DEFAULT_AUTO_MAX_ZOOM = 2.5;
|
|
@@ -232,3 +235,18 @@ export function ringFilters(clicks, W, H, fps, color) {
|
|
|
232
235
|
});
|
|
233
236
|
return steps;
|
|
234
237
|
}
|
|
238
|
+
export function readClicks(path) {
|
|
239
|
+
if (!existsSync(path))
|
|
240
|
+
return null;
|
|
241
|
+
return parseEventsJsonl(readFileSync(path, "utf8"))
|
|
242
|
+
.filter((e) => e.type === "down" && e.inFrame)
|
|
243
|
+
.map((e) => ({ t: e.t, x: e.x, y: e.y }));
|
|
244
|
+
}
|
|
245
|
+
export const zoomKeyframeSchema = z.object({
|
|
246
|
+
t: z.number().nonnegative(),
|
|
247
|
+
x: z.number().optional(),
|
|
248
|
+
y: z.number().optional(),
|
|
249
|
+
width: z.number().positive().optional(),
|
|
250
|
+
height: z.number().positive().optional(),
|
|
251
|
+
full: z.boolean().optional(),
|
|
252
|
+
});
|
package/package.json
CHANGED