@softure-ai/marketing-kit 0.3.1 → 0.5.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.
Files changed (126) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +135 -14
  3. package/dist/cli/footage.d.ts.map +1 -1
  4. package/dist/cli/footage.js +15 -6
  5. package/dist/cli/footage.js.map +1 -1
  6. package/dist/config/actions-schema.d.ts +14 -14
  7. package/dist/config/config.d.ts.map +1 -1
  8. package/dist/config/config.js +5 -0
  9. package/dist/config/config.js.map +1 -1
  10. package/dist/config/schema.d.ts +92 -69
  11. package/dist/config/schema.d.ts.map +1 -1
  12. package/dist/config/schema.js +40 -4
  13. package/dist/config/schema.js.map +1 -1
  14. package/dist/config/shot-steps.d.ts +16 -16
  15. package/dist/footage/audio.d.ts +52 -0
  16. package/dist/footage/audio.d.ts.map +1 -0
  17. package/dist/footage/audio.js +100 -0
  18. package/dist/footage/audio.js.map +1 -0
  19. package/dist/footage/captions.d.ts +57 -0
  20. package/dist/footage/captions.d.ts.map +1 -0
  21. package/dist/footage/captions.js +112 -0
  22. package/dist/footage/captions.js.map +1 -0
  23. package/dist/footage/compose.d.ts +5 -5
  24. package/dist/footage/compose.d.ts.map +1 -1
  25. package/dist/footage/compose.js +31 -22
  26. package/dist/footage/compose.js.map +1 -1
  27. package/dist/footage/edl.d.ts +54 -16
  28. package/dist/footage/edl.d.ts.map +1 -1
  29. package/dist/footage/edl.js +204 -52
  30. package/dist/footage/edl.js.map +1 -1
  31. package/dist/footage/elevenlabs.d.ts +4 -1
  32. package/dist/footage/elevenlabs.d.ts.map +1 -1
  33. package/dist/footage/elevenlabs.js +18 -6
  34. package/dist/footage/elevenlabs.js.map +1 -1
  35. package/dist/footage/fake.d.ts +2 -0
  36. package/dist/footage/fake.d.ts.map +1 -1
  37. package/dist/footage/fake.js +2 -1
  38. package/dist/footage/fake.js.map +1 -1
  39. package/dist/footage/film.d.ts +35 -1
  40. package/dist/footage/film.d.ts.map +1 -1
  41. package/dist/footage/film.js +9 -1
  42. package/dist/footage/film.js.map +1 -1
  43. package/dist/footage/frames.d.ts +38 -0
  44. package/dist/footage/frames.d.ts.map +1 -0
  45. package/dist/footage/frames.js +40 -0
  46. package/dist/footage/frames.js.map +1 -0
  47. package/dist/footage/loudness.d.ts +49 -0
  48. package/dist/footage/loudness.d.ts.map +1 -0
  49. package/dist/footage/loudness.js +114 -0
  50. package/dist/footage/loudness.js.map +1 -0
  51. package/dist/footage/normalize.d.ts +6 -2
  52. package/dist/footage/normalize.d.ts.map +1 -1
  53. package/dist/footage/normalize.js +7 -9
  54. package/dist/footage/normalize.js.map +1 -1
  55. package/dist/footage/paid.d.ts +70 -0
  56. package/dist/footage/paid.d.ts.map +1 -0
  57. package/dist/footage/paid.js +172 -0
  58. package/dist/footage/paid.js.map +1 -0
  59. package/dist/footage/pipeline.d.ts +34 -10
  60. package/dist/footage/pipeline.d.ts.map +1 -1
  61. package/dist/footage/pipeline.js +294 -85
  62. package/dist/footage/pipeline.js.map +1 -1
  63. package/dist/footage/probe.d.ts +18 -4
  64. package/dist/footage/probe.d.ts.map +1 -1
  65. package/dist/footage/probe.js +18 -13
  66. package/dist/footage/probe.js.map +1 -1
  67. package/dist/footage/process.d.ts +45 -0
  68. package/dist/footage/process.d.ts.map +1 -0
  69. package/dist/footage/process.js +109 -0
  70. package/dist/footage/process.js.map +1 -0
  71. package/dist/footage/providers.d.ts +49 -5
  72. package/dist/footage/providers.d.ts.map +1 -1
  73. package/dist/footage/providers.js +4 -0
  74. package/dist/footage/providers.js.map +1 -1
  75. package/dist/footage/publish.d.ts +62 -0
  76. package/dist/footage/publish.d.ts.map +1 -0
  77. package/dist/footage/publish.js +164 -0
  78. package/dist/footage/publish.js.map +1 -0
  79. package/dist/footage/render.d.ts +5 -4
  80. package/dist/footage/render.d.ts.map +1 -1
  81. package/dist/footage/render.js +29 -17
  82. package/dist/footage/render.js.map +1 -1
  83. package/dist/footage/sentences.d.ts +44 -0
  84. package/dist/footage/sentences.d.ts.map +1 -0
  85. package/dist/footage/sentences.js +102 -0
  86. package/dist/footage/sentences.js.map +1 -0
  87. package/dist/footage/tools.d.ts +33 -0
  88. package/dist/footage/tools.d.ts.map +1 -0
  89. package/dist/footage/tools.js +108 -0
  90. package/dist/footage/tools.js.map +1 -0
  91. package/dist/footage/words.d.ts +6 -0
  92. package/dist/footage/words.d.ts.map +1 -0
  93. package/dist/footage/words.js +14 -0
  94. package/dist/footage/words.js.map +1 -0
  95. package/dist/index.d.ts +15 -6
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +15 -6
  98. package/dist/index.js.map +1 -1
  99. package/docker/footage-worker.Dockerfile +29 -0
  100. package/package.json +2 -1
  101. package/schema/edl.schema.json +115 -0
  102. package/schema/marketing.schema.json +112 -5
  103. package/src/cli/footage.ts +13 -5
  104. package/src/config/config.ts +5 -0
  105. package/src/config/schema.ts +40 -4
  106. package/src/footage/audio.ts +123 -0
  107. package/src/footage/captions.ts +146 -0
  108. package/src/footage/compose.ts +32 -24
  109. package/src/footage/edl.ts +225 -56
  110. package/src/footage/elevenlabs.ts +21 -8
  111. package/src/footage/fake.ts +4 -1
  112. package/src/footage/film.ts +43 -2
  113. package/src/footage/frames.ts +65 -0
  114. package/src/footage/loudness.ts +143 -0
  115. package/src/footage/normalize.ts +7 -9
  116. package/src/footage/paid.ts +213 -0
  117. package/src/footage/pipeline.ts +344 -89
  118. package/src/footage/probe.ts +20 -12
  119. package/src/footage/process.ts +135 -0
  120. package/src/footage/providers.ts +56 -6
  121. package/src/footage/publish.ts +180 -0
  122. package/src/footage/render.ts +29 -19
  123. package/src/footage/sentences.ts +137 -0
  124. package/src/footage/tools.ts +119 -0
  125. package/src/footage/words.ts +15 -0
  126. package/src/index.ts +84 -0
