@tmhs/screencast-mcp 0.39.0 → 0.44.2
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/README.md +58 -14
- package/assets/icon.png +0 -0
- package/assets/ui/player.html +38 -302
- package/assets/ui/player.js +382 -0
- package/dist/context.js +0 -5
- package/dist/index.js +5 -21
- package/dist/prompts.js +0 -7
- package/dist/resources.js +2 -14
- package/dist/server.js +37 -11
- package/dist/tools/assembleHighlights.js +12 -7
- package/dist/tools/burnSubtitles.js +12 -6
- package/dist/tools/callout.js +32 -16
- package/dist/tools/clip.js +12 -9
- package/dist/tools/compress.js +10 -5
- package/dist/tools/concat.js +16 -15
- package/dist/tools/contactSheet.js +26 -22
- package/dist/tools/convert.js +12 -6
- package/dist/tools/crop.js +12 -7
- package/dist/tools/cutIdle.js +15 -9
- package/dist/tools/denoise.js +12 -6
- package/dist/tools/doctor.js +133 -0
- package/dist/tools/exportGif.js +14 -10
- package/dist/tools/exportPreset.js +11 -8
- package/dist/tools/extractAudio.js +10 -8
- package/dist/tools/findText.js +69 -65
- package/dist/tools/getMediaInfo.js +17 -3
- package/dist/tools/getSession.js +15 -3
- package/dist/tools/listAudioDevices.js +14 -7
- package/dist/tools/listSessions.js +13 -3
- package/dist/tools/listTargets.js +76 -0
- package/dist/tools/musicBed.js +14 -10
- package/dist/tools/normalizeAudio.js +12 -8
- package/dist/tools/overlay.js +16 -12
- package/dist/tools/pipeline.js +31 -22
- package/dist/tools/readEvents.js +21 -12
- package/dist/tools/redactRegion.js +19 -17
- package/dist/tools/reframe.js +9 -5
- package/dist/tools/reviewRecording.js +63 -22
- package/dist/tools/sampleFrames.js +33 -40
- package/dist/tools/scale.js +9 -3
- package/dist/tools/screenDiff.js +23 -17
- package/dist/tools/screenshot.js +21 -17
- package/dist/tools/speed.js +15 -4
- package/dist/tools/startRecording.js +48 -52
- package/dist/tools/stopRecording.js +10 -9
- package/dist/tools/titleCard.js +19 -11
- package/dist/tools/transcribe.js +13 -7
- package/dist/tools/trim.js +11 -10
- package/dist/tools/waitForChange.js +37 -22
- package/dist/tools/xfadeTransition.js +12 -8
- package/dist/tools/zoom.js +26 -29
- package/dist/utils/anim.js +1 -21
- package/dist/utils/animExport.js +5 -10
- package/dist/utils/audio.js +4 -33
- package/dist/utils/audioDevices.js +1 -48
- package/dist/utils/callout.js +1 -19
- package/dist/utils/calloutAssets.js +21 -11
- package/dist/utils/capabilities.js +95 -0
- package/dist/utils/captions.js +9 -26
- package/dist/utils/consent.js +29 -0
- package/dist/utils/diff.js +0 -46
- package/dist/utils/errors.js +5 -13
- package/dist/utils/events.js +21 -77
- package/dist/utils/expr.js +11 -0
- package/dist/utils/ffmpeg.js +119 -48
- package/dist/utils/fontCoverage.js +177 -0
- package/dist/utils/fonts.js +139 -23
- package/dist/utils/idle.js +12 -24
- package/dist/utils/images.js +0 -17
- package/dist/utils/jobs.js +42 -41
- package/dist/utils/lifecycle.js +0 -29
- package/dist/utils/logging.js +75 -0
- package/dist/utils/media.js +11 -122
- package/dist/utils/monitors.js +7 -43
- package/dist/utils/ocr.js +53 -71
- package/dist/utils/paths.js +68 -31
- package/dist/utils/pipeline.js +0 -23
- package/dist/utils/player.js +50 -27
- package/dist/utils/produce.js +6 -66
- package/dist/utils/resolveTarget.js +0 -19
- package/dist/utils/retention.js +1 -15
- package/dist/utils/roots.js +42 -0
- package/dist/utils/sessions.js +195 -160
- package/dist/utils/sheet.js +0 -19
- package/dist/utils/still.js +0 -15
- package/dist/utils/targetList.js +63 -0
- package/dist/utils/targets.js +5 -70
- package/dist/utils/toolSpec.js +25 -0
- package/dist/utils/toolsets.js +102 -0
- package/dist/utils/validate.js +0 -22
- package/dist/utils/wgc.js +0 -46
- package/dist/utils/windows.js +5 -50
- package/dist/utils/zoom.js +55 -85
- package/dist/wgcRecorder.js +1 -30
- package/package.json +7 -3
- package/dist/context.d.ts +0 -9
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/prompts.d.ts +0 -10
- package/dist/prompts.d.ts.map +0 -1
- package/dist/prompts.js.map +0 -1
- package/dist/resources.d.ts +0 -3
- package/dist/resources.d.ts.map +0 -1
- package/dist/resources.js.map +0 -1
- package/dist/server.d.ts +0 -3
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/tools/assembleHighlights.d.ts +0 -3
- package/dist/tools/assembleHighlights.d.ts.map +0 -1
- package/dist/tools/assembleHighlights.js.map +0 -1
- package/dist/tools/burnSubtitles.d.ts +0 -3
- package/dist/tools/burnSubtitles.d.ts.map +0 -1
- package/dist/tools/burnSubtitles.js.map +0 -1
- package/dist/tools/callout.d.ts +0 -37
- package/dist/tools/callout.d.ts.map +0 -1
- package/dist/tools/callout.js.map +0 -1
- package/dist/tools/clip.d.ts +0 -3
- package/dist/tools/clip.d.ts.map +0 -1
- package/dist/tools/clip.js.map +0 -1
- package/dist/tools/compress.d.ts +0 -3
- package/dist/tools/compress.d.ts.map +0 -1
- package/dist/tools/compress.js.map +0 -1
- package/dist/tools/concat.d.ts +0 -3
- package/dist/tools/concat.d.ts.map +0 -1
- package/dist/tools/concat.js.map +0 -1
- package/dist/tools/contactSheet.d.ts +0 -3
- package/dist/tools/contactSheet.d.ts.map +0 -1
- package/dist/tools/contactSheet.js.map +0 -1
- package/dist/tools/convert.d.ts +0 -3
- package/dist/tools/convert.d.ts.map +0 -1
- package/dist/tools/convert.js.map +0 -1
- package/dist/tools/crop.d.ts +0 -3
- package/dist/tools/crop.d.ts.map +0 -1
- package/dist/tools/crop.js.map +0 -1
- package/dist/tools/cutIdle.d.ts +0 -3
- package/dist/tools/cutIdle.d.ts.map +0 -1
- package/dist/tools/cutIdle.js.map +0 -1
- package/dist/tools/denoise.d.ts +0 -3
- package/dist/tools/denoise.d.ts.map +0 -1
- package/dist/tools/denoise.js.map +0 -1
- package/dist/tools/exportGif.d.ts +0 -3
- package/dist/tools/exportGif.d.ts.map +0 -1
- package/dist/tools/exportGif.js.map +0 -1
- package/dist/tools/exportPreset.d.ts +0 -3
- package/dist/tools/exportPreset.d.ts.map +0 -1
- package/dist/tools/exportPreset.js.map +0 -1
- package/dist/tools/extractAudio.d.ts +0 -3
- package/dist/tools/extractAudio.d.ts.map +0 -1
- package/dist/tools/extractAudio.js.map +0 -1
- package/dist/tools/findText.d.ts +0 -6
- package/dist/tools/findText.d.ts.map +0 -1
- package/dist/tools/findText.js.map +0 -1
- package/dist/tools/getMediaInfo.d.ts +0 -3
- package/dist/tools/getMediaInfo.d.ts.map +0 -1
- package/dist/tools/getMediaInfo.js.map +0 -1
- package/dist/tools/getSession.d.ts +0 -3
- package/dist/tools/getSession.d.ts.map +0 -1
- package/dist/tools/getSession.js.map +0 -1
- package/dist/tools/listAudioDevices.d.ts +0 -3
- package/dist/tools/listAudioDevices.d.ts.map +0 -1
- package/dist/tools/listAudioDevices.js.map +0 -1
- package/dist/tools/listSessions.d.ts +0 -3
- package/dist/tools/listSessions.d.ts.map +0 -1
- package/dist/tools/listSessions.js.map +0 -1
- package/dist/tools/musicBed.d.ts +0 -3
- package/dist/tools/musicBed.d.ts.map +0 -1
- package/dist/tools/musicBed.js.map +0 -1
- package/dist/tools/normalizeAudio.d.ts +0 -3
- package/dist/tools/normalizeAudio.d.ts.map +0 -1
- package/dist/tools/normalizeAudio.js.map +0 -1
- package/dist/tools/overlay.d.ts +0 -3
- package/dist/tools/overlay.d.ts.map +0 -1
- package/dist/tools/overlay.js.map +0 -1
- package/dist/tools/pipeline.d.ts +0 -3
- package/dist/tools/pipeline.d.ts.map +0 -1
- package/dist/tools/pipeline.js.map +0 -1
- package/dist/tools/readEvents.d.ts +0 -6
- package/dist/tools/readEvents.d.ts.map +0 -1
- package/dist/tools/readEvents.js.map +0 -1
- package/dist/tools/redactRegion.d.ts +0 -13
- package/dist/tools/redactRegion.d.ts.map +0 -1
- package/dist/tools/redactRegion.js.map +0 -1
- package/dist/tools/reframe.d.ts +0 -3
- package/dist/tools/reframe.d.ts.map +0 -1
- package/dist/tools/reframe.js.map +0 -1
- package/dist/tools/reviewRecording.d.ts +0 -5
- package/dist/tools/reviewRecording.d.ts.map +0 -1
- package/dist/tools/reviewRecording.js.map +0 -1
- package/dist/tools/sampleFrames.d.ts +0 -3
- package/dist/tools/sampleFrames.d.ts.map +0 -1
- package/dist/tools/sampleFrames.js.map +0 -1
- package/dist/tools/scale.d.ts +0 -3
- package/dist/tools/scale.d.ts.map +0 -1
- package/dist/tools/scale.js.map +0 -1
- package/dist/tools/screenDiff.d.ts +0 -3
- package/dist/tools/screenDiff.d.ts.map +0 -1
- package/dist/tools/screenDiff.js.map +0 -1
- package/dist/tools/screenshot.d.ts +0 -3
- package/dist/tools/screenshot.d.ts.map +0 -1
- package/dist/tools/screenshot.js.map +0 -1
- package/dist/tools/speed.d.ts +0 -3
- package/dist/tools/speed.d.ts.map +0 -1
- package/dist/tools/speed.js.map +0 -1
- package/dist/tools/startRecording.d.ts +0 -3
- package/dist/tools/startRecording.d.ts.map +0 -1
- package/dist/tools/startRecording.js.map +0 -1
- package/dist/tools/stopRecording.d.ts +0 -3
- package/dist/tools/stopRecording.d.ts.map +0 -1
- package/dist/tools/stopRecording.js.map +0 -1
- package/dist/tools/titleCard.d.ts +0 -3
- package/dist/tools/titleCard.d.ts.map +0 -1
- package/dist/tools/titleCard.js.map +0 -1
- package/dist/tools/transcribe.d.ts +0 -3
- package/dist/tools/transcribe.d.ts.map +0 -1
- package/dist/tools/transcribe.js.map +0 -1
- package/dist/tools/trim.d.ts +0 -3
- package/dist/tools/trim.d.ts.map +0 -1
- package/dist/tools/trim.js.map +0 -1
- package/dist/tools/waitForChange.d.ts +0 -3
- package/dist/tools/waitForChange.d.ts.map +0 -1
- package/dist/tools/waitForChange.js.map +0 -1
- package/dist/tools/xfadeTransition.d.ts +0 -3
- package/dist/tools/xfadeTransition.d.ts.map +0 -1
- package/dist/tools/xfadeTransition.js.map +0 -1
- package/dist/tools/zoom.d.ts +0 -15
- package/dist/tools/zoom.d.ts.map +0 -1
- package/dist/tools/zoom.js.map +0 -1
- package/dist/utils/anim.d.ts +0 -33
- package/dist/utils/anim.d.ts.map +0 -1
- package/dist/utils/anim.js.map +0 -1
- package/dist/utils/animExport.d.ts +0 -27
- package/dist/utils/animExport.d.ts.map +0 -1
- package/dist/utils/animExport.js.map +0 -1
- package/dist/utils/audio.d.ts +0 -49
- package/dist/utils/audio.d.ts.map +0 -1
- package/dist/utils/audio.js.map +0 -1
- package/dist/utils/audioDevices.d.ts +0 -33
- package/dist/utils/audioDevices.d.ts.map +0 -1
- package/dist/utils/audioDevices.js.map +0 -1
- package/dist/utils/callout.d.ts +0 -72
- package/dist/utils/callout.d.ts.map +0 -1
- package/dist/utils/callout.js.map +0 -1
- package/dist/utils/calloutAssets.d.ts +0 -3
- package/dist/utils/calloutAssets.d.ts.map +0 -1
- package/dist/utils/calloutAssets.js.map +0 -1
- package/dist/utils/captions.d.ts +0 -26
- package/dist/utils/captions.d.ts.map +0 -1
- package/dist/utils/captions.js.map +0 -1
- package/dist/utils/diff.d.ts +0 -112
- package/dist/utils/diff.d.ts.map +0 -1
- package/dist/utils/diff.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -33
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/events.d.ts +0 -143
- package/dist/utils/events.d.ts.map +0 -1
- package/dist/utils/events.js.map +0 -1
- package/dist/utils/ffmpeg.d.ts +0 -50
- package/dist/utils/ffmpeg.d.ts.map +0 -1
- package/dist/utils/ffmpeg.js.map +0 -1
- package/dist/utils/fonts.d.ts +0 -17
- package/dist/utils/fonts.d.ts.map +0 -1
- package/dist/utils/fonts.js.map +0 -1
- package/dist/utils/idle.d.ts +0 -23
- package/dist/utils/idle.d.ts.map +0 -1
- package/dist/utils/idle.js.map +0 -1
- package/dist/utils/images.d.ts +0 -21
- package/dist/utils/images.d.ts.map +0 -1
- package/dist/utils/images.js.map +0 -1
- package/dist/utils/jobs.d.ts +0 -44
- package/dist/utils/jobs.d.ts.map +0 -1
- package/dist/utils/jobs.js.map +0 -1
- package/dist/utils/lifecycle.d.ts +0 -29
- package/dist/utils/lifecycle.d.ts.map +0 -1
- package/dist/utils/lifecycle.js.map +0 -1
- package/dist/utils/media.d.ts +0 -272
- package/dist/utils/media.d.ts.map +0 -1
- package/dist/utils/media.js.map +0 -1
- package/dist/utils/monitors.d.ts +0 -47
- package/dist/utils/monitors.d.ts.map +0 -1
- package/dist/utils/monitors.js.map +0 -1
- package/dist/utils/ocr.d.ts +0 -50
- package/dist/utils/ocr.d.ts.map +0 -1
- package/dist/utils/ocr.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -28
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/pipeline.d.ts +0 -69
- package/dist/utils/pipeline.d.ts.map +0 -1
- package/dist/utils/pipeline.js.map +0 -1
- package/dist/utils/player.d.ts +0 -30
- package/dist/utils/player.d.ts.map +0 -1
- package/dist/utils/player.js.map +0 -1
- package/dist/utils/produce.d.ts +0 -126
- package/dist/utils/produce.d.ts.map +0 -1
- package/dist/utils/produce.js.map +0 -1
- package/dist/utils/resolveTarget.d.ts +0 -32
- package/dist/utils/resolveTarget.d.ts.map +0 -1
- package/dist/utils/resolveTarget.js.map +0 -1
- package/dist/utils/retention.d.ts +0 -10
- package/dist/utils/retention.d.ts.map +0 -1
- package/dist/utils/retention.js.map +0 -1
- package/dist/utils/sessions.d.ts +0 -154
- package/dist/utils/sessions.d.ts.map +0 -1
- package/dist/utils/sessions.js.map +0 -1
- package/dist/utils/sheet.d.ts +0 -26
- package/dist/utils/sheet.d.ts.map +0 -1
- package/dist/utils/sheet.js.map +0 -1
- package/dist/utils/still.d.ts +0 -7
- package/dist/utils/still.d.ts.map +0 -1
- package/dist/utils/still.js.map +0 -1
- package/dist/utils/targets.d.ts +0 -113
- package/dist/utils/targets.d.ts.map +0 -1
- package/dist/utils/targets.js.map +0 -1
- package/dist/utils/validate.d.ts +0 -15
- package/dist/utils/validate.d.ts.map +0 -1
- package/dist/utils/validate.js.map +0 -1
- package/dist/utils/wgc.d.ts +0 -46
- package/dist/utils/wgc.d.ts.map +0 -1
- package/dist/utils/wgc.js.map +0 -1
- package/dist/utils/windows.d.ts +0 -94
- package/dist/utils/windows.d.ts.map +0 -1
- package/dist/utils/windows.js.map +0 -1
- package/dist/utils/zoom.d.ts +0 -95
- package/dist/utils/zoom.d.ts.map +0 -1
- package/dist/utils/zoom.js.map +0 -1
- package/dist/wgcRecorder.d.ts +0 -2
- package/dist/wgcRecorder.d.ts.map +0 -1
- package/dist/wgcRecorder.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
+
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
4
5
|
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
5
6
|
import { runEditJob } from "../utils/jobs.js";
|
|
6
7
|
import { buildAssembleArgs, clipLength, DEFAULT_TRANSITION_DUR } from "../utils/produce.js";
|
|
@@ -9,16 +10,16 @@ const inputSchema = {
|
|
|
9
10
|
clips: z
|
|
10
11
|
.array(z.string().min(1))
|
|
11
12
|
.min(2)
|
|
12
|
-
.describe("
|
|
13
|
+
.describe("Clip paths, in order."),
|
|
13
14
|
transition: z
|
|
14
15
|
.string()
|
|
15
16
|
.optional()
|
|
16
|
-
.describe("
|
|
17
|
+
.describe("cut (default) or an xfade name (fade, wipeleft, slideup, ...)."),
|
|
17
18
|
duration: z
|
|
18
19
|
.number()
|
|
19
20
|
.positive()
|
|
20
21
|
.optional()
|
|
21
|
-
.describe(`Transition
|
|
22
|
+
.describe(`Transition seconds (default ${DEFAULT_TRANSITION_DUR}).`),
|
|
22
23
|
width: z.number().int().positive().optional().describe("Common output width (default 1920)."),
|
|
23
24
|
height: z.number().int().positive().optional().describe("Common output height (default 1080)."),
|
|
24
25
|
fps: z.number().int().positive().optional().describe("Common output fps (default 30)."),
|
|
@@ -26,9 +27,14 @@ const inputSchema = {
|
|
|
26
27
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
27
28
|
};
|
|
28
29
|
export function register(server) {
|
|
29
|
-
server.
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
server.registerTool("assemble_highlights", {
|
|
31
|
+
title: "Assemble Highlights",
|
|
32
|
+
description: "Stitch clips (including title cards) into one video with cuts or xfade transitions; they " +
|
|
33
|
+
"need not match in size, fps, or audio.",
|
|
34
|
+
inputSchema,
|
|
35
|
+
outputSchema: OUTPUT_PATH,
|
|
36
|
+
annotations: WRITES_FILE,
|
|
37
|
+
}, async (args, extra) => {
|
|
32
38
|
try {
|
|
33
39
|
requireFfmpeg();
|
|
34
40
|
for (const f of args.clips) {
|
|
@@ -59,4 +65,3 @@ export function register(server) {
|
|
|
59
65
|
}
|
|
60
66
|
});
|
|
61
67
|
}
|
|
62
|
-
//# sourceMappingURL=assembleHighlights.js.map
|
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
5
|
+
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
5
6
|
import { requireFfmpeg, probeMedia, hasFilter } from "../utils/ffmpeg.js";
|
|
6
7
|
import { runEditJob } from "../utils/jobs.js";
|
|
7
8
|
import { buildBurnSubtitlesArgs } from "../utils/captions.js";
|
|
@@ -14,13 +15,19 @@ const inputSchema = {
|
|
|
14
15
|
style: z
|
|
15
16
|
.enum(["clean", "social"])
|
|
16
17
|
.optional()
|
|
17
|
-
.describe("
|
|
18
|
+
.describe("clean (default for .srt): outlined line. social: big bold text on a dark box. .ass keeps its own " +
|
|
19
|
+
"styling unless set."),
|
|
18
20
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
19
21
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
20
22
|
};
|
|
21
23
|
export function register(server) {
|
|
22
|
-
server.
|
|
23
|
-
"
|
|
24
|
+
server.registerTool("burn_subtitles", {
|
|
25
|
+
title: "Burn In Subtitles",
|
|
26
|
+
description: "Burn SRT/ASS subtitles (e.g. from transcribe) into a video in the bundled font.",
|
|
27
|
+
inputSchema,
|
|
28
|
+
outputSchema: OUTPUT_PATH,
|
|
29
|
+
annotations: WRITES_FILE,
|
|
30
|
+
}, async (args, extra) => {
|
|
24
31
|
try {
|
|
25
32
|
requireFfmpeg();
|
|
26
33
|
for (const f of [args.input, args.subtitles]) {
|
|
@@ -34,17 +41,16 @@ export function register(server) {
|
|
|
34
41
|
const ext = editOutputExt(args.input);
|
|
35
42
|
const output = resolveOutput(args.output, subdir("edits"), `subtitled-${stamp()}-${rand()}${ext}`, args.overwrite);
|
|
36
43
|
const fontsDir = dirname(bundledFontPath("regular"));
|
|
37
|
-
const style = args.style ?? "clean";
|
|
44
|
+
const style = args.style ?? (/\.(ass|ssa)$/i.test(args.subtitles) ? null : "clean");
|
|
38
45
|
await runEditJob(buildBurnSubtitlesArgs(args.input, args.subtitles, output, fontsDir, style), {
|
|
39
46
|
output,
|
|
40
47
|
durationSec: (await probeMedia(args.input)).durationSec,
|
|
41
48
|
extra,
|
|
42
49
|
});
|
|
43
|
-
return okResponse({ outputPath: output, style });
|
|
50
|
+
return okResponse({ outputPath: output, style: style ?? "file" });
|
|
44
51
|
}
|
|
45
52
|
catch (error) {
|
|
46
53
|
return errorResponse(error);
|
|
47
54
|
}
|
|
48
55
|
});
|
|
49
56
|
}
|
|
50
|
-
//# sourceMappingURL=burnSubtitles.js.map
|
package/dist/tools/callout.js
CHANGED
|
@@ -3,6 +3,7 @@ import { join } from "node:path";
|
|
|
3
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
|
+
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
6
7
|
import { requireFfmpeg } from "../utils/ffmpeg.js";
|
|
7
8
|
import { runEditJob, probeDuration } from "../utils/jobs.js";
|
|
8
9
|
import { buildCalloutArgs } from "../utils/callout.js";
|
|
@@ -10,11 +11,16 @@ import { prepareCalloutAssets } from "../utils/calloutAssets.js";
|
|
|
10
11
|
import { editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
11
12
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
12
13
|
const timing = {
|
|
13
|
-
from: z.number().nonnegative().optional()
|
|
14
|
-
to: z.number().positive().optional()
|
|
15
|
-
color: z.string().optional()
|
|
14
|
+
from: z.number().nonnegative().optional(),
|
|
15
|
+
to: z.number().positive().optional(),
|
|
16
|
+
color: z.string().optional(),
|
|
16
17
|
};
|
|
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, ...).");
|
|
18
24
|
export const calloutItemSchema = z.discriminatedUnion("type", [
|
|
19
25
|
z.object({
|
|
20
26
|
type: z.literal("box"),
|
|
@@ -37,10 +43,10 @@ export const calloutItemSchema = z.discriminatedUnion("type", [
|
|
|
37
43
|
}),
|
|
38
44
|
z.object({
|
|
39
45
|
type: z.literal("arrow"),
|
|
40
|
-
x1: z.number()
|
|
41
|
-
y1: z.number()
|
|
42
|
-
x2: z.number().describe("Head
|
|
43
|
-
y2: z.number()
|
|
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(),
|
|
44
50
|
thickness: z.number().positive().optional().describe("Shaft px (default 8)."),
|
|
45
51
|
...timing,
|
|
46
52
|
}),
|
|
@@ -51,14 +57,21 @@ const inputSchema = {
|
|
|
51
57
|
.array(calloutItemSchema)
|
|
52
58
|
.min(1)
|
|
53
59
|
.max(50)
|
|
54
|
-
.describe("
|
|
55
|
-
"
|
|
60
|
+
.describe("Boxes, text labels, and arrows, drawn in order (later on top), in video pixels. Each shows " +
|
|
61
|
+
"from..to seconds (default: whole video); color is a name, #RRGGBB, or name@alpha."),
|
|
62
|
+
fontFile: fontFileSchema,
|
|
56
63
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
57
64
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
58
65
|
};
|
|
59
66
|
export function register(server) {
|
|
60
|
-
server.
|
|
61
|
-
"
|
|
67
|
+
server.registerTool("callout", {
|
|
68
|
+
title: "Add Callouts",
|
|
69
|
+
description: "Annotate a video with timed boxes, text labels, and arrows. Fallback fonts used are listed in " +
|
|
70
|
+
"fallbackFonts; characters no font covers are reported in warnings.",
|
|
71
|
+
inputSchema,
|
|
72
|
+
outputSchema: OUTPUT_PATH,
|
|
73
|
+
annotations: WRITES_FILE,
|
|
74
|
+
}, async (args, extra) => {
|
|
62
75
|
try {
|
|
63
76
|
requireFfmpeg();
|
|
64
77
|
if (!existsSync(args.input)) {
|
|
@@ -68,21 +81,24 @@ export function register(server) {
|
|
|
68
81
|
assertEditContainer(args.output);
|
|
69
82
|
const ext = editOutputExt(args.input);
|
|
70
83
|
const output = resolveOutput(args.output, subdir("edits"), `callout-${stamp()}-${rand()}${ext}`, args.overwrite);
|
|
71
|
-
// Text files and rendered arrows live in a private temp dir.
|
|
72
84
|
const work = mkdtempSync(join(tmpdir(), "screencast-callout-"));
|
|
73
85
|
try {
|
|
74
|
-
const assets = await prepareCalloutAssets(items, work);
|
|
86
|
+
const assets = await prepareCalloutAssets(items, work, "", args.fontFile);
|
|
75
87
|
const ffArgs = buildCalloutArgs(args.input, output, items, assets);
|
|
76
88
|
await runEditJob(ffArgs, { output, durationSec: await probeDuration(args.input), extra });
|
|
89
|
+
return okResponse({
|
|
90
|
+
outputPath: output,
|
|
91
|
+
callouts: items.length,
|
|
92
|
+
...(assets.fallbackFonts.length > 0 && { fallbackFonts: assets.fallbackFonts }),
|
|
93
|
+
...(assets.warnings.length > 0 && { warnings: assets.warnings }),
|
|
94
|
+
});
|
|
77
95
|
}
|
|
78
96
|
finally {
|
|
79
97
|
rmSync(work, { recursive: true, force: true });
|
|
80
98
|
}
|
|
81
|
-
return okResponse({ outputPath: output, callouts: items.length });
|
|
82
99
|
}
|
|
83
100
|
catch (error) {
|
|
84
101
|
return errorResponse(error);
|
|
85
102
|
}
|
|
86
103
|
});
|
|
87
104
|
}
|
|
88
|
-
//# sourceMappingURL=callout.js.map
|
package/dist/tools/clip.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
+
import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
|
|
4
5
|
import { requireFfmpeg } from "../utils/ffmpeg.js";
|
|
5
6
|
import { runEditJob } from "../utils/jobs.js";
|
|
6
7
|
import { buildClipArgs, editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
@@ -9,11 +10,11 @@ const inputSchema = {
|
|
|
9
10
|
input: z.string().min(1).describe("Path to the source video."),
|
|
10
11
|
segments: z
|
|
11
12
|
.array(z.object({
|
|
12
|
-
start: z.number().nonnegative()
|
|
13
|
-
end: z.number().positive()
|
|
13
|
+
start: z.number().nonnegative(),
|
|
14
|
+
end: z.number().positive(),
|
|
14
15
|
}))
|
|
15
16
|
.min(1)
|
|
16
|
-
.describe("
|
|
17
|
+
.describe("{start, end} segments in seconds; each becomes its own file."),
|
|
17
18
|
output: z
|
|
18
19
|
.string()
|
|
19
20
|
.optional()
|
|
@@ -21,9 +22,13 @@ const inputSchema = {
|
|
|
21
22
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
22
23
|
};
|
|
23
24
|
export function register(server) {
|
|
24
|
-
server.
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
server.registerTool("clip", {
|
|
26
|
+
title: "Extract Clips",
|
|
27
|
+
description: "Extract several frame-exact segments, each to its own file. For one segment, trim does the same.",
|
|
28
|
+
inputSchema,
|
|
29
|
+
outputSchema: looseOutput({ outputs: z.array(z.string()), count: z.number().int() }),
|
|
30
|
+
annotations: WRITES_FILE,
|
|
31
|
+
}, async (args, extra) => {
|
|
27
32
|
try {
|
|
28
33
|
requireFfmpeg();
|
|
29
34
|
if (!existsSync(args.input)) {
|
|
@@ -33,8 +38,7 @@ export function register(server) {
|
|
|
33
38
|
const ext = editOutputExt(args.input);
|
|
34
39
|
const single = args.segments.length === 1;
|
|
35
40
|
const outputs = [];
|
|
36
|
-
for (
|
|
37
|
-
const seg = args.segments[i];
|
|
41
|
+
for (const [i, seg] of args.segments.entries()) {
|
|
38
42
|
const output = resolveOutput(single ? args.output : undefined, subdir("edits"), `clip-${stamp()}-${rand()}-${String(i).padStart(2, "0")}${ext}`, args.overwrite);
|
|
39
43
|
await runEditJob(buildClipArgs(args.input, output, seg), { output, durationSec: seg.end - seg.start, extra });
|
|
40
44
|
outputs.push(output);
|
|
@@ -46,4 +50,3 @@ export function register(server) {
|
|
|
46
50
|
}
|
|
47
51
|
});
|
|
48
52
|
}
|
|
49
|
-
//# sourceMappingURL=clip.js.map
|
package/dist/tools/compress.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
+
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
4
5
|
import { requireFfmpeg } from "../utils/ffmpeg.js";
|
|
5
6
|
import { runEditJob, probeDuration } from "../utils/jobs.js";
|
|
6
7
|
import { buildCompressArgs, editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
@@ -10,19 +11,24 @@ const inputSchema = {
|
|
|
10
11
|
level: z
|
|
11
12
|
.enum(["light", "medium", "heavy"])
|
|
12
13
|
.optional()
|
|
13
|
-
.describe("
|
|
14
|
+
.describe("CRF 23 / 28 / 32 (default medium)."),
|
|
14
15
|
maxWidth: z
|
|
15
16
|
.number()
|
|
16
17
|
.int()
|
|
17
18
|
.positive()
|
|
18
19
|
.optional()
|
|
19
|
-
.describe("
|
|
20
|
+
.describe("Width cap in px (only downscales)."),
|
|
20
21
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
21
22
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
22
23
|
};
|
|
23
24
|
export function register(server) {
|
|
24
|
-
server.
|
|
25
|
-
"
|
|
25
|
+
server.registerTool("compress", {
|
|
26
|
+
title: "Compress Video",
|
|
27
|
+
description: "Re-encode a video smaller (H.264 CRF ladder, optional width cap). For a platform target use export_preset.",
|
|
28
|
+
inputSchema,
|
|
29
|
+
outputSchema: OUTPUT_PATH,
|
|
30
|
+
annotations: WRITES_FILE,
|
|
31
|
+
}, async (args, extra) => {
|
|
26
32
|
try {
|
|
27
33
|
requireFfmpeg();
|
|
28
34
|
if (!existsSync(args.input)) {
|
|
@@ -43,4 +49,3 @@ export function register(server) {
|
|
|
43
49
|
}
|
|
44
50
|
});
|
|
45
51
|
}
|
|
46
|
-
//# sourceMappingURL=compress.js.map
|
package/dist/tools/concat.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { extname, resolve } from "node:path";
|
|
3
3
|
import { existsSync, writeFileSync, rmSync } from "node:fs";
|
|
4
4
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
5
|
+
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
5
6
|
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
6
7
|
import { runEditJob } from "../utils/jobs.js";
|
|
7
8
|
import { buildConcatArgs, buildConcatListContent, concatCopyBlocker, editOutputExt, assertEditContainer, } from "../utils/media.js";
|
|
@@ -11,42 +12,43 @@ const inputSchema = {
|
|
|
11
12
|
inputs: z
|
|
12
13
|
.array(z.string().min(1))
|
|
13
14
|
.min(2)
|
|
14
|
-
.describe("
|
|
15
|
+
.describe("Video paths to join, in order."),
|
|
15
16
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
16
17
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
17
18
|
};
|
|
18
19
|
export function register(server) {
|
|
19
|
-
server.
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
server.registerTool("concat", {
|
|
21
|
+
title: "Concatenate Videos",
|
|
22
|
+
description: "Join videos end to end with hard cuts: stream copy when they match, else a re-encode (`mode` " +
|
|
23
|
+
"says which). For transitions use xfade_transition or assemble_highlights.",
|
|
24
|
+
inputSchema,
|
|
25
|
+
outputSchema: OUTPUT_PATH,
|
|
26
|
+
annotations: WRITES_FILE,
|
|
27
|
+
}, async (args, extra) => {
|
|
24
28
|
try {
|
|
25
29
|
requireFfmpeg();
|
|
26
|
-
// The concat demuxer resolves relative list entries against the list
|
|
27
|
-
// file's directory (the OS temp dir), not our cwd, so inputs must be
|
|
28
|
-
// absolute by the time they are written to the list.
|
|
29
30
|
const inputs = args.inputs.map((f) => resolve(f));
|
|
30
31
|
for (const f of inputs) {
|
|
31
32
|
if (!existsSync(f))
|
|
32
33
|
throw new ScreencastError(`Input file not found: ${f}`);
|
|
33
34
|
}
|
|
34
35
|
const infos = await Promise.all(inputs.map((f) => probeMedia(f)));
|
|
36
|
+
const [firstInput] = inputs;
|
|
37
|
+
const [first] = infos;
|
|
38
|
+
if (firstInput === undefined || first === undefined)
|
|
39
|
+
throw new ScreencastError("concat needs at least two inputs.");
|
|
35
40
|
const durations = infos.map((i) => clipLength(i));
|
|
36
41
|
const durationSec = durations.every((d) => d !== null) ? durations.reduce((a, d) => a + d, 0) : null;
|
|
37
|
-
// Mismatched inputs make the concat demuxer write a broken file (#206),
|
|
38
|
-
// and a copy carries any hidden frames along (#203): re-encode then.
|
|
39
42
|
const reason = concatCopyBlocker(inputs, infos);
|
|
40
43
|
if (reason !== null) {
|
|
41
44
|
assertEditContainer(args.output);
|
|
42
|
-
const output = resolveOutput(args.output, subdir("edits"), `concat-${stamp()}-${rand()}${editOutputExt(
|
|
43
|
-
const first = infos[0];
|
|
45
|
+
const output = resolveOutput(args.output, subdir("edits"), `concat-${stamp()}-${rand()}${editOutputExt(firstInput)}`, args.overwrite);
|
|
44
46
|
const even = (n) => (n !== null && n >= 2 ? n - (n % 2) : undefined);
|
|
45
47
|
const ffArgs = buildAssembleArgs(inputs, durations.map((d) => d ?? 0), output, { transition: "cut", width: even(first.width), height: even(first.height), fps: first.fps ?? undefined }, infos.map((i) => i.audioCodec !== null));
|
|
46
48
|
await runEditJob(ffArgs, { output, durationSec, extra });
|
|
47
49
|
return okResponse({ outputPath: output, inputCount: inputs.length, mode: "reencode", reason });
|
|
48
50
|
}
|
|
49
|
-
const ext = extname(
|
|
51
|
+
const ext = extname(firstInput) || ".mp4";
|
|
50
52
|
const output = resolveOutput(args.output, subdir("edits"), `concat-${stamp()}-${rand()}${ext}`, args.overwrite);
|
|
51
53
|
const listFile = tempPath(".txt");
|
|
52
54
|
writeFileSync(listFile, buildConcatListContent(inputs));
|
|
@@ -63,4 +65,3 @@ export function register(server) {
|
|
|
63
65
|
}
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
|
-
//# sourceMappingURL=concat.js.map
|
|
@@ -3,6 +3,7 @@ import { join } from "node:path";
|
|
|
3
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
|
+
import { WRITES_FILE, looseOutput } from "../utils/toolSpec.js";
|
|
6
7
|
import { requireFfmpeg, runFfmpeg, runCapture, probeMedia } from "../utils/ffmpeg.js";
|
|
7
8
|
import { jobTimeoutMs } from "../utils/jobs.js";
|
|
8
9
|
import { buildSceneScanArgs, parseSceneScan, pickSceneFrames, DEFAULT_SCENE_THRESHOLD, } from "../utils/media.js";
|
|
@@ -18,18 +19,17 @@ const inputSchema = {
|
|
|
18
19
|
.min(1)
|
|
19
20
|
.max(MAX_SHEET_COUNT)
|
|
20
21
|
.optional()
|
|
21
|
-
.describe(`
|
|
22
|
+
.describe(`Frames to tile (default ${DEFAULT_SHEET_COUNT}).`),
|
|
22
23
|
mode: z
|
|
23
24
|
.enum(["even", "scenes"])
|
|
24
25
|
.optional()
|
|
25
|
-
.describe("
|
|
26
|
-
"opening frame plus the strongest scene changes, so static stretches take no tiles."),
|
|
26
|
+
.describe("even (default) or scenes (strongest changes; static stretches take no tiles)."),
|
|
27
27
|
sceneThreshold: z
|
|
28
28
|
.number()
|
|
29
29
|
.gt(0)
|
|
30
30
|
.lt(1)
|
|
31
31
|
.optional()
|
|
32
|
-
.describe(`Mode
|
|
32
|
+
.describe(`Mode scenes: change needed, 0-1 (default ${DEFAULT_SCENE_THRESHOLD}).`),
|
|
33
33
|
columns: z.number().int().min(1).max(12).optional().describe("Tiles per row (default: roughly square)."),
|
|
34
34
|
tileWidth: z
|
|
35
35
|
.number()
|
|
@@ -37,30 +37,33 @@ const inputSchema = {
|
|
|
37
37
|
.min(64)
|
|
38
38
|
.max(1920)
|
|
39
39
|
.optional()
|
|
40
|
-
.describe(`
|
|
40
|
+
.describe(`Tile width in px (default ${DEFAULT_TILE_WIDTH}).`),
|
|
41
41
|
poster: z
|
|
42
42
|
.boolean()
|
|
43
43
|
.optional()
|
|
44
|
-
.describe("
|
|
45
|
-
"filter over 30 candidates spread across the video), e.g. for a video thumbnail."),
|
|
44
|
+
.describe("Write one representative poster frame instead of a sheet."),
|
|
46
45
|
output: z.string().optional().describe("Optional output .png path. Defaults under SCREENCAST_HOME/frames."),
|
|
47
46
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
48
47
|
returnImage: z
|
|
49
48
|
.boolean()
|
|
50
49
|
.optional()
|
|
51
|
-
.describe("
|
|
50
|
+
.describe("Return the sheet inline (default true)."),
|
|
52
51
|
maxImageWidth: z
|
|
53
52
|
.number()
|
|
54
53
|
.int()
|
|
55
54
|
.min(16)
|
|
56
55
|
.optional()
|
|
57
|
-
.describe(`
|
|
56
|
+
.describe(`Max inline image width (default ${DEFAULT_MAX_IMAGE_WIDTH}).`),
|
|
58
57
|
};
|
|
59
58
|
export function register(server) {
|
|
60
|
-
server.
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
59
|
+
server.registerTool("contact_sheet", {
|
|
60
|
+
title: "Contact Sheet",
|
|
61
|
+
description: "Tile timestamped frames of a video into one image to see a whole recording at a glance " +
|
|
62
|
+
"(the cheapest first look).",
|
|
63
|
+
inputSchema,
|
|
64
|
+
outputSchema: looseOutput({ outputPath: z.string(), inlineImages: z.number().int() }),
|
|
65
|
+
annotations: WRITES_FILE,
|
|
66
|
+
}, async (args, extra) => {
|
|
64
67
|
try {
|
|
65
68
|
const { ffmpeg } = requireFfmpeg();
|
|
66
69
|
if (!existsSync(args.input)) {
|
|
@@ -74,14 +77,16 @@ export function register(server) {
|
|
|
74
77
|
const tileWidth = args.tileWidth ?? DEFAULT_TILE_WIDTH;
|
|
75
78
|
let result;
|
|
76
79
|
if (args.poster) {
|
|
77
|
-
await runFfmpeg(buildPosterArgs(args.input, durationSec, output, Math.max(tileWidth, 1280)), jobTimeoutMs(durationSec)
|
|
80
|
+
await runFfmpeg(buildPosterArgs(args.input, durationSec, output, Math.max(tileWidth, 1280)), jobTimeoutMs(durationSec), {
|
|
81
|
+
signal: extra.signal,
|
|
82
|
+
});
|
|
78
83
|
result = { outputPath: output, poster: true };
|
|
79
84
|
}
|
|
80
85
|
else {
|
|
81
86
|
const count = args.count ?? DEFAULT_SHEET_COUNT;
|
|
82
87
|
let times;
|
|
83
88
|
if (args.mode === "scenes") {
|
|
84
|
-
const scan = await runCapture(ffmpeg, buildSceneScanArgs(args.input, args.sceneThreshold ?? DEFAULT_SCENE_THRESHOLD), jobTimeoutMs(durationSec));
|
|
89
|
+
const scan = await runCapture(ffmpeg, buildSceneScanArgs(args.input, args.sceneThreshold ?? DEFAULT_SCENE_THRESHOLD), jobTimeoutMs(durationSec), { signal: extra.signal });
|
|
85
90
|
if (scan.code !== 0) {
|
|
86
91
|
throw new ScreencastError(`Scene scan failed (exit ${scan.code}): ${scan.stderr.trim().slice(-400)}`);
|
|
87
92
|
}
|
|
@@ -91,18 +96,18 @@ export function register(server) {
|
|
|
91
96
|
times = evenTimes(durationSec, count);
|
|
92
97
|
}
|
|
93
98
|
const grid = sheetGrid(times.length, args.columns);
|
|
94
|
-
// Tiles and their label files live in a private temp dir, removed
|
|
95
|
-
// whatever happens.
|
|
96
99
|
const work = mkdtempSync(join(tmpdir(), "screencast-sheet-"));
|
|
97
100
|
try {
|
|
98
101
|
const font = bundledFontPath("bold");
|
|
99
|
-
for (
|
|
102
|
+
for (const [i, t] of times.entries()) {
|
|
100
103
|
const labelFile = join(work, `label_${i}.txt`);
|
|
101
|
-
writeFileSync(labelFile, formatTimecode(
|
|
104
|
+
writeFileSync(labelFile, formatTimecode(t));
|
|
102
105
|
const tile = join(work, `tile_${String(i).padStart(3, "0")}.png`);
|
|
103
|
-
await runFfmpeg(buildTileArgs(args.input,
|
|
106
|
+
await runFfmpeg(buildTileArgs(args.input, t, tile, tileWidth, font, labelFile), 60_000, {
|
|
107
|
+
signal: extra.signal,
|
|
108
|
+
});
|
|
104
109
|
}
|
|
105
|
-
await runFfmpeg(buildSheetArgs(sequencePattern(work, "tile_%03d.png"), grid, output), 60_000);
|
|
110
|
+
await runFfmpeg(buildSheetArgs(sequencePattern(work, "tile_%03d.png"), grid, output), 60_000, { signal: extra.signal });
|
|
106
111
|
}
|
|
107
112
|
finally {
|
|
108
113
|
rmSync(work, { recursive: true, force: true });
|
|
@@ -125,4 +130,3 @@ export function register(server) {
|
|
|
125
130
|
}
|
|
126
131
|
});
|
|
127
132
|
}
|
|
128
|
-
//# sourceMappingURL=contactSheet.js.map
|
package/dist/tools/convert.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
+
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
4
5
|
import { requireFfmpeg } from "../utils/ffmpeg.js";
|
|
5
6
|
import { runEditJob, probeDuration } from "../utils/jobs.js";
|
|
6
7
|
import { buildConvertArgs } from "../utils/media.js";
|
|
@@ -9,15 +10,21 @@ const inputSchema = {
|
|
|
9
10
|
input: z.string().min(1).describe("Path to the source media."),
|
|
10
11
|
format: z
|
|
11
12
|
.enum(["mp4", "gif", "webm"])
|
|
12
|
-
.describe("
|
|
13
|
-
fps: z.number().positive().optional().describe("
|
|
14
|
-
width: z.number().positive().optional().describe("
|
|
13
|
+
.describe("mp4 (H.264), webm (VP9), or gif (palette)."),
|
|
14
|
+
fps: z.number().positive().optional().describe("gif only: fps (default 12)."),
|
|
15
|
+
width: z.number().positive().optional().describe("gif only: width in px (default 720)."),
|
|
15
16
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
16
17
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
17
18
|
};
|
|
18
19
|
export function register(server) {
|
|
19
|
-
server.
|
|
20
|
-
"
|
|
20
|
+
server.registerTool("convert", {
|
|
21
|
+
title: "Convert Format",
|
|
22
|
+
description: "Convert media to mp4, webm, or gif. For a size-bounded GIF/WebP prefer export_gif; for a " +
|
|
23
|
+
"smaller mp4, compress or export_preset.",
|
|
24
|
+
inputSchema,
|
|
25
|
+
outputSchema: OUTPUT_PATH,
|
|
26
|
+
annotations: WRITES_FILE,
|
|
27
|
+
}, async (args, extra) => {
|
|
21
28
|
try {
|
|
22
29
|
requireFfmpeg();
|
|
23
30
|
if (!existsSync(args.input)) {
|
|
@@ -37,4 +44,3 @@ export function register(server) {
|
|
|
37
44
|
}
|
|
38
45
|
});
|
|
39
46
|
}
|
|
40
|
-
//# sourceMappingURL=convert.js.map
|
package/dist/tools/crop.js
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
+
import { OUTPUT_PATH, WRITES_FILE } from "../utils/toolSpec.js";
|
|
4
5
|
import { requireFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
5
6
|
import { runEditJob } from "../utils/jobs.js";
|
|
6
7
|
import { buildCropArgs, editOutputExt, assertEditContainer } from "../utils/media.js";
|
|
7
8
|
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
8
9
|
const inputSchema = {
|
|
9
10
|
input: z.string().min(1).describe("Path to the source video."),
|
|
10
|
-
x: z.number().int().nonnegative()
|
|
11
|
-
y: z.number().int().nonnegative()
|
|
12
|
-
width: z.number().int().positive()
|
|
13
|
-
height: z.number().int().positive()
|
|
11
|
+
x: z.number().int().nonnegative(),
|
|
12
|
+
y: z.number().int().nonnegative(),
|
|
13
|
+
width: z.number().int().positive(),
|
|
14
|
+
height: z.number().int().positive(),
|
|
14
15
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
15
16
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
16
17
|
};
|
|
17
18
|
export function register(server) {
|
|
18
|
-
server.
|
|
19
|
-
"
|
|
19
|
+
server.registerTool("crop", {
|
|
20
|
+
title: "Crop Video",
|
|
21
|
+
description: "Crop a video to a pixel rectangle; one running off the frame is rejected.",
|
|
22
|
+
inputSchema,
|
|
23
|
+
outputSchema: OUTPUT_PATH,
|
|
24
|
+
annotations: WRITES_FILE,
|
|
25
|
+
}, async (args, extra) => {
|
|
20
26
|
try {
|
|
21
27
|
requireFfmpeg();
|
|
22
28
|
if (!existsSync(args.input)) {
|
|
@@ -35,4 +41,3 @@ export function register(server) {
|
|
|
35
41
|
}
|
|
36
42
|
});
|
|
37
43
|
}
|
|
38
|
-
//# sourceMappingURL=crop.js.map
|
package/dist/tools/cutIdle.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
+
import { WRITES_FILE } from "../utils/toolSpec.js";
|
|
4
5
|
import { requireFfmpeg, runCapture, probeMedia } from "../utils/ffmpeg.js";
|
|
5
6
|
import { runEditJob, jobTimeoutMs } from "../utils/jobs.js";
|
|
6
7
|
import { buildIdleScanArgs, parseFreezes, parseSilences, intersect, cutsFor, buildCutIdleArgs, DEFAULT_MIN_IDLE_SEC, DEFAULT_KEEP_SEC, } from "../utils/idle.js";
|
|
@@ -17,20 +18,23 @@ const inputSchema = {
|
|
|
17
18
|
.number()
|
|
18
19
|
.min(0)
|
|
19
20
|
.optional()
|
|
20
|
-
.describe(`
|
|
21
|
+
.describe(`Seconds kept at each edge of a cut (default ${DEFAULT_KEEP_SEC}).`),
|
|
21
22
|
useAudio: z
|
|
22
23
|
.boolean()
|
|
23
24
|
.optional()
|
|
24
|
-
.describe("
|
|
25
|
-
|
|
26
|
-
dryRun: z.boolean().optional().describe("Only report the stretches that would be cut; write nothing."),
|
|
25
|
+
.describe("Require silent audio too (default true when there is audio)."),
|
|
26
|
+
dryRun: z.boolean().optional().describe("Only report what would be cut."),
|
|
27
27
|
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
28
28
|
overwrite: z.boolean().optional().describe("Allow replacing an existing file at the output path (default false)."),
|
|
29
29
|
};
|
|
30
30
|
export function register(server) {
|
|
31
|
-
server.
|
|
32
|
-
"
|
|
33
|
-
"
|
|
31
|
+
server.registerTool("cut_idle", {
|
|
32
|
+
title: "Cut Idle Stretches",
|
|
33
|
+
description: "Remove dead air: cut stretches where the screen is frozen (and silent), keeping a short pad. " +
|
|
34
|
+
"Returns the time saved.",
|
|
35
|
+
inputSchema,
|
|
36
|
+
annotations: WRITES_FILE,
|
|
37
|
+
}, async (args, extra) => {
|
|
34
38
|
try {
|
|
35
39
|
const { ffmpeg } = requireFfmpeg();
|
|
36
40
|
if (!existsSync(args.input))
|
|
@@ -43,7 +47,9 @@ export function register(server) {
|
|
|
43
47
|
const keep = args.keepSec ?? DEFAULT_KEEP_SEC;
|
|
44
48
|
const hasAudio = info.audioCodec !== null;
|
|
45
49
|
const useAudio = (args.useAudio ?? true) && hasAudio;
|
|
46
|
-
const scan = await runCapture(ffmpeg, buildIdleScanArgs(args.input, minIdle, useAudio), jobTimeoutMs(duration)
|
|
50
|
+
const scan = await runCapture(ffmpeg, buildIdleScanArgs(args.input, minIdle, useAudio), jobTimeoutMs(duration), {
|
|
51
|
+
signal: extra.signal,
|
|
52
|
+
});
|
|
47
53
|
if (scan.code !== 0)
|
|
48
54
|
throw new ScreencastError(`Idle scan failed (exit ${scan.code}): ${scan.stderr.trim().slice(-400)}`);
|
|
49
55
|
const freezes = parseFreezes(scan.stderr, duration);
|
|
@@ -66,6 +72,7 @@ export function register(server) {
|
|
|
66
72
|
await runEditJob(buildCutIdleArgs(args.input, output, cuts, hasAudio), {
|
|
67
73
|
output,
|
|
68
74
|
durationSec: duration - removedSec,
|
|
75
|
+
inputDurationSec: duration,
|
|
69
76
|
extra,
|
|
70
77
|
});
|
|
71
78
|
return okResponse({ outputPath: output, ...summary });
|
|
@@ -75,4 +82,3 @@ export function register(server) {
|
|
|
75
82
|
}
|
|
76
83
|
});
|
|
77
84
|
}
|
|
78
|
-
//# sourceMappingURL=cutIdle.js.map
|