@tmhs/screencast-mcp 0.5.0 → 0.7.0
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 +12 -1
- package/assets/.gitkeep +0 -0
- package/assets/fonts/Inter-Bold.ttf +0 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
- package/assets/fonts/OFL.txt +93 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/tools/assembleHighlights.d.ts +3 -0
- package/dist/tools/assembleHighlights.d.ts.map +1 -0
- package/dist/tools/assembleHighlights.js +60 -0
- package/dist/tools/assembleHighlights.js.map +1 -0
- package/dist/tools/musicBed.d.ts +3 -0
- package/dist/tools/musicBed.d.ts.map +1 -0
- package/dist/tools/musicBed.js +48 -0
- package/dist/tools/musicBed.js.map +1 -0
- package/dist/tools/titleCard.d.ts +3 -0
- package/dist/tools/titleCard.d.ts.map +1 -0
- package/dist/tools/titleCard.js +57 -0
- package/dist/tools/titleCard.js.map +1 -0
- package/dist/tools/xfadeTransition.d.ts +3 -0
- package/dist/tools/xfadeTransition.d.ts.map +1 -0
- package/dist/tools/xfadeTransition.js +46 -0
- package/dist/tools/xfadeTransition.js.map +1 -0
- package/dist/utils/fonts.d.ts +11 -0
- package/dist/utils/fonts.d.ts.map +1 -0
- package/dist/utils/fonts.js +28 -0
- package/dist/utils/fonts.js.map +1 -0
- package/dist/utils/produce.d.ts +69 -0
- package/dist/utils/produce.d.ts.map +1 -0
- package/dist/utils/produce.js +242 -0
- package/dist/utils/produce.js.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ The design choices are deliberate rather than incidental:
|
|
|
43
43
|
|
|
44
44
|
## Tools
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Twenty-three tools across four concerns. The manifest in [`mcp-tools.json`](mcp-tools.json) is the canonical surface and is kept in sync with `src/tools/`.
|
|
47
47
|
|
|
48
48
|
### Capture
|
|
49
49
|
|
|
@@ -94,6 +94,17 @@ These tools re-encode (a filter rewrites pixels, so stream copy does not apply).
|
|
|
94
94
|
> [!IMPORTANT]
|
|
95
95
|
> `redact_region` covers the regions **you** declare. It is not automatic secret detection, so it cannot find a secret you did not point it at. The default `box` style is a solid fill, which is irreversible; `blur` and `pixelate` are softer but can be partially recovered, so prefer `box` for real secrets. A region that falls outside the frame is rejected rather than silently doing nothing.
|
|
96
96
|
|
|
97
|
+
### Produce
|
|
98
|
+
|
|
99
|
+
The production layer turns raw clips into a finished piece. Tools that combine clips auto-normalize each input to a common resolution, fps, and audio rate first, so heterogeneous sources compose cleanly.
|
|
100
|
+
|
|
101
|
+
| Tool | Purpose |
|
|
102
|
+
| --- | --- |
|
|
103
|
+
| `xfade_transition` | Crossfade two videos into one with an `xfade` transition (`fade`, `wipeleft`, `slideup`, ...). Audio is crossfaded when both clips have a track. |
|
|
104
|
+
| `assemble_highlights` | Stitch two or more clips into one, with hard cuts (`transition: "cut"`) or an xfade transition between each. |
|
|
105
|
+
| `title_card` | Generate a standalone title card (centered text on a solid background, with a silent track so it composes). Text uses a bundled font, so no system font is needed. |
|
|
106
|
+
| `music_bed` | Lay a music track under a video: looped/trimmed to length, faded in and out, leveled, and mixed with any existing audio (optionally ducked). |
|
|
107
|
+
|
|
97
108
|
### Targets
|
|
98
109
|
|
|
99
110
|
Every capture tool takes a single `target` string, so an agent never has to juggle quoting:
|
package/assets/.gitkeep
ADDED
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -30,9 +30,13 @@ import { register as registerExtractAudio } from "./tools/extractAudio.js";
|
|
|
30
30
|
import { register as registerClip } from "./tools/clip.js";
|
|
31
31
|
import { register as registerRedactRegion } from "./tools/redactRegion.js";
|
|
32
32
|
import { register as registerListAudioDevices } from "./tools/listAudioDevices.js";
|
|
33
|
+
import { register as registerXfadeTransition } from "./tools/xfadeTransition.js";
|
|
34
|
+
import { register as registerAssembleHighlights } from "./tools/assembleHighlights.js";
|
|
35
|
+
import { register as registerTitleCard } from "./tools/titleCard.js";
|
|
36
|
+
import { register as registerMusicBed } from "./tools/musicBed.js";
|
|
33
37
|
const server = new McpServer({
|
|
34
38
|
name: "screencast-mcp",
|
|
35
|
-
version: "0.
|
|
39
|
+
version: "0.7.0",
|
|
36
40
|
});
|
|
37
41
|
registerStartRecording(server);
|
|
38
42
|
registerStopRecording(server);
|
|
@@ -53,6 +57,10 @@ registerExtractAudio(server);
|
|
|
53
57
|
registerClip(server);
|
|
54
58
|
registerRedactRegion(server);
|
|
55
59
|
registerListAudioDevices(server);
|
|
60
|
+
registerXfadeTransition(server);
|
|
61
|
+
registerAssembleHighlights(server);
|
|
62
|
+
registerTitleCard(server);
|
|
63
|
+
registerMusicBed(server);
|
|
56
64
|
async function main() {
|
|
57
65
|
// Reconcile any sessions interrupted by a previous crash and kill ffmpeg
|
|
58
66
|
// children that outlived the last run, so no zombie capture survives.
|
package/dist/index.js.map
CHAN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KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,gBAAgB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAC3E,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assembleHighlights.d.ts","sourceRoot":"","sources":["../../src/tools/assembleHighlights.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA0BzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA8ChD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
+
import { requireFfmpeg, runFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
5
|
+
import { buildAssembleArgs, DEFAULT_TRANSITION_DUR } from "../utils/produce.js";
|
|
6
|
+
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
7
|
+
const inputSchema = {
|
|
8
|
+
clips: z
|
|
9
|
+
.array(z.string().min(1))
|
|
10
|
+
.min(2)
|
|
11
|
+
.describe("Two or more clip paths, in order. Clips are auto-normalized, so they need not match."),
|
|
12
|
+
transition: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("'cut' (default, hard cuts) or an xfade transition name (fade, wipeleft, slideup, ...)."),
|
|
16
|
+
duration: z
|
|
17
|
+
.number()
|
|
18
|
+
.positive()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe(`Transition length in seconds when not a cut (default ${DEFAULT_TRANSITION_DUR}).`),
|
|
21
|
+
width: z.number().int().positive().optional().describe("Common output width (default 1920)."),
|
|
22
|
+
height: z.number().int().positive().optional().describe("Common output height (default 1080)."),
|
|
23
|
+
fps: z.number().int().positive().optional().describe("Common output fps (default 30)."),
|
|
24
|
+
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
25
|
+
};
|
|
26
|
+
export function register(server) {
|
|
27
|
+
server.tool("assemble_highlights", "Stitch two or more clips into a single video, with hard cuts or an xfade " +
|
|
28
|
+
"transition between each. Clips are auto-normalized to a common " +
|
|
29
|
+
"resolution, fps, and audio rate, so they need not match.", inputSchema, async (args) => {
|
|
30
|
+
try {
|
|
31
|
+
requireFfmpeg();
|
|
32
|
+
for (const f of args.clips) {
|
|
33
|
+
if (!existsSync(f))
|
|
34
|
+
throw new ScreencastError(`Input file not found: ${f}`);
|
|
35
|
+
}
|
|
36
|
+
const infos = await Promise.all(args.clips.map((c) => probeMedia(c)));
|
|
37
|
+
const durations = infos.map((i) => i.durationSec ?? 0);
|
|
38
|
+
const hasAudio = infos.every((i) => i.audioCodec !== null);
|
|
39
|
+
const output = resolveOutput(args.output, subdir("edits"), `highlights-${stamp()}-${rand()}.mp4`);
|
|
40
|
+
const ffArgs = buildAssembleArgs(args.clips, durations, output, {
|
|
41
|
+
transition: args.transition,
|
|
42
|
+
duration: args.duration,
|
|
43
|
+
width: args.width,
|
|
44
|
+
height: args.height,
|
|
45
|
+
fps: args.fps,
|
|
46
|
+
}, hasAudio);
|
|
47
|
+
await runFfmpeg(ffArgs, 20 * 60_000);
|
|
48
|
+
return okResponse({
|
|
49
|
+
outputPath: output,
|
|
50
|
+
clips: args.clips.length,
|
|
51
|
+
transition: args.transition ?? "cut",
|
|
52
|
+
audio: hasAudio,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return errorResponse(error);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=assembleHighlights.js.map
|
|
@@ -0,0 +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;gBAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,GAAG,EAAE,IAAI,CAAC,GAAG;aACd,EACD,QAAQ,CACT,CAAC;YACF,MAAM,SAAS,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;YACrC,OAAO,UAAU,CAAC;gBAChB,UAAU,EAAE,MAAM;gBAClB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;gBACxB,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK;gBACpC,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"musicBed.d.ts","sourceRoot":"","sources":["../../src/tools/musicBed.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAwChD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { extname } from "node:path";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
5
|
+
import { requireFfmpeg, runFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
6
|
+
import { buildMusicBedArgs } from "../utils/produce.js";
|
|
7
|
+
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
8
|
+
const inputSchema = {
|
|
9
|
+
video: z.string().min(1).describe("Path to the video."),
|
|
10
|
+
music: z.string().min(1).describe("Path to the music audio file (looped/trimmed to the video length)."),
|
|
11
|
+
musicVolume: z.number().nonnegative().optional().describe("Music level 0..1 (default 0.25 over existing audio, 0.8 alone)."),
|
|
12
|
+
fadeIn: z.number().nonnegative().optional().describe("Music fade-in seconds (default 1)."),
|
|
13
|
+
fadeOut: z.number().nonnegative().optional().describe("Music fade-out seconds (default 2)."),
|
|
14
|
+
duck: z.boolean().optional().describe("Duck the music under the original audio via a sidechain (default false)."),
|
|
15
|
+
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
16
|
+
};
|
|
17
|
+
export function register(server) {
|
|
18
|
+
server.tool("music_bed", "Lay a music track under a video: the music is looped/trimmed to the video " +
|
|
19
|
+
"length, faded in and out, and leveled. When the video already has audio " +
|
|
20
|
+
"the two are mixed, optionally ducking the music under the original. The " +
|
|
21
|
+
"video stream is copied; only audio is re-encoded.", inputSchema, async (args) => {
|
|
22
|
+
try {
|
|
23
|
+
requireFfmpeg();
|
|
24
|
+
for (const f of [args.video, args.music]) {
|
|
25
|
+
if (!existsSync(f))
|
|
26
|
+
throw new ScreencastError(`Input file not found: ${f}`);
|
|
27
|
+
}
|
|
28
|
+
const info = await probeMedia(args.video);
|
|
29
|
+
if (info.durationSec === null) {
|
|
30
|
+
throw new ScreencastError(`Could not read duration of ${args.video}.`);
|
|
31
|
+
}
|
|
32
|
+
const ext = extname(args.video) || ".mp4";
|
|
33
|
+
const output = resolveOutput(args.output, subdir("edits"), `music-${stamp()}-${rand()}${ext}`);
|
|
34
|
+
const ffArgs = buildMusicBedArgs(args.video, args.music, output, info.durationSec, info.audioCodec !== null, {
|
|
35
|
+
musicVolume: args.musicVolume,
|
|
36
|
+
fadeIn: args.fadeIn,
|
|
37
|
+
fadeOut: args.fadeOut,
|
|
38
|
+
duck: args.duck,
|
|
39
|
+
});
|
|
40
|
+
await runFfmpeg(ffArgs, 15 * 60_000);
|
|
41
|
+
return okResponse({ outputPath: output, mixedWithOriginal: info.audioCodec !== null });
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return errorResponse(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=musicBed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"musicBed.js","sourceRoot":"","sources":["../../src/tools/musicBed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IACvD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,oEAAoE,CAAC;IACvG,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;IAC5H,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IAC1F,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAC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IAAI,EACxB;gBACE,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CACF,CAAC;YACF,MAAM,SAAS,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;YACrC,OAAO,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC,CAAC;QACzF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"titleCard.d.ts","sourceRoot":"","sources":["../../src/tools/titleCard.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAoBzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAsChD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { writeFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { errorResponse, okResponse } from "../utils/errors.js";
|
|
5
|
+
import { requireFfmpeg, runFfmpeg } from "../utils/ffmpeg.js";
|
|
6
|
+
import { buildTitleCardArgs } from "../utils/produce.js";
|
|
7
|
+
import { bundledFontPath } from "../utils/fonts.js";
|
|
8
|
+
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
9
|
+
const inputSchema = {
|
|
10
|
+
text: z.string().min(1).describe("Title text. Multiple lines are allowed (use \\n)."),
|
|
11
|
+
duration: z.number().positive().optional().describe("Card length in seconds (default 3)."),
|
|
12
|
+
width: z.number().int().positive().optional().describe("Card width (default 1920)."),
|
|
13
|
+
height: z.number().int().positive().optional().describe("Card height (default 1080)."),
|
|
14
|
+
fps: z.number().int().positive().optional().describe("Card fps (default 30)."),
|
|
15
|
+
bg: z.string().optional().describe("Background color (default black)."),
|
|
16
|
+
fontColor: z.string().optional().describe("Text color (default white)."),
|
|
17
|
+
fontSize: z.number().int().positive().optional().describe("Text size in px (default 96)."),
|
|
18
|
+
bold: z.boolean().optional().describe("Use the bold weight (default true)."),
|
|
19
|
+
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
20
|
+
};
|
|
21
|
+
export function register(server) {
|
|
22
|
+
server.tool("title_card", "Generate a standalone title card: centered text on a solid background, with " +
|
|
23
|
+
"a silent audio track so it composes with audio-bearing clips (use " +
|
|
24
|
+
"assemble_highlights to stitch it in). Text is rendered with a bundled " +
|
|
25
|
+
"font, so no system font is required.", inputSchema, async (args) => {
|
|
26
|
+
try {
|
|
27
|
+
requireFfmpeg();
|
|
28
|
+
const editsDir = subdir("edits");
|
|
29
|
+
const output = resolveOutput(args.output, editsDir, `title-${stamp()}-${rand()}.mp4`);
|
|
30
|
+
const fontFile = bundledFontPath(args.bold === false ? "regular" : "bold");
|
|
31
|
+
// Write the text to a temp file so arbitrary content (quotes, colons,
|
|
32
|
+
// percent signs) needs no inline filtergraph escaping.
|
|
33
|
+
const textFile = join(editsDir, `.title-${stamp()}-${rand()}.txt`);
|
|
34
|
+
writeFileSync(textFile, args.text);
|
|
35
|
+
try {
|
|
36
|
+
const ffArgs = buildTitleCardArgs(textFile, fontFile, output, {
|
|
37
|
+
duration: args.duration,
|
|
38
|
+
width: args.width,
|
|
39
|
+
height: args.height,
|
|
40
|
+
fps: args.fps,
|
|
41
|
+
bg: args.bg,
|
|
42
|
+
fontColor: args.fontColor,
|
|
43
|
+
fontSize: args.fontSize,
|
|
44
|
+
});
|
|
45
|
+
await runFfmpeg(ffArgs, 5 * 60_000);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
rmSync(textFile, { force: true });
|
|
49
|
+
}
|
|
50
|
+
return okResponse({ outputPath: output });
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return errorResponse(error);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=titleCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"titleCard.js","sourceRoot":"","sources":["../../src/tools/titleCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAmB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IACrF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IAC1F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACpF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CA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,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { errorResponse, okResponse, ScreencastError } from "../utils/errors.js";
|
|
4
|
+
import { requireFfmpeg, runFfmpeg, probeMedia } from "../utils/ffmpeg.js";
|
|
5
|
+
import { buildXfadeArgs, DEFAULT_TRANSITION_DUR } from "../utils/produce.js";
|
|
6
|
+
import { resolveOutput, subdir, stamp, rand } from "../utils/paths.js";
|
|
7
|
+
const inputSchema = {
|
|
8
|
+
inputA: z.string().min(1).describe("Path to the first (outgoing) video."),
|
|
9
|
+
inputB: z.string().min(1).describe("Path to the second (incoming) video."),
|
|
10
|
+
transition: z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe("xfade transition name (default fade): fade, wipeleft, slideup, circleopen, dissolve, ..."),
|
|
14
|
+
duration: z
|
|
15
|
+
.number()
|
|
16
|
+
.positive()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe(`Transition length in seconds (default ${DEFAULT_TRANSITION_DUR}).`),
|
|
19
|
+
output: z.string().optional().describe("Optional output path. Defaults under SCREENCAST_HOME/edits."),
|
|
20
|
+
};
|
|
21
|
+
export function register(server) {
|
|
22
|
+
server.tool("xfade_transition", "Crossfade two videos into one with an xfade transition. Both clips are " +
|
|
23
|
+
"auto-normalized to a common resolution, fps, and audio rate first, so " +
|
|
24
|
+
"they need not match. Audio is crossfaded when both clips have a track.", inputSchema, async (args) => {
|
|
25
|
+
try {
|
|
26
|
+
requireFfmpeg();
|
|
27
|
+
for (const f of [args.inputA, args.inputB]) {
|
|
28
|
+
if (!existsSync(f))
|
|
29
|
+
throw new ScreencastError(`Input file not found: ${f}`);
|
|
30
|
+
}
|
|
31
|
+
const [a, b] = await Promise.all([probeMedia(args.inputA), probeMedia(args.inputB)]);
|
|
32
|
+
if (a.durationSec === null) {
|
|
33
|
+
throw new ScreencastError(`Could not read duration of ${args.inputA}.`);
|
|
34
|
+
}
|
|
35
|
+
const hasAudio = a.audioCodec !== null && b.audioCodec !== null;
|
|
36
|
+
const output = resolveOutput(args.output, subdir("edits"), `xfade-${stamp()}-${rand()}.mp4`);
|
|
37
|
+
const ffArgs = buildXfadeArgs(args.inputA, args.inputB, a.durationSec, output, { transition: args.transition, duration: args.duration }, hasAudio);
|
|
38
|
+
await runFfmpeg(ffArgs, 15 * 60_000);
|
|
39
|
+
return okResponse({ outputPath: output, audio: hasAudio });
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return errorResponse(error);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=xfadeTransition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xfadeTransition.js","sourceRoot":"","sources":["../../src/tools/xfadeTransition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,WAAW,GAAG;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,qCAAqC,CAAC;IACzE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IAC1E,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;S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,MAAM,CACjC,CAAC;YACF,MAAM,MAAM,GAAG,cAAc,CAC3B,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,CAAC,CAAC,WAAW,EACb,MAAM,EACN,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,EACxD,QAAQ,CACT,CAAC;YACF,MAAM,SAAS,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;YACrC,OAAO,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type FontWeight = "regular" | "bold";
|
|
2
|
+
/** Absolute path to a bundled Inter weight. The compiled file lives at
|
|
3
|
+
* dist/utils/fonts.js, so ../../assets/fonts is the package root. */
|
|
4
|
+
export declare function bundledFontPath(weight?: FontWeight): string;
|
|
5
|
+
/** Escape a filesystem path for an ffmpeg filtergraph option value (e.g. a
|
|
6
|
+
* drawtext fontfile / textfile). The value passes through two unescaping
|
|
7
|
+
* stages, so on Windows the drive colon must be double-escaped: forward slashes
|
|
8
|
+
* and `\\:`, turning `C:\Fonts\x.ttf` into `C\\:/Fonts/x.ttf`. This is the
|
|
9
|
+
* documented Windows incantation and is verified against ffmpeg. */
|
|
10
|
+
export declare function escapeFilterPath(p: string): string;
|
|
11
|
+
//# sourceMappingURL=fonts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/utils/fonts.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAO5C;qEACqE;AACrE,wBAAgB,eAAe,CAAC,MAAM,GAAE,UAAmB,GAAG,MAAM,CAInE;AAED;;;;oEAIoE;AACpE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundled font resolution and filtergraph path escaping.
|
|
3
|
+
*
|
|
4
|
+
* title_card renders text with ffmpeg's drawtext, which needs a real font file.
|
|
5
|
+
* Rather than guess at a system font, the package ships two static Inter weights
|
|
6
|
+
* (SIL Open Font License) under assets/fonts/. The path is resolved relative to
|
|
7
|
+
* the package root so it works the same from dist/ at runtime and from src/
|
|
8
|
+
* under tests, and is escaped for ffmpeg's filtergraph parser.
|
|
9
|
+
*/
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
const FONT_FILES = {
|
|
12
|
+
regular: "Inter-Regular.ttf",
|
|
13
|
+
bold: "Inter-Bold.ttf",
|
|
14
|
+
};
|
|
15
|
+
/** Absolute path to a bundled Inter weight. The compiled file lives at
|
|
16
|
+
* dist/utils/fonts.js, so ../../assets/fonts is the package root. */
|
|
17
|
+
export function bundledFontPath(weight = "bold") {
|
|
18
|
+
return fileURLToPath(new URL(`../../assets/fonts/${FONT_FILES[weight]}`, import.meta.url));
|
|
19
|
+
}
|
|
20
|
+
/** Escape a filesystem path for an ffmpeg filtergraph option value (e.g. a
|
|
21
|
+
* drawtext fontfile / textfile). The value passes through two unescaping
|
|
22
|
+
* stages, so on Windows the drive colon must be double-escaped: forward slashes
|
|
23
|
+
* and `\\:`, turning `C:\Fonts\x.ttf` into `C\\:/Fonts/x.ttf`. This is the
|
|
24
|
+
* documented Windows incantation and is verified against ffmpeg. */
|
|
25
|
+
export function escapeFilterPath(p) {
|
|
26
|
+
return p.replace(/\\/g, "/").replace(/:/g, "\\\\:");
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=fonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/utils/fonts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,MAAM,UAAU,GAA+B;IAC7C,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,gBAAgB;CACvB,CAAC;AAEF;qEACqE;AACrE,MAAM,UAAU,eAAe,CAAC,SAAqB,MAAM;IACzD,OAAO,aAAa,CAClB,IAAI,GAAG,CAAC,sBAAsB,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CACrE,CAAC;AACJ,CAAC;AAED;;;;oEAIoE;AACpE,MAAM,UAAU,gBAAgB,CAAC,CAAS;IACxC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type Quality } from "./targets.js";
|
|
2
|
+
export declare const DEFAULT_PRODUCE_WIDTH = 1920;
|
|
3
|
+
export declare const DEFAULT_PRODUCE_HEIGHT = 1080;
|
|
4
|
+
export declare const DEFAULT_PRODUCE_FPS = 30;
|
|
5
|
+
export declare const DEFAULT_AUDIO_RATE = 48000;
|
|
6
|
+
export declare const DEFAULT_TRANSITION_DUR = 1;
|
|
7
|
+
export interface NormalizeOpts {
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
fps?: number;
|
|
11
|
+
audioRate?: number;
|
|
12
|
+
quality?: Quality;
|
|
13
|
+
}
|
|
14
|
+
/** Video normalization chain: fit inside WxH, letterbox, square pixels, fixed
|
|
15
|
+
* fps, web-safe pixel format. Makes any clip compatible with concat / xfade. */
|
|
16
|
+
export declare function videoNormalizeChain(w: number, h: number, fps: number): string;
|
|
17
|
+
/** Audio normalization chain: common sample rate, stereo, float planar. */
|
|
18
|
+
export declare function audioNormalizeChain(rate: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Offsets for an xfade chain. Joining clip m (m >= 1) onto the running result,
|
|
21
|
+
* the transition starts at sum(d_0..d_{m-1}) - m*D. Returns one offset per join
|
|
22
|
+
* (length = durations.length - 1).
|
|
23
|
+
*/
|
|
24
|
+
export declare function xfadeOffsets(durations: number[], transitionDur: number): number[];
|
|
25
|
+
export interface XfadeOptions extends NormalizeOpts {
|
|
26
|
+
transition?: string;
|
|
27
|
+
duration?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Crossfade two clips. durA is the (probed) duration of the first clip, used
|
|
30
|
+
* for the xfade offset. hasAudio means both inputs carry audio. */
|
|
31
|
+
export declare function buildXfadeArgs(inputA: string, inputB: string, durA: number, output: string, opts?: XfadeOptions, hasAudio?: boolean): string[];
|
|
32
|
+
export interface AssembleOptions extends NormalizeOpts {
|
|
33
|
+
transition?: string;
|
|
34
|
+
duration?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Stitch N clips into one. transition "cut" uses the concat filter; any other
|
|
38
|
+
* value is an xfade transition name and chains xfade (video) + acrossfade
|
|
39
|
+
* (audio) using the supplied per-clip durations. hasAudio means every input
|
|
40
|
+
* carries audio.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildAssembleArgs(inputs: string[], durations: number[], output: string, opts?: AssembleOptions, hasAudio?: boolean): string[];
|
|
43
|
+
export interface TitleCardOptions {
|
|
44
|
+
width?: number;
|
|
45
|
+
height?: number;
|
|
46
|
+
duration?: number;
|
|
47
|
+
fps?: number;
|
|
48
|
+
bg?: string;
|
|
49
|
+
fontColor?: string;
|
|
50
|
+
fontSize?: number;
|
|
51
|
+
quality?: Quality;
|
|
52
|
+
}
|
|
53
|
+
/** Generate a standalone title clip: a solid background with centered text from
|
|
54
|
+
* a font file and a temp text file (so arbitrary text needs no inline
|
|
55
|
+
* escaping), plus a silent stereo track so it composes with audio-bearing
|
|
56
|
+
* clips. Caller resolves fontFile (a bundled weight) and writes textFile. */
|
|
57
|
+
export declare function buildTitleCardArgs(textFile: string, fontFile: string, output: string, opts?: TitleCardOptions): string[];
|
|
58
|
+
export interface MusicBedOptions {
|
|
59
|
+
musicVolume?: number;
|
|
60
|
+
fadeIn?: number;
|
|
61
|
+
fadeOut?: number;
|
|
62
|
+
duck?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** Lay a music track under a video: loop/trim the music to the video duration,
|
|
65
|
+
* fade it in/out, and set its level. When the video already has audio the two
|
|
66
|
+
* are mixed (optionally ducking the music under the original via a sidechain).
|
|
67
|
+
* The video stream is copied; only audio is re-encoded. */
|
|
68
|
+
export declare function buildMusicBedArgs(video: string, music: string, output: string, videoDuration: number, hasVideoAudio: boolean, opts?: MusicBedOptions): string[];
|
|
69
|
+
//# sourceMappingURL=produce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"produce.d.ts","sourceRoot":"","sources":["../../src/utils/produce.ts"],"names":[],"mappings":"AAUA,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5D,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAGxC,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD;gFACgF;AAChF,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7E;AAED,2E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AAE,MAAM,EACd,IAAI,GAAE,gBAAqB,GAC1B,MAAM,EAAE,CA+BV;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;2DAG2D;AAC3D,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,OAAO,EACtB,IAAI,GAAE,eAAoB,GACzB,MAAM,EAAE,CA0CV"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 3 produce / trailer-layer argument builders.
|
|
3
|
+
*
|
|
4
|
+
* These stitch, title, score, and reframe finished pieces. They re-encode (the
|
|
5
|
+
* filters rewrite frames) and, where they combine clips, normalize every input
|
|
6
|
+
* to a common resolution / fps / SAR / audio rate first so heterogeneous
|
|
7
|
+
* sources compose cleanly. All builders are pure (string in, args out) and are
|
|
8
|
+
* unit-tested without ffmpeg present.
|
|
9
|
+
*/
|
|
10
|
+
import { ScreencastError } from "./errors.js";
|
|
11
|
+
import { resolveQuality } from "./targets.js";
|
|
12
|
+
import { escapeFilterPath } from "./fonts.js";
|
|
13
|
+
export const DEFAULT_PRODUCE_WIDTH = 1920;
|
|
14
|
+
export const DEFAULT_PRODUCE_HEIGHT = 1080;
|
|
15
|
+
export const DEFAULT_PRODUCE_FPS = 30;
|
|
16
|
+
export const DEFAULT_AUDIO_RATE = 48000;
|
|
17
|
+
export const DEFAULT_TRANSITION_DUR = 1;
|
|
18
|
+
const DEFAULT_QUALITY = "standard";
|
|
19
|
+
function round3(n) {
|
|
20
|
+
return Math.round(n * 1000) / 1000;
|
|
21
|
+
}
|
|
22
|
+
/** Video normalization chain: fit inside WxH, letterbox, square pixels, fixed
|
|
23
|
+
* fps, web-safe pixel format. Makes any clip compatible with concat / xfade. */
|
|
24
|
+
export function videoNormalizeChain(w, h, fps) {
|
|
25
|
+
return (`scale=${w}:${h}:force_original_aspect_ratio=decrease,` +
|
|
26
|
+
`pad=${w}:${h}:(ow-iw)/2:(oh-ih)/2,setsar=1,fps=${fps},format=yuv420p`);
|
|
27
|
+
}
|
|
28
|
+
/** Audio normalization chain: common sample rate, stereo, float planar. */
|
|
29
|
+
export function audioNormalizeChain(rate) {
|
|
30
|
+
return `aresample=${rate},aformat=sample_fmts=fltp:channel_layouts=stereo`;
|
|
31
|
+
}
|
|
32
|
+
function encodeArgs(quality) {
|
|
33
|
+
return resolveQuality(quality);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Offsets for an xfade chain. Joining clip m (m >= 1) onto the running result,
|
|
37
|
+
* the transition starts at sum(d_0..d_{m-1}) - m*D. Returns one offset per join
|
|
38
|
+
* (length = durations.length - 1).
|
|
39
|
+
*/
|
|
40
|
+
export function xfadeOffsets(durations, transitionDur) {
|
|
41
|
+
const offsets = [];
|
|
42
|
+
let running = 0;
|
|
43
|
+
for (let m = 1; m < durations.length; m++) {
|
|
44
|
+
running += durations[m - 1];
|
|
45
|
+
offsets.push(Math.max(0, round3(running - m * transitionDur)));
|
|
46
|
+
}
|
|
47
|
+
return offsets;
|
|
48
|
+
}
|
|
49
|
+
/** Crossfade two clips. durA is the (probed) duration of the first clip, used
|
|
50
|
+
* for the xfade offset. hasAudio means both inputs carry audio. */
|
|
51
|
+
export function buildXfadeArgs(inputA, inputB, durA, output, opts = {}, hasAudio = false) {
|
|
52
|
+
const w = opts.width ?? DEFAULT_PRODUCE_WIDTH;
|
|
53
|
+
const h = opts.height ?? DEFAULT_PRODUCE_HEIGHT;
|
|
54
|
+
const fps = opts.fps ?? DEFAULT_PRODUCE_FPS;
|
|
55
|
+
const rate = opts.audioRate ?? DEFAULT_AUDIO_RATE;
|
|
56
|
+
const transition = opts.transition ?? "fade";
|
|
57
|
+
const d = opts.duration ?? DEFAULT_TRANSITION_DUR;
|
|
58
|
+
if (!Number.isFinite(d) || d <= 0) {
|
|
59
|
+
throw new ScreencastError("transition duration must be a positive number.");
|
|
60
|
+
}
|
|
61
|
+
if (!Number.isFinite(durA) || durA <= d) {
|
|
62
|
+
throw new ScreencastError(`first clip (${durA}s) must be longer than the transition (${d}s).`);
|
|
63
|
+
}
|
|
64
|
+
const offset = round3(durA - d);
|
|
65
|
+
const vf = videoNormalizeChain(w, h, fps);
|
|
66
|
+
const af = audioNormalizeChain(rate);
|
|
67
|
+
const parts = [
|
|
68
|
+
`[0:v]${vf}[v0]`,
|
|
69
|
+
`[1:v]${vf}[v1]`,
|
|
70
|
+
`[v0][v1]xfade=transition=${transition}:duration=${d}:offset=${offset}[vout]`,
|
|
71
|
+
];
|
|
72
|
+
const maps = ["-map", "[vout]"];
|
|
73
|
+
if (hasAudio) {
|
|
74
|
+
parts.push(`[0:a]${af}[a0]`, `[1:a]${af}[a1]`, `[a0][a1]acrossfade=d=${d}[aout]`);
|
|
75
|
+
maps.push("-map", "[aout]");
|
|
76
|
+
}
|
|
77
|
+
return [
|
|
78
|
+
"-y", "-i", inputA, "-i", inputB,
|
|
79
|
+
"-filter_complex", parts.join(";"),
|
|
80
|
+
...maps,
|
|
81
|
+
...encodeArgs(opts.quality ?? DEFAULT_QUALITY),
|
|
82
|
+
...(hasAudio ? ["-c:a", "aac", "-b:a", "160k"] : ["-an"]),
|
|
83
|
+
"-movflags", "+faststart",
|
|
84
|
+
output,
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Stitch N clips into one. transition "cut" uses the concat filter; any other
|
|
89
|
+
* value is an xfade transition name and chains xfade (video) + acrossfade
|
|
90
|
+
* (audio) using the supplied per-clip durations. hasAudio means every input
|
|
91
|
+
* carries audio.
|
|
92
|
+
*/
|
|
93
|
+
export function buildAssembleArgs(inputs, durations, output, opts = {}, hasAudio = false) {
|
|
94
|
+
if (inputs.length < 2) {
|
|
95
|
+
throw new ScreencastError("assemble_highlights requires at least two clips.");
|
|
96
|
+
}
|
|
97
|
+
const w = opts.width ?? DEFAULT_PRODUCE_WIDTH;
|
|
98
|
+
const h = opts.height ?? DEFAULT_PRODUCE_HEIGHT;
|
|
99
|
+
const fps = opts.fps ?? DEFAULT_PRODUCE_FPS;
|
|
100
|
+
const rate = opts.audioRate ?? DEFAULT_AUDIO_RATE;
|
|
101
|
+
const transition = opts.transition ?? "cut";
|
|
102
|
+
const d = opts.duration ?? DEFAULT_TRANSITION_DUR;
|
|
103
|
+
const n = inputs.length;
|
|
104
|
+
const vf = videoNormalizeChain(w, h, fps);
|
|
105
|
+
const af = audioNormalizeChain(rate);
|
|
106
|
+
const parts = [];
|
|
107
|
+
for (let i = 0; i < n; i++) {
|
|
108
|
+
parts.push(`[${i}:v]${vf}[v${i}]`);
|
|
109
|
+
if (hasAudio)
|
|
110
|
+
parts.push(`[${i}:a]${af}[a${i}]`);
|
|
111
|
+
}
|
|
112
|
+
const maps = [];
|
|
113
|
+
if (transition === "cut") {
|
|
114
|
+
if (hasAudio) {
|
|
115
|
+
const labels = inputs.map((_, i) => `[v${i}][a${i}]`).join("");
|
|
116
|
+
parts.push(`${labels}concat=n=${n}:v=1:a=1[vout][aout]`);
|
|
117
|
+
maps.push("-map", "[vout]", "-map", "[aout]");
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const labels = inputs.map((_, i) => `[v${i}]`).join("");
|
|
121
|
+
parts.push(`${labels}concat=n=${n}:v=1:a=0[vout]`);
|
|
122
|
+
maps.push("-map", "[vout]");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
if (durations.length !== n) {
|
|
127
|
+
throw new ScreencastError(`a ${transition} transition needs a duration for each of the ${n} clips.`);
|
|
128
|
+
}
|
|
129
|
+
if (!Number.isFinite(d) || d <= 0) {
|
|
130
|
+
throw new ScreencastError("transition duration must be a positive number.");
|
|
131
|
+
}
|
|
132
|
+
const offsets = xfadeOffsets(durations, d);
|
|
133
|
+
let vPrev = "v0";
|
|
134
|
+
for (let m = 1; m < n; m++) {
|
|
135
|
+
const out = m === n - 1 ? "vout" : `vx${m}`;
|
|
136
|
+
parts.push(`[${vPrev}][v${m}]xfade=transition=${transition}:duration=${d}:offset=${offsets[m - 1]}[${out}]`);
|
|
137
|
+
vPrev = out;
|
|
138
|
+
}
|
|
139
|
+
maps.push("-map", "[vout]");
|
|
140
|
+
if (hasAudio) {
|
|
141
|
+
let aPrev = "a0";
|
|
142
|
+
for (let m = 1; m < n; m++) {
|
|
143
|
+
const out = m === n - 1 ? "aout" : `ax${m}`;
|
|
144
|
+
parts.push(`[${aPrev}][a${m}]acrossfade=d=${d}[${out}]`);
|
|
145
|
+
aPrev = out;
|
|
146
|
+
}
|
|
147
|
+
maps.push("-map", "[aout]");
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return [
|
|
151
|
+
"-y",
|
|
152
|
+
...inputs.flatMap((f) => ["-i", f]),
|
|
153
|
+
"-filter_complex", parts.join(";"),
|
|
154
|
+
...maps,
|
|
155
|
+
...encodeArgs(opts.quality ?? DEFAULT_QUALITY),
|
|
156
|
+
...(hasAudio ? ["-c:a", "aac", "-b:a", "160k"] : ["-an"]),
|
|
157
|
+
"-movflags", "+faststart",
|
|
158
|
+
output,
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
/** Generate a standalone title clip: a solid background with centered text from
|
|
162
|
+
* a font file and a temp text file (so arbitrary text needs no inline
|
|
163
|
+
* escaping), plus a silent stereo track so it composes with audio-bearing
|
|
164
|
+
* clips. Caller resolves fontFile (a bundled weight) and writes textFile. */
|
|
165
|
+
export function buildTitleCardArgs(textFile, fontFile, output, opts = {}) {
|
|
166
|
+
const w = opts.width ?? DEFAULT_PRODUCE_WIDTH;
|
|
167
|
+
const h = opts.height ?? DEFAULT_PRODUCE_HEIGHT;
|
|
168
|
+
const dur = opts.duration ?? 3;
|
|
169
|
+
const fps = opts.fps ?? DEFAULT_PRODUCE_FPS;
|
|
170
|
+
const bg = opts.bg ?? "black";
|
|
171
|
+
const fontColor = opts.fontColor ?? "white";
|
|
172
|
+
const fontSize = opts.fontSize ?? 96;
|
|
173
|
+
if (!Number.isFinite(dur) || dur <= 0) {
|
|
174
|
+
throw new ScreencastError("title duration must be a positive number.");
|
|
175
|
+
}
|
|
176
|
+
if (!Number.isInteger(fontSize) || fontSize <= 0) {
|
|
177
|
+
throw new ScreencastError("fontSize must be a positive integer.");
|
|
178
|
+
}
|
|
179
|
+
const draw = `drawtext=fontfile=${escapeFilterPath(fontFile)}:` +
|
|
180
|
+
`textfile=${escapeFilterPath(textFile)}:` +
|
|
181
|
+
`fontcolor=${fontColor}:fontsize=${fontSize}:` +
|
|
182
|
+
`x=(w-text_w)/2:y=(h-text_h)/2:` +
|
|
183
|
+
`shadowcolor=black@0.5:shadowx=2:shadowy=2`;
|
|
184
|
+
return [
|
|
185
|
+
"-y",
|
|
186
|
+
"-f", "lavfi", "-i", `color=c=${bg}:s=${w}x${h}:d=${dur}:r=${fps}`,
|
|
187
|
+
"-f", "lavfi", "-i", "anullsrc=channel_layout=stereo:sample_rate=48000",
|
|
188
|
+
"-vf", draw,
|
|
189
|
+
"-shortest",
|
|
190
|
+
...encodeArgs(opts.quality ?? DEFAULT_QUALITY),
|
|
191
|
+
"-c:a", "aac", "-b:a", "160k",
|
|
192
|
+
"-movflags", "+faststart",
|
|
193
|
+
output,
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
/** Lay a music track under a video: loop/trim the music to the video duration,
|
|
197
|
+
* fade it in/out, and set its level. When the video already has audio the two
|
|
198
|
+
* are mixed (optionally ducking the music under the original via a sidechain).
|
|
199
|
+
* The video stream is copied; only audio is re-encoded. */
|
|
200
|
+
export function buildMusicBedArgs(video, music, output, videoDuration, hasVideoAudio, opts = {}) {
|
|
201
|
+
if (!Number.isFinite(videoDuration) || videoDuration <= 0) {
|
|
202
|
+
throw new ScreencastError("video duration must be known and positive.");
|
|
203
|
+
}
|
|
204
|
+
const vol = opts.musicVolume ?? (hasVideoAudio ? 0.25 : 0.8);
|
|
205
|
+
const fin = opts.fadeIn ?? 1;
|
|
206
|
+
const fout = opts.fadeOut ?? 2;
|
|
207
|
+
for (const [v, label] of [[vol, "musicVolume"], [fin, "fadeIn"], [fout, "fadeOut"]]) {
|
|
208
|
+
if (!Number.isFinite(v) || v < 0) {
|
|
209
|
+
throw new ScreencastError(`${label} must be a non-negative number.`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const duck = opts.duck ?? false;
|
|
213
|
+
const fadeOutStart = Math.max(0, round3(videoDuration - fout));
|
|
214
|
+
const musicChain = `[1:a]afade=t=in:st=0:d=${fin},afade=t=out:st=${fadeOutStart}:d=${fout},volume=${vol}`;
|
|
215
|
+
const parts = [];
|
|
216
|
+
if (hasVideoAudio) {
|
|
217
|
+
parts.push(`${musicChain}[music]`);
|
|
218
|
+
if (duck) {
|
|
219
|
+
parts.push("[music][0:a]sidechaincompress=threshold=0.03:ratio=8:attack=20:release=300[ducked]");
|
|
220
|
+
parts.push("[0:a][ducked]amix=inputs=2:duration=first:dropout_transition=0[aout]");
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
parts.push("[0:a][music]amix=inputs=2:duration=first:dropout_transition=0[aout]");
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
parts.push(`${musicChain}[aout]`);
|
|
228
|
+
}
|
|
229
|
+
return [
|
|
230
|
+
"-y",
|
|
231
|
+
"-i", video,
|
|
232
|
+
"-stream_loop", "-1", "-i", music,
|
|
233
|
+
"-filter_complex", parts.join(";"),
|
|
234
|
+
"-map", "0:v", "-map", "[aout]",
|
|
235
|
+
"-t", String(videoDuration),
|
|
236
|
+
"-c:v", "copy",
|
|
237
|
+
"-c:a", "aac", "-b:a", "192k",
|
|
238
|
+
"-movflags", "+faststart",
|
|
239
|
+
output,
|
|
240
|
+
];
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=produce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"produce.js","sourceRoot":"","sources":["../../src/utils/produce.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAgB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAC3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,eAAe,GAAY,UAAU,CAAC;AAU5C,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;AACrC,CAAC;AAED;gFACgF;AAChF,MAAM,UAAU,mBAAmB,CAAC,CAAS,EAAE,CAAS,EAAE,GAAW;IACnE,OAAO,CACL,SAAS,CAAC,IAAI,CAAC,wCAAwC;QACvD,OAAO,CAAC,IAAI,CAAC,qCAAqC,GAAG,iBAAiB,CACvE,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,aAAa,IAAI,kDAAkD,CAAC;AAC7E,CAAC;AAED,SAAS,UAAU,CAAC,OAAgB;IAClC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,SAAmB,EAAE,aAAqB;IACrE,MAAM,OAAO,GA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AC;QAClB,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,SAAS,CAAC,CAAC;QACnC,IAAI,IAAI,EAAE,CAAC;YACT,KAAK,CAAC,IAAI,CAAC,oFAAoF,CAAC,CAAC;YACjG,KAAK,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;QACrF,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,KAAK;QACX,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK;QACjC,iBAAiB,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QAClC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ;QAC/B,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC;QAC3B,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM;QAC7B,WAAW,EAAE,YAAY;QACzB,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmhs/screencast-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "MCP server for Windows screen recording, frame sampling, and minimal ffmpeg edits",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
+
"assets",
|
|
12
13
|
"README.md",
|
|
13
14
|
"LICENSE"
|
|
14
15
|
],
|