@@ -0,0 +1,100 @@
1
+ import { extname } from "node:path";
2
+ import { z } from "zod";
3
+ import { runFfprobe } from "./probe.js";
4
+ /**
5
+ * Music beds: the audio files an app accepts to lay quietly under the voice. One list of accepted types, checked the
6
+ * same way by an app's upload and by the footage pipeline's `music.file`, and an ffprobe reading of what is inside.
7
+ */
8
+ /** Accepted music file extensions and the content types a browser or a storage reports for each. */
9
+ export const MUSIC_FILE_TYPES = {
10
+ ".mp3": ["audio/mpeg", "audio/mp3"],
11
+ ".m4a": ["audio/mp4", "audio/x-m4a", "audio/m4a"],
12
+ ".aac": ["audio/aac"],
13
+ ".wav": ["audio/wav", "audio/x-wav", "audio/wave", "audio/vnd.wave"],
14
+ ".ogg": ["audio/ogg"],
15
+ ".oga": ["audio/ogg"],
16
+ ".opus": ["audio/opus", "audio/ogg"],
17
+ ".flac": ["audio/flac", "audio/x-flac"],
18
+ };
19
+ const ACCEPTED_LIST = Object.keys(MUSIC_FILE_TYPES).join(", ");
20
+ function normalizeContentType(contentType) {
21
+ return (contentType.split(";")[0] ?? "").trim().toLowerCase();
22
+ }
23
+ function getAcceptedTypes(extension) {
24
+ return Object.hasOwn(MUSIC_FILE_TYPES, extension) ? (MUSIC_FILE_TYPES[extension] ?? null) : null;
25
+ }
26
+ /**
27
+ * Whether a file is an accepted music bed by its name (or path) and its content type. Give either or both; with both,
28
+ * the content type must be one of the extension's. Parameters (`; codecs=…`) and letter case are ignored.
29
+ */
30
+ export function checkMusicFileType(input) {
31
+ const extension = input.fileName === undefined ? null : extname(input.fileName).toLowerCase();
32
+ const contentType = input.contentType === undefined ? null : normalizeContentType(input.contentType);
33
+ if (extension === null && contentType === null)
34
+ return { ok: false, error: "a music file needs a file name or a content type to check" };
35
+ if (extension !== null) {
36
+ const types = getAcceptedTypes(extension);
37
+ if (types === null)
38
+ return { ok: false, error: `${input.fileName ?? ""}: not a music file (accepted: ${ACCEPTED_LIST})` };
39
+ if (contentType !== null && !types.includes(contentType))
40
+ return { ok: false, error: `${input.fileName ?? ""}: content type ${contentType} does not match ${extension} (expected ${types.join(" or ")})` };
41
+ return { ok: true, extension, contentType };
42
+ }
43
+ const isAccepted = Object.values(MUSIC_FILE_TYPES).some((types) => contentType !== null && types.includes(contentType));
44
+ return isAccepted ? { ok: true, extension: null, contentType } : { ok: false, error: `content type ${contentType ?? ""} is not a music file (accepted: ${ACCEPTED_LIST})` };
45
+ }
46
+ const audioStreamSchema = z.looseObject({
47
+ codec_type: z.string().optional(),
48
+ codec_name: z.string().optional(),
49
+ sample_rate: z.string().optional(),
50
+ channels: z.number().optional(),
51
+ bit_rate: z.string().optional(),
52
+ duration: z.string().optional(),
53
+ });
54
+ const audioProbeSchema = z.looseObject({
55
+ streams: z.array(audioStreamSchema).default([]),
56
+ format: z.looseObject({ duration: z.string().optional(), bit_rate: z.string().optional() }).optional(),
57
+ });
58
+ function readPositive(value) {
59
+ const number = Number(value);
60
+ return value !== undefined && Number.isFinite(number) && number > 0 ? number : null;
61
+ }
62
+ /** ffprobe's JSON (`-show_streams -show_format -of json`) read as a music bed: the first audio stream, cover art ignored. */
63
+ export function readAudioProbe(json) {
64
+ const parsed = audioProbeSchema.safeParse(json);
65
+ if (!parsed.success)
66
+ return { ok: false, reason: "unexpected-output", error: "ffprobe printed an unexpected shape" };
67
+ const { streams, format } = parsed.data;
68
+ const audio = streams.find((stream) => stream.codec_type === "audio");
69
+ if (audio === undefined)
70
+ return { ok: false, reason: "no-audio-stream", error: "no audio stream" };
71
+ const duration = readPositive(format?.duration) ?? readPositive(audio.duration);
72
+ if (duration === null)
73
+ return { ok: false, reason: "no-duration", error: "no duration" };
74
+ return {
75
+ ok: true,
76
+ probe: {
77
+ duration,
78
+ codec: audio.codec_name ?? "unknown",
79
+ sampleRate: readPositive(audio.sample_rate) ?? 0,
80
+ channels: audio.channels ?? 0,
81
+ bitRate: readPositive(audio.bit_rate) ?? readPositive(format?.bit_rate),
82
+ },
83
+ };
84
+ }
85
+ /** Probes one music file (or URL) with ffprobe; a failure carries its reason and names the file. Rejects only on abort. */
86
+ export async function probeAudio(path, options = {}) {
87
+ const output = await runFfprobe(path, options);
88
+ if (!output.ok)
89
+ return { ok: false, reason: "unreadable", error: output.error };
90
+ const read = readAudioProbe(output.json);
91
+ return read.ok ? read : { ...read, error: `${path}: ${read.error}` };
92
+ }
93
+ /** One line about a probed music file, for the log. */
94
+ export function describeAudioProbe(probe) {
95
+ const parts = [probe.codec, `${probe.duration.toFixed(1)} s`, `${String(probe.sampleRate)} Hz`, probe.channels === 1 ? "mono" : `${String(probe.channels)} channels`];
96
+ if (probe.bitRate !== null)
97
+ parts.push(`${String(Math.round(probe.bitRate / 1000))} kb/s`);
98
+ return parts.join(", ");
99
+ }
100
+ //# sourceMappingURL=audio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio.js","sourceRoot":"","sources":["../../src/footage/audio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AAEH,oGAAoG;AACpG,MAAM,CAAC,MAAM,gBAAgB,GAAgD;IAC3E,MAAM,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IACnC,MAAM,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,WAAW,CAAC;IACjD,MAAM,EAAE,CAAC,WAAW,CAAC;IACrB,MAAM,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,CAAC;IACpE,MAAM,EAAE,CAAC,WAAW,CAAC;IACrB,MAAM,EAAE,CAAC,WAAW,CAAC;IACrB,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IACpC,OAAO,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;CACxC,CAAC;AAIF,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE/D,SAAS,oBAAoB,CAAC,WAAmB;IAC/C,OAAO,CAAC,WAAW,CAAC,KAAK,CAA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,CAAC,CAAC;IACtK,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC;IAC3F,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { CaptionLayout } from "../compose/timeline.js";
2
+ import type { BrandFont } from "../config/config.js";
3
+ import type { TimedWord } from "../voice/voiceover.js";
4
+ import type { CaptionPreset } from "./film.js";
5
+ /**
6
+ * The footage film's captions: plain phrases (the default style), the 9:16 caption box inside a platform's safe zone,
7
+ * and a check that the caption and end-card fonts draw every letter the film shows (Polish letters above all), since
8
+ * the browser would quietly draw a missing one in another font.
9
+ */
10
+ export interface PhraseChunk {
11
+ words: TimedWord[];
12
+ start: number;
13
+ end: number;
14
+ }
15
+ /**
16
+ * The words as phrases of 2-6: a phrase ends at punctuation, after six words or at a pause; a single word left alone
17
+ * joins the phrase before it when that one has room and no pause separates them.
18
+ */
19
+ export declare function phraseChunks(words: TimedWord[]): PhraseChunk[];
20
+ /** Margins of a 1080×1920 frame that a platform's own buttons and text cover. */
21
+ export interface SafeZone {
22
+ top: number;
23
+ bottom: number;
24
+ left: number;
25
+ right: number;
26
+ }
27
+ /**
28
+ * The areas each platform keeps for its interface on a 9:16 video, rounded up from the platforms' creator guides; `all`
29
+ * is the zone that is safe on every one of them.
30
+ */
31
+ export declare const CAPTION_SAFE_ZONES: Record<CaptionPreset, SafeZone>;
32
+ /** The caption box of a 9:16 film with its bottom line kept above the preset's bottom margin, centred between equal sides. */
33
+ export declare function getCaptionPresetLayout(preset: CaptionPreset, fontSize: number): CaptionLayout;
34
+ /** A character a font is asked to draw and does not have. */
35
+ export interface MissingCaptionGlyphs {
36
+ /** The family, as `brand.fonts` names it. */
37
+ font: string;
38
+ characters: string[];
39
+ }
40
+ /**
41
+ * Glyphs the film's fonts lack: the body font against the captions and the end card's url and note, the heading font
42
+ * (the body font without one) against the brand name and the headline. Empty when every letter is drawn.
43
+ */
44
+ export declare function findMissingCaptionGlyphs(input: {
45
+ fonts: {
46
+ heading: BrandFont | null;
47
+ body: BrandFont | null;
48
+ };
49
+ captions: string[];
50
+ endCard: {
51
+ headline: string;
52
+ url: string;
53
+ note: string;
54
+ } | null;
55
+ brandName: string;
56
+ }, read?: (path: string) => Buffer): MissingCaptionGlyphs[];
57
+ //# sourceMappingURL=captions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captions.d.ts","sourceRoot":"","sources":["../../src/footage/captions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;GAIG;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAOD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,WAAW,EAAE,CA0B9D;AAED,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,aAAa,EAAE,QAAQ,CAK9D,CAAC;AAOF,8HAA8H;AAC9H,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,CAK7F;AAED,6DAA6D;AAC7D,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAkCD;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE;IAAE,KAAK,EAAE;QAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;KAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAC/K,IAAI,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAqB,GAC5C,oBAAoB,EAAE,CAUxB"}
@@ -0,0 +1,112 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { readCharacterMap } from "../og/character-map.js";
3
+ const MIN_PHRASE_WORDS = 2;
4
+ const MAX_PHRASE_WORDS = 6;
5
+ /** A silence this long between two words starts a new phrase. */
6
+ const PHRASE_GAP_SECONDS = 0.7;
7
+ /**
8
+ * The words as phrases of 2-6: a phrase ends at punctuation, after six words or at a pause; a single word left alone
9
+ * joins the phrase before it when that one has room and no pause separates them.
10
+ */
11
+ export function phraseChunks(words) {
12
+ const groups = [];
13
+ let current = [];
14
+ words.forEach((word, index) => {
15
+ const previous = words[index - 1];
16
+ if (current.length > 0 && previous !== undefined && word.start - previous.end > PHRASE_GAP_SECONDS) {
17
+ groups.push(current);
18
+ current = [];
19
+ }
20
+ current.push(word);
21
+ if (/[.,?!:;…]$/u.test(word.text) || current.length === MAX_PHRASE_WORDS) {
22
+ groups.push(current);
23
+ current = [];
24
+ }
25
+ });
26
+ if (current.length > 0)
27
+ groups.push(current);
28
+ const merged = [];
29
+ for (const group of groups) {
30
+ const previous = merged.at(-1);
31
+ const first = group[0];
32
+ const last = previous?.at(-1);
33
+ const isClose = last !== undefined && first.start - last.end <= PHRASE_GAP_SECONDS;
34
+ if (previous !== undefined && group.length < MIN_PHRASE_WORDS && previous.length < MAX_PHRASE_WORDS && isClose)
35
+ previous.push(...group);
36
+ else
37
+ merged.push(group);
38
+ }
39
+ return merged.map((group) => ({ words: group, start: group[0].start, end: group[group.length - 1].end }));
40
+ }
41
+ /**
42
+ * The areas each platform keeps for its interface on a 9:16 video, rounded up from the platforms' creator guides; `all`
43
+ * is the zone that is safe on every one of them.
44
+ */
45
+ export const CAPTION_SAFE_ZONES = {
46
+ reels: { top: 220, bottom: 420, left: 60, right: 120 },
47
+ shorts: { top: 190, bottom: 380, left: 60, right: 140 },
48
+ tiktok: { top: 160, bottom: 480, left: 60, right: 150 },
49
+ all: { top: 220, bottom: 480, left: 60, right: 150 },
50
+ };
51
+ const FRAME_HEIGHT = 1920;
52
+ /** Two caption lines and the box's padding, in caption font sizes. */
53
+ const CAPTION_LINES_HEIGHT = 2.5;
54
+ const CAPTION_PADDING = 40;
55
+ /** The caption box of a 9:16 film with its bottom line kept above the preset's bottom margin, centred between equal sides. */
56
+ export function getCaptionPresetLayout(preset, fontSize) {
57
+ const zone = CAPTION_SAFE_ZONES[preset];
58
+ const side = Math.max(zone.left, zone.right);
59
+ const top = Math.round(FRAME_HEIGHT - zone.bottom - CAPTION_LINES_HEIGHT * fontSize - CAPTION_PADDING);
60
+ return { top, left: side, right: side, fontSize };
61
+ }
62
+ const INVISIBLE_PATTERN = /^[\p{White_Space}\p{Cc}\p{Cf}\u{FE00}-\u{FE0F}]$/u;
63
+ /** The character maps of a family's files; null when a file cannot be read (a WOFF2 file), so the family is not checked. */
64
+ function readFamilyMaps(font, read) {
65
+ const maps = [];
66
+ for (const file of font.files) {
67
+ const map = readCharacterMap(read(file.path));
68
+ if (!map.ok)
69
+ return null;
70
+ maps.push(map.value);
71
+ }
72
+ return maps;
73
+ }
74
+ /**
75
+ * The characters of `texts` that no file of the family draws. A family whose files cannot all be read is skipped, and
76
+ * so is text without a brand font (the system font draws it).
77
+ */
78
+ function findMissingInFamily(font, texts, read) {
79
+ if (font === null || font.files.length === 0)
80
+ return null;
81
+ const maps = readFamilyMaps(font, read);
82
+ if (maps === null)
83
+ return null;
84
+ const characters = new Set();
85
+ for (const text of texts) {
86
+ for (const character of text) {
87
+ if (INVISIBLE_PATTERN.test(character))
88
+ continue;
89
+ const codePoint = character.codePointAt(0) ?? 0;
90
+ if (!maps.some((map) => map.has(codePoint)))
91
+ characters.add(character);
92
+ }
93
+ }
94
+ return characters.size === 0 ? null : { font: font.family, characters: [...characters] };
95
+ }
96
+ /**
97
+ * Glyphs the film's fonts lack: the body font against the captions and the end card's url and note, the heading font
98
+ * (the body font without one) against the brand name and the headline. Empty when every letter is drawn.
99
+ */
100
+ export function findMissingCaptionGlyphs(input, read = readFileSync) {
101
+ const { fonts, endCard } = input;
102
+ const body = findMissingInFamily(fonts.body, [...input.captions, ...(endCard === null ? [] : [endCard.url, endCard.note])], read);
103
+ const headingTexts = endCard === null ? [] : [input.brandName, endCard.headline];
104
+ const heading = findMissingInFamily(fonts.heading ?? fonts.body, headingTexts, read);
105
+ const missing = [body, heading].filter((entry) => entry !== null);
106
+ // One family serving both roles is reported once.
107
+ const merged = new Map();
108
+ for (const entry of missing)
109
+ merged.set(entry.font, new Set([...(merged.get(entry.font) ?? []), ...entry.characters]));
110
+ return [...merged].map(([font, characters]) => ({ font, characters: [...characters] }));
111
+ }
112
+ //# sourceMappingURL=captions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captions.js","sourceRoot":"","sources":["../../src/footage/captions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC,OAAO,EAAE,gBAAgB,EAAqB,MAAM,wBAAwB,CAAC;AAgB7E,MAAM,gBAAgB,GAAG,CAAC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,CAAC,QAAQ,CAAC,CAAC;IACjF,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACrF,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAiC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;IACjG,kDAAkD;IAClD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC9C,KAAK,MAAM,KAAK,IAAI,OAAO;QAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACvH,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1F,CAAC"}
@@ -4,9 +4,9 @@ import type { ComposeFont } from "../compose/compose.js";
4
4
  import { type CaptionLayout } from "../compose/timeline.js";
