@tmhs/screencast-mcp 0.48.0 → 0.48.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.
@@ -5,6 +5,7 @@ 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
7
  import { buildAssembleArgs, clipLength, DEFAULT_TRANSITION_DUR } from "../utils/produce.js";
8
+ import { assertEditContainer } from "../utils/media.js";
8
9
  import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
9
10
  const inputSchema = {
10
11
  clips: z
@@ -41,6 +42,7 @@ export function register(server) {
41
42
  if (!existsSync(f))
42
43
  throw new ScreencastError(`Input file not found: ${f}`);
43
44
  }
45
+ assertEditContainer(args.output);
44
46
  const infos = await Promise.all(args.clips.map((c) => probeMedia(c)));
45
47
  const durations = infos.map((i) => clipLength(i) ?? 0);
46
48
  const clipHasAudio = infos.map((i) => i.audioCodec !== null);
@@ -6,6 +6,7 @@ import { requireFfmpeg } from "../utils/ffmpeg.js";
6
6
  import { runEditJob, probeDuration } from "../utils/jobs.js";
7
7
  import { buildExportPresetArgs, PLATFORM_PRESETS, PLATFORMS, } from "../utils/produce.js";
8
8
  import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
9
+ import { assertEditContainer } from "../utils/media.js";
9
10
  const inputSchema = {
10
11
  input: z.string().min(1).describe("Path to the source video."),
11
12
  platform: z
@@ -32,6 +33,7 @@ export function register(server) {
32
33
  if (!existsSync(args.input)) {
33
34
  throw new ScreencastError(`Input file not found: ${args.input}`);
34
35
  }
36
+ assertEditContainer(args.output);
35
37
  const platform = args.platform;
36
38
  const output = resolveOutput(args.output, subdir("edits"), `${platform}-${stamp()}-${rand()}.mp4`, args.overwrite);
37
39
  const ffArgs = buildExportPresetArgs(args.input, output, platform, args.fit ?? "pad");
@@ -10,6 +10,7 @@ import { planPipeline, probeArgs, sidecarCues, MAX_PIPELINE_STEPS } from "../uti
10
10
  import { calloutFonts, prepareCalloutAssets } from "../utils/calloutAssets.js";
11
11
  import { exportAnimation } from "../utils/animExport.js";
12
12
  import { calloutItemSchema, fontFileSchema } from "./callout.js";
13
+ import { assertEditContainer } from "../utils/media.js";
13
14
  import { readClicks, zoomKeyframeSchema } from "./zoom.js";
14
15
  import { redactRegionSchema } from "./redactRegion.js";
15
16
  import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
@@ -166,6 +167,8 @@ export function register(server) {
166
167
  const last = steps.at(-1);
167
168
  if (!last)
168
169
  throw new ScreencastError("Provide at least one step.");
170
+ if (last.op !== "export_gif")
171
+ assertEditContainer(args.output);
169
172
  const ext = last.op === "export_gif" ? `.${last.format ?? "gif"}` : ".mp4";
170
173
  const output = resolveOutput(args.output, subdir("edits"), `pipeline-${stamp()}-${rand()}${ext}`, args.overwrite);
171
174
  const transcribes = last.op !== "export_gif" && steps.some((s) => s.op === "burn_subtitles" && s.transcribe);
@@ -8,6 +8,7 @@ import { buildTitleCardArgs, DEFAULT_TITLE_DURATION } from "../utils/produce.js"
8
8
  import { resolveTextFont } from "../utils/fonts.js";
9
9
  import { fontFileSchema } from "./callout.js";
10
10
  import { resolveOutput, subdir, stamp, rand, tempPath } from "../utils/paths.js";
11
+ import { assertEditContainer } from "../utils/media.js";
11
12
  const inputSchema = {
12
13
  text: z.string().min(1).describe("Title text. Multiple lines are allowed (use \\n)."),
13
14
  duration: z.number().positive().optional().describe("Card length in seconds (default 3)."),
@@ -33,6 +34,7 @@ export function register(server) {
33
34
  }, async (args, extra) => {
34
35
  try {
35
36
  requireFfmpeg();
37
+ assertEditContainer(args.output);
36
38
  const output = resolveOutput(args.output, subdir("edits"), `title-${stamp()}-${rand()}.mp4`, args.overwrite);
37
39
  const font = resolveTextFont(args.text, { weight: args.bold === false ? "regular" : "bold", fontFile: args.fontFile });
38
40
  const textFile = tempPath(".txt");
@@ -5,6 +5,7 @@ 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
7
  import { buildXfadeArgs, clipLength, DEFAULT_TRANSITION_DUR } from "../utils/produce.js";
8
+ import { assertEditContainer } from "../utils/media.js";
8
9
  import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
9
10
  const inputSchema = {
10
11
  inputA: z.string().min(1).describe("Outgoing video."),
@@ -36,6 +37,7 @@ export function register(server) {
36
37
  if (!existsSync(f))
37
38
  throw new ScreencastError(`Input file not found: ${f}`);
38
39
  }
40
+ assertEditContainer(args.output);
39
41
  const [a, b] = await Promise.all([probeMedia(args.inputA), probeMedia(args.inputB)]);
40
42
  const durA = clipLength(a);
41
43
  const durB = clipLength(b);
@@ -94,10 +94,6 @@ async function enumerateDshow() {
94
94
  cachedDevices = parseDshowAudioDevices(res.stderr);
95
95
  cachedVideo = parseDshowVideoDevices(res.stderr);
96
96
  }
97
- export function clearAudioDeviceCache() {
98
- cachedDevices = null;
99
- cachedVideo = null;
100
- }
101
97
  export async function resolveLoopbackDevice(explicit) {
102
98
  const devices = await listDshowAudioDevices();
103
99
  const picked = pickLoopbackDevice(devices, explicit);
@@ -82,9 +82,6 @@ export function isRecorderProcess(pid, image) {
82
82
  return false;
83
83
  return tasklistHasImage(res.stdout, image);
84
84
  }
85
- export function isFfmpegProcess(pid) {
86
- return isRecorderProcess(pid, "ffmpeg.exe");
87
- }
88
85
  export function classifyUnrequestedExit(opts) {
89
86
  const { code, backend, maxDurationSec, elapsedMs } = opts;
90
87
  if (backend === "wgc" && code === WGC_WINDOW_CLOSED_EXIT)
@@ -10,10 +10,10 @@ export function evenTimes(durationSec, count) {
10
10
  return Array.from({ length: count }, (_, i) => Math.round(((i + 0.5) * durationSec) / count * 1000) / 1000);
11
11
  }
12
12
  export function formatTimecode(sec) {
13
- const s = Math.max(0, sec);
14
- const h = Math.floor(s / 3600);
15
- const m = Math.floor((s % 3600) / 60);
16
- const rest = s % 60;
13
+ const tenths = Math.round(Math.max(0, sec) * 10);
14
+ const h = Math.floor(tenths / 36000);
15
+ const m = Math.floor((tenths % 36000) / 600);
16
+ const rest = (tenths % 600) / 10;
17
17
  if (h > 0)
18
18
  return `${h}:${String(m).padStart(2, "0")}:${String(Math.floor(rest)).padStart(2, "0")}`;
19
19
  return `${m}:${rest.toFixed(1).padStart(4, "0")}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmhs/screencast-mcp",
3
- "version": "0.48.0",
3
+ "version": "0.48.1",
4
4
  "description": "Let AI agents record the Windows screen, watch it as frames, and edit it with ffmpeg",
5
5
  "mcpName": "io.github.TMHSDigital/screencast-mcp",
6
6
  "type": "module",
@@ -72,11 +72,11 @@
72
72
  "@types/jsdom": "^30.0.0",
73
73
  "@types/node": "^22.15.3",
74
74
  "@vitest/coverage-v8": "^5.0.5",
75
- "eslint": "^10.5.0",
76
- "jsdom": "^30.1.3",
75
+ "eslint": "^10.14.0",
76
+ "jsdom": "^31.0.0",
77
77
  "tsx": "^4.19.4",
78
78
  "typescript": "^5.8.3",
79
- "typescript-eslint": "^8.61.1",
80
- "vitest": "^5.0.5"
79
+ "typescript-eslint": "^8.72.1",
80
+ "vitest": "^5.1.0"
81
81
  }
82
82
  }