5
5
  import type { TimedWord } from "../voice/voiceover.js";
6
6
  import { type Edl } from "./edl.js";
7
- import type { FootageFilm } from "./film.js";
8
- /** A cross-fade's length; the outgoing segment plays on under the incoming one for this long. */
9
- export declare const FADE_SECONDS = 0.35;
7
+ import { type FootageFilm } from "./film.js";
8
+ /** The default cross-fade's length (`DEFAULT_EDIT.fadeFrames` at 30 fps); the outgoing segment plays on under the incoming one for this long. */
9
+ export declare const FADE_SECONDS: number;
10
10
  /** The end card's length after the cut. */
11
11
  export declare const END_CARD_SECONDS = 3;
12
12
  export interface FootageComposeAssets {
@@ -44,7 +44,7 @@ export interface FootageComposeInput {
44
44
  }
45
45
  /** The film's length: the cut plus the end card. */
46
46
  export declare function getFootageFilmSeconds(film: Pick<FootageFilm, "endCard">, edl: Edl): number;
47
- /** The picture scale each segment starts at: `zoom` cuts alternate between punched in and back out. */
48
- export declare function getSegmentScales(edl: Edl): number[];
47
+ /** The picture scale each segment starts at: `zoom` cuts alternate between punched in (`zoomPercent`) and back out. */
48
+ export declare function getSegmentScales(edl: Edl, zoomPercent?: number): number[];
49
49
  export declare function composeFootage(input: FootageComposeInput): string;
50
50
  //# sourceMappingURL=compose.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/footage/compose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAoC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAU7C,iGAAiG;AACjG,eAAO,MAAM,YAAY,OAAO,CAAC;AAKjC,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,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D,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,MAAM,CAE1F;AAED,uHAAuH;AACvH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,SAA2B,GAAG,MAAM,EAAE,CAO3F;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAmJjE"}
@@ -1,32 +1,34 @@
1
1
  import { escapeHtml, fontFaces, fontStack } from "../compose/html.js";
2
2
  import { captionChunks } from "../compose/timeline.js";
3
+ import { phraseChunks } from "./captions.js";
3
4
  import { getEdlDuration, getSegmentStarts } from "./edl.js";
5
+ import { DEFAULT_EDIT, getFootageEdit } from "./film.js";
6
+ import { FOOTAGE_FPS } from "./normalize.js";
7
+ const r3 = (value) => Math.round(value * 1000) / 1000 || 0;
4
8
  /**
5
9
  * The HyperFrames composition of a footage film (the same 0.8.85 contract as `composeFilm`): one `<video>` clip per
6
10
  * EDL segment over the normalized clip with its media start, the transitions (`fade` cross-fades from the segment
7
- * before, `zoom` punches in on alternate jump cuts, `whoosh` plays the whoosh sound), a slow zoom on b-roll, the
8
- * word-by-word captions, the end card over the cut's last frame, the cut speech track and the ducked music.
11
+ * before over `fadeFrames`, `zoom` punches in by `zoomPercent` on alternate jump cuts, `whoosh` plays the whoosh
12
+ * sound), a slow zoom on `kenburns` segments, the captions (plain phrases, or the word-highlight pill), the end card
13
+ * over the cut's last frame (its whoosh only with `isEndCardWhoosh`), the cut speech track and the ducked music.
9
14
  */
10
15
  const COMPOSITION_ID = "film";
11
- /** A cross-fade's length; the outgoing segment plays on under the incoming one for this long. */
12
- export const FADE_SECONDS = 0.35;
13
- /** The punch-in of a `zoom` cut. */
14
- const ZOOM_SCALE = 1.12;
15
- /** How far a b-roll segment zooms over its length. */
16
- const KEN_BURNS_SCALE = 1.08;
16
+ /** The default cross-fade's length (`DEFAULT_EDIT.fadeFrames` at 30 fps); the outgoing segment plays on under the incoming one for this long. */
17
+ export const FADE_SECONDS = r3(DEFAULT_EDIT.fadeFrames / FOOTAGE_FPS);
18
+ /** How far a segment marked `kenburns` zooms when the film's `kenBurnsPercent` is 0 (a hand edit asked for it). */
19
+ const HAND_KEN_BURNS_PERCENT = 4;
17
20
  /** The end card's length after the cut. */
18
21
  export const END_CARD_SECONDS = 3;
19
- const r3 = (value) => Math.round(value * 1000) / 1000 || 0;
20
22
  /** The film's length: the cut plus the end card. */
21
23
  export function getFootageFilmSeconds(film, edl) {
22
24
  return r3(getEdlDuration(edl) + (film.endCard === null ? 0 : END_CARD_SECONDS));
23
25
  }
24
- /** The picture scale each segment starts at: `zoom` cuts alternate between punched in and back out. */
25
- export function getSegmentScales(edl) {
26
+ /** The picture scale each segment starts at: `zoom` cuts alternate between punched in (`zoomPercent`) and back out. */
27
+ export function getSegmentScales(edl, zoomPercent = DEFAULT_EDIT.zoomPercent) {
26
28
  const scales = [];
27
29
  edl.segments.forEach((segment, index) => {
28
30
  const previous = scales[index - 1] ?? 1;
29
- scales.push(segment.transition === "zoom" && index > 0 ? (previous === 1 ? ZOOM_SCALE : 1) : 1);
31
+ scales.push(segment.transition === "zoom" && index > 0 ? (previous === 1 ? zoomPercent / 100 : 1) : 1);
30
32
  });
31
33
  return scales;
32
34
  }
@@ -35,13 +37,16 @@ export function composeFootage(input) {
35
37
  const starts = getSegmentStarts(edl);
36
38
  const cutEnd = getEdlDuration(edl);
37
39
  const end = getFootageFilmSeconds(film, edl);
38
- const scales = getSegmentScales(edl);
40
+ const edit = getFootageEdit(film);
41
+ const scales = getSegmentScales(edl, edit.zoomPercent);
42
+ const fadeSeconds = r3(edit.fadeFrames / FOOTAGE_FPS);
43
+ const kenBurnsScale = 1 + (edit.kenBurnsPercent > 0 ? edit.kenBurnsPercent : HAND_KEN_BURNS_PERCENT) / 100;
39
44
  const segments = edl.segments.map((segment, index) => {
40
45
  const src = assets.clips[segment.clip];
41
46
  if (src === undefined)
42
47
  throw new Error(`The EDL names clip "${segment.clip}", which the film has no file for.`);
43
48
  const next = edl.segments[index + 1];
44
- const tail = next?.transition === "fade" ? FADE_SECONDS : 0;
49
+ const tail = next?.transition === "fade" ? fadeSeconds : 0;
45
50
  const start = starts[index];
46
51
  const duration = r3(segment.end - segment.start + tail);
47
52
  const scale = scales[index];
@@ -52,22 +57,25 @@ export function composeFootage(input) {
52
57
  edl.segments.forEach((segment, index) => {
53
58
  const start = starts[index];
54
59
  if (segment.transition === "fade" && index > 0) {
55
- tweens.push(`tl.fromTo("#seg${index}", { opacity: 0 }, { opacity: 1, duration: ${FADE_SECONDS}, ease: "none", immediateRender: false }, ${start});`);
60
+ tweens.push(`tl.fromTo("#seg${index}", { opacity: 0 }, { opacity: 1, duration: ${fadeSeconds}, ease: "none", immediateRender: false }, ${start});`);
56
61
  }
57
62
  if (segment.motion === "kenburns") {
58
63
  const from = scales[index];
59
- tweens.push(`tl.fromTo("#seg${index}", { scale: ${from} }, { scale: ${r3(from * KEN_BURNS_SCALE)}, duration: ${r3(segment.end - segment.start)}, ease: "none", immediateRender: false }, ${start});`);
64
+ tweens.push(`tl.fromTo("#seg${index}", { scale: ${from} }, { scale: ${r3(from * kenBurnsScale)}, duration: ${r3(segment.end - segment.start)}, ease: "none", immediateRender: false }, ${start});`);
60
65
  }
61
66
  });
62
- // --- Captions ---
63
- const caption = input.film.captions ? captionChunks(words) : [];
67
+ // --- Captions: plain phrases, or the pill that lights each word ---
68
+ const isHighlight = film.captionStyle === "highlight";
69
+ const caption = !film.captions ? [] : isHighlight ? captionChunks(words) : phraseChunks(words);
64
70
  const captionHtml = caption
65
71
  .map((chunk, i) => {
66
72
  const next = caption[i + 1];
67
73
  const start = r3(chunk.start - 0.05);
68
74
  const stop = Math.min(chunk.end + 0.35, next === undefined ? cutEnd : next.start - 0.06);
69
- const spans = chunk.words.map((w, j) => `<span id="cw${i}_${j}">${escapeHtml(w.text)}</span>`).join(" ");
70
- return `<div id="cap${i}" class="clip caption" data-start="${start}" data-duration="${r3(Math.max(0.1, stop - start))}"><p class="pill">${spans}</p></div>`;
75
+ const box = isHighlight
76
+ ? `<p class="pill">${chunk.words.map((w, j) => `<span id="cw${i}_${j}">${escapeHtml(w.text)}</span>`).join(" ")}</p>`
77
+ : `<p class="phrase">${escapeHtml(chunk.words.map((w) => w.text).join(" "))}</p>`;
78
+ return `<div id="cap${i}" class="clip caption" data-start="${start}" data-duration="${r3(Math.max(0.1, stop - start))}">${box}</div>`;
71
79
  })
72
80
  .join("\n ");
73
81
  // --- Sound ---
@@ -81,7 +89,7 @@ export function composeFootage(input) {
81
89
  if (segment.transition === "whoosh" && index > 0)
82
90
  play("whoosh", starts[index] - 0.1, 0.45, 0.57);
83
91
  });
84
- if (film.endCard !== null) {
92
+ if (film.endCard !== null && edit.isEndCardWhoosh) {
85
93
  play("whoosh", cutEnd, 0.3, 0.57);
86
94
  play("pop", r3(cutEnd + 0.9), 0.35, 0.72);
87
95
  }
@@ -131,6 +139,7 @@ html,body{width:${frame.width}px;height:${frame.height}px;overflow:hidden;backgr
131
139
  .caption{position:absolute;left:${captionBox.left}px;right:${captionBox.right}px;top:${captionBox.top}px;display:flex;justify-content:center}
132
140
  .pill{font-weight:650;font-size:${captionBox.fontSize}px;line-height:1.18;letter-spacing:-.01em;text-align:center;padding:16px 28px;border-radius:22px;background:${c.captionBackground};box-shadow:0 14px 44px rgba(0,0,0,.5);color:${c.captionText}}
133
141
  .pill span{display:inline-block}
142
+ .phrase{font-weight:650;font-size:${captionBox.fontSize}px;line-height:1.18;letter-spacing:-.01em;text-align:center;color:#fff;text-shadow:0 2px 6px rgba(0,0,0,.55),0 0 18px rgba(0,0,0,.35)}
134
143
  .endcard{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:0 80px;text-align:center}
135
144
  .brand{display:flex;justify-content:center;align-items:center;gap:18px;font-family:${headingFont};font-size:46px}
136
145
  .logo{height:60px;width:auto}
@@ -149,7 +158,7 @@ html,body{width:${frame.width}px;height:${frame.height}px;overflow:hidden;backgr
149
158
  <script>
150
159
  const tl = gsap.timeline({ paused: true });
151
160
  ${tweens.join("\n")}
152
- const captions = ${JSON.stringify(caption.map((chunk) => chunk.words.map((w) => w.start)))};
161
+ const captions = ${JSON.stringify(isHighlight ? caption.map((chunk) => chunk.words.map((w) => w.start)) : [])};
153
162
  captions.forEach((words, i) => {
154
163
  tl.fromTo("#cap" + i + " .pill", { y: 14, opacity: 0 }, { y: 0, opacity: 1, duration: 0.16, ease: "power3.out" }, Math.max(0, words[0] - 0.05));
155
164
  words.forEach((t, j) => tl.fromTo("#cw" + i + "_" + j, { color: "${c.captionText}" }, { color: "${c.captionHighlight}", duration: 0.06, immediateRender: false }, t).to("#cw" + i + "_" + j, { color: "${c.captionText}", duration: 0.2 }, t + 0.32));
@@ -1 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../../src/footage/compose.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAsB,MAAM,wBAAwB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAY,MAAM,UAAU,CAAC;AAGtE;;;;;GAKG;AAEH,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,iGAAiG;AACjG,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AACjC,oCAAoC;AACpC,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,sDAAsD;AACtD,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,2CAA2C;AAC3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AA+BlC,MAAM,EAAE,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AAE3E,oDAAoD;AACpD,M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IACX,KAAK;;;;EAIP,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;mBACA,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;;;qEAGxC,CAAC,CAAC,WAAW,kBAAkB,CAAC,CAAC,gBAAgB,qFAAqF,CAAC,CAAC,WAAW;;EAEtN,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;iBACT,GAAG;;sBAEE,cAAc;;;;CAInC,CAAC;AACF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import type { TimedWord } from "../voice/voiceover.js";
3
3
  import { type ClipRole, type CutOptions, type CutTransition, type FootageTransitions } from "./film.js";
4
+ export { isFiller, normalizeWord } from "./words.js";
4
5
  /**
5
6
  * The edit decision list: which parts of which clips the film keeps, in order, and how each part starts. Built from
6
7
  * the transcript (`buildEdl`), written as plain JSON next to the build so a person or an agent can check or change it
@@ -8,8 +9,19 @@ import { type ClipRole, type CutOptions, type CutTransition, type FootageTransit
8
9
  */
9
10
  export declare const SEGMENT_MOTIONS: readonly ["none", "kenburns"];
10
11
  export type SegmentMotion = (typeof SEGMENT_MOTIONS)[number];
12
+ /** A segment's sound taken from another clip or span: a J- or L-cut, or b-roll over speech. */
13
+ export interface EdlAudio {
14
+ clip: string;
15
+ /** Seconds in that trimmed clip; as long as the segment. */
16
+ start: number;
17
+ end: number;
18
+ /** The picture clip's own sound under it (0-1); 0 mutes it. */
19
+ ownVolume: number;
20
+ }
11
21
  export interface EdlSegment {
12
- /** The clip's id. */
22
+ /** Unique in the cut: `s<n>` (the sentence it starts with), `r<n>` (b-roll), `w<n>` (a talking clip without words). */
23
+ id: string;
24
+ /** The clip's id (the picture, and the sound unless `audio` says otherwise). */
13
25
  clip: string;
14
26
  /** Seconds in the trimmed clip. */
15
27
  start: number;
@@ -17,16 +29,23 @@ export interface EdlSegment {
17
29
  transition: CutTransition;
18
30
  /** `kenburns`: a slow zoom over a segment without speech. */
19
31
  motion: SegmentMotion;
32
+ audio?: EdlAudio;
20
33
  }
21
34
  export interface Edl {
22
- version: 1;
35
+ version: 2;
23
36
  film: string;
24
37
  segments: EdlSegment[];
25
38
  }
26
39
  export declare const edlSchema: z.ZodObject<{
27
- version: z.ZodLiteral<1>;
40
+ version: z.ZodLiteral<2>;
28
41
  film: z.ZodString;
29
42
  segments: z.ZodArray<z.ZodObject<{
43
+ audio: z.ZodOptional<z.ZodObject<{
44
+ clip: z.ZodString;
45
+ start: z.ZodNumber;
46
+ end: z.ZodNumber;
47
+ ownVolume: z.ZodDefault<z.ZodNumber>;
48
+ }, z.core.$strict>>;
30
49
  clip: z.ZodString;
31
50
  start: z.ZodNumber;
32
51
  end: z.ZodNumber;
@@ -40,8 +59,11 @@ export declare const edlSchema: z.ZodObject<{
40
59
  none: "none";
41
60
  kenburns: "kenburns";
42
61
  }>;
62
+ id: z.ZodString;
43
63
  }, z.core.$strict>>;
44
64
  }, z.core.$strict>;
65
+ /** The EDL's JSON Schema, for an agent or an MCP tool that edits `edl.json`. */
66
+ export declare function getEdlJsonSchema(): Record<string, unknown>;
45
67
  /** A clip as the cut sees it: its role, its trimmed length and its transcript (times from the trimmed start). */
46
68
  export interface EdlClip {
47
69
  id: string;
@@ -51,20 +73,34 @@ export interface EdlClip {
51
73
  }
52
74
  /** Shortest segment kept, in seconds: anything shorter reads as a glitch. */
53
75
  export declare const MIN_SEGMENT_SECONDS = 0.25;
54
- /** A word reduced for comparison: lower case, letters and digits only, repeated letters collapsed (`Yyyy,` → `y`). */
55
- export declare function normalizeWord(text: string): string;
56
- /** Whether the word is one of the fillers (compared as `normalizeWord` writes both). */
57
- export declare function isFiller(text: string, fillers: readonly string[]): boolean;
76
+ export interface BuildEdlOptions {
77
+ /** The sentence ids (`splitFilmSentences`) to keep; the words of every other sentence are cut. Absent: all. */
78
+ keepSentences?: readonly string[];
79
+ /** Mark b-roll segments `kenburns` (a slow zoom); false keeps them still. */
80
+ isKenBurns?: boolean;
81
+ }
58
82
  /**
59
83
  * The cut from the transcripts. A talking clip keeps its runs of words: fillers are cut out, a pause longer than
60
- * `pauseSeconds` is cut, `padSeconds` stays around each cut. A talking clip without words, and every b-roll clip, is
61
- * kept whole (b-roll with a slow zoom). The first segment starts with a cut; later ones with `transitions.jump`
62
- * inside one clip and `transitions.clip` between clips.
84
+ * `pauseSeconds` is cut, `padSeconds` stays around each cut, and with `keepSentences` only those sentences stay. A
85
+ * talking clip without words, and every b-roll clip, is kept whole. The first segment starts with a cut; later ones
86
+ * with `transitions.jump` inside one clip and `transitions.clip` between clips. Each segment's id names the sentence
87
+ * it starts with (`s4`), or the b-roll (`r1`) or wordless clip (`w1`) it shows.
88
+ */
89
+ export declare function buildEdl(filmId: string, clips: EdlClip[], options: CutOptions, transitions: FootageTransitions, edit?: BuildEdlOptions): Edl;
90
+ /** The clip and span a segment's sound comes from: its `audio`, or its own picture span. */
91
+ export declare function getSoundSpan(segment: EdlSegment): {
92
+ clip: string;
93
+ start: number;
94
+ end: number;
95
+ };
96
+ /**
97
+ * What makes an EDL (a hand-edited one above all) unusable with these clips; empty when it is fine: another film,
98
+ * an unknown clip, a span past a clip's end, a too short segment, a repeated id, a sound span of another length.
63
99
  */
64
- export declare function buildEdl(filmId: string, clips: EdlClip[], options: CutOptions, transitions: FootageTransitions): Edl;
65
- /** What makes an EDL (a hand-edited one above all) unusable with these clips; empty when it is fine. */
66
- export declare function findEdlProblems(edl: Edl, clips: Pick<EdlClip, "id" | "duration">[], filmId: string): string[];
67
- /** Reads an EDL file's JSON; an error names the first problems by path. */
100
+ export declare function validateEdl(edl: Edl, clips: Pick<EdlClip, "id" | "duration">[], filmId: string): string[];
101
+ /** `validateEdl` under its first name. */
102
+ export declare const findEdlProblems: typeof validateEdl;
103
+ /** Reads an EDL file's JSON (version 2, or version 1 upgraded with generated ids); an error names the first problems by path. */
68
104
  export declare function readEdl(json: unknown): {
69
105
  ok: true;
70
106
  edl: Edl;
@@ -72,12 +108,14 @@ export declare function readEdl(json: unknown): {
72
108
  ok: false;
73
109
  error: string;
74
110
  };
111
+ /** What an edit changed, from `before` to `after`, as short lines ("dropped s3", "moved s7 to the start", "r1 over s4"). */
112
+ export declare function diffEdl(before: Edl, after: Edl): string[];
75
113
  export declare function getEdlDuration(edl: Edl): number;
76
114
  /** Where each segment starts in the film, in seconds. */
77
115
  export declare function getSegmentStarts(edl: Edl): number[];
78
116
  /**
79
- * The words the film says, in film time: each clip's words that fall in a kept segment (by their middle), shifted by
80
- * where the segment lands; fillers left out. Every cut shifts every later word.
117
+ * The words the film says, in film time: the words of each segment's sound span (its own, or `audio`) that fall in it
118
+ * (by their middle), shifted by where the segment lands; fillers left out. Every cut shifts every later word.
81
119
  */
82
120
  export declare function remapWords(edl: Edl, words: Record<string, TimedWord[]>, fillers: readonly string[]): TimedWord[];
83
121
  //# sourceMappingURL=edl.d.ts.map