@softure-ai/marketing-kit 0.35.0 → 0.36.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/CHANGELOG.md +29 -0
- package/README.md +23 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +1 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/schema.d.ts +2 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +8 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/footage/captions.d.ts +22 -2
- package/dist/footage/captions.d.ts.map +1 -1
- package/dist/footage/captions.js +23 -4
- package/dist/footage/captions.js.map +1 -1
- package/dist/footage/compose.d.ts +9 -0
- package/dist/footage/compose.d.ts.map +1 -1
- package/dist/footage/compose.js +35 -14
- package/dist/footage/compose.js.map +1 -1
- package/dist/footage/draft.d.ts +3 -1
- package/dist/footage/draft.d.ts.map +1 -1
- package/dist/footage/draft.js +72 -14
- package/dist/footage/draft.js.map +1 -1
- package/dist/footage/edl.d.ts +26 -0
- package/dist/footage/edl.d.ts.map +1 -1
- package/dist/footage/edl.js +48 -1
- package/dist/footage/edl.js.map +1 -1
- package/dist/footage/film.d.ts +25 -2
- package/dist/footage/film.d.ts.map +1 -1
- package/dist/footage/film.js +10 -1
- package/dist/footage/film.js.map +1 -1
- package/dist/footage/overlays.d.ts.map +1 -1
- package/dist/footage/overlays.js +5 -0
- package/dist/footage/overlays.js.map +1 -1
- package/dist/footage/picture.d.ts +5 -0
- package/dist/footage/picture.d.ts.map +1 -1
- package/dist/footage/picture.js +26 -8
- package/dist/footage/picture.js.map +1 -1
- package/dist/footage/pipeline.d.ts.map +1 -1
- package/dist/footage/pipeline.js +7 -3
- package/dist/footage/pipeline.js.map +1 -1
- package/dist/footage/split-screen.d.ts +167 -0
- package/dist/footage/split-screen.d.ts.map +1 -0
- package/dist/footage/split-screen.js +233 -0
- package/dist/footage/split-screen.js.map +1 -0
- package/dist/footage/tools.d.ts +1 -1
- package/dist/footage/tools.d.ts.map +1 -1
- package/dist/footage/tools.js +1 -1
- package/dist/footage/tools.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/schema/edl.schema.json +129 -0
- package/schema/marketing.schema.json +9 -2
- package/src/config/config.ts +1 -0
- package/src/config/schema.ts +8 -2
- package/src/footage/captions.ts +32 -4
- package/src/footage/compose.ts +30 -8
- package/src/footage/draft.ts +83 -14
- package/src/footage/edl.ts +46 -1
- package/src/footage/film.ts +20 -2
- package/src/footage/overlays.ts +5 -0
- package/src/footage/picture.ts +27 -9
- package/src/footage/pipeline.ts +7 -3
- package/src/footage/split-screen.ts +319 -0
- package/src/footage/tools.ts +1 -1
- package/src/index.ts +30 -0
package/schema/edl.schema.json
CHANGED
|
@@ -177,6 +177,135 @@
|
|
|
177
177
|
}
|
|
178
178
|
},
|
|
179
179
|
"additionalProperties": false
|
|
180
|
+
},
|
|
181
|
+
"split": {
|
|
182
|
+
"type": "object",
|
|
183
|
+
"properties": {
|
|
184
|
+
"layout": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"enum": [
|
|
187
|
+
"split3"
|
|
188
|
+
],
|
|
189
|
+
"description": "split3: three shots stacked in horizontal bands."
|
|
190
|
+
},
|
|
191
|
+
"bands": {
|
|
192
|
+
"type": "array",
|
|
193
|
+
"prefixItems": [
|
|
194
|
+
{
|
|
195
|
+
"type": "object",
|
|
196
|
+
"properties": {
|
|
197
|
+
"clip": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"minLength": 1,
|
|
200
|
+
"description": "The band's clip id."
|
|
201
|
+
},
|
|
202
|
+
"start": {
|
|
203
|
+
"type": "number",
|
|
204
|
+
"minimum": 0,
|
|
205
|
+
"description": "Seconds in that trimmed clip where the band's shot starts; it plays for the segment's length."
|
|
206
|
+
},
|
|
207
|
+
"label": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"minLength": 1,
|
|
210
|
+
"maxLength": 24,
|
|
211
|
+
"pattern": "^[^\\n\\r]*$",
|
|
212
|
+
"description": "A short handwritten label, one line, at most 24 characters (a place's name)."
|
|
213
|
+
},
|
|
214
|
+
"focus": {
|
|
215
|
+
"description": "Where the band's crop sits in the shot's height: 0 its top, 1 its foot; 0.5 (the middle) without it.",
|
|
216
|
+
"type": "number",
|
|
217
|
+
"minimum": 0,
|
|
218
|
+
"maximum": 1
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"required": [
|
|
222
|
+
"clip",
|
|
223
|
+
"start",
|
|
224
|
+
"label"
|
|
225
|
+
],
|
|
226
|
+
"additionalProperties": false
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"type": "object",
|
|
230
|
+
"properties": {
|
|
231
|
+
"clip": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"minLength": 1,
|
|
234
|
+
"description": "The band's clip id."
|
|
235
|
+
},
|
|
236
|
+
"start": {
|
|
237
|
+
"type": "number",
|
|
238
|
+
"minimum": 0,
|
|
239
|
+
"description": "Seconds in that trimmed clip where the band's shot starts; it plays for the segment's length."
|
|
240
|
+
},
|
|
241
|
+
"label": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"minLength": 1,
|
|
244
|
+
"maxLength": 24,
|
|
245
|
+
"pattern": "^[^\\n\\r]*$",
|
|
246
|
+
"description": "A short handwritten label, one line, at most 24 characters (a place's name)."
|
|
247
|
+
},
|
|
248
|
+
"focus": {
|
|
249
|
+
"description": "Where the band's crop sits in the shot's height: 0 its top, 1 its foot; 0.5 (the middle) without it.",
|
|
250
|
+
"type": "number",
|
|
251
|
+
"minimum": 0,
|
|
252
|
+
"maximum": 1
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"required": [
|
|
256
|
+
"clip",
|
|
257
|
+
"start",
|
|
258
|
+
"label"
|
|
259
|
+
],
|
|
260
|
+
"additionalProperties": false
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"type": "object",
|
|
264
|
+
"properties": {
|
|
265
|
+
"clip": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"minLength": 1,
|
|
268
|
+
"description": "The band's clip id."
|
|
269
|
+
},
|
|
270
|
+
"start": {
|
|
271
|
+
"type": "number",
|
|
272
|
+
"minimum": 0,
|
|
273
|
+
"description": "Seconds in that trimmed clip where the band's shot starts; it plays for the segment's length."
|
|
274
|
+
},
|
|
275
|
+
"label": {
|
|
276
|
+
"type": "string",
|
|
277
|
+
"minLength": 1,
|
|
278
|
+
"maxLength": 24,
|
|
279
|
+
"pattern": "^[^\\n\\r]*$",
|
|
280
|
+
"description": "A short handwritten label, one line, at most 24 characters (a place's name)."
|
|
281
|
+
},
|
|
282
|
+
"focus": {
|
|
283
|
+
"description": "Where the band's crop sits in the shot's height: 0 its top, 1 its foot; 0.5 (the middle) without it.",
|
|
284
|
+
"type": "number",
|
|
285
|
+
"minimum": 0,
|
|
286
|
+
"maximum": 1
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"required": [
|
|
290
|
+
"clip",
|
|
291
|
+
"start",
|
|
292
|
+
"label"
|
|
293
|
+
],
|
|
294
|
+
"additionalProperties": false
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
"items": false,
|
|
298
|
+
"minItems": 3,
|
|
299
|
+
"maxItems": 3,
|
|
300
|
+
"description": "The three bands, top to bottom."
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"required": [
|
|
304
|
+
"layout",
|
|
305
|
+
"bands"
|
|
306
|
+
],
|
|
307
|
+
"additionalProperties": false,
|
|
308
|
+
"description": "A split screen: the segment's picture is three shots stacked in bands, each with a handwritten label and a drawn arrow; the segment's sound stays its own. Still (no camera, Ken Burns, zoom or stutter), not the cut's last segment, and the segment after it starts on a plain cut."
|
|
180
309
|
}
|
|
181
310
|
},
|
|
182
311
|
"required": [
|
|
@@ -2879,13 +2879,20 @@
|
|
|
2879
2879
|
},
|
|
2880
2880
|
"captionStyle": {
|
|
2881
2881
|
"default": "phrase",
|
|
2882
|
-
"description": "phrase (the default): 2-6 words of plain text with a soft shadow; highlight: a pill that lights each word as it is said.",
|
|
2882
|
+
"description": "phrase (the default): 2-6 words of plain text with a soft shadow; highlight: a pill that lights each word as it is said; ribbon: bold capitals, each line on its own flat strip of brand.colors.captionBackground, the block slightly turned (captionRibbonTilt).",
|
|
2883
2883
|
"type": "string",
|
|
2884
2884
|
"enum": [
|
|
2885
2885
|
"phrase",
|
|
2886
|
-
"highlight"
|
|
2886
|
+
"highlight",
|
|
2887
|
+
"ribbon"
|
|
2887
2888
|
]
|
|
2888
2889
|
},
|
|
2890
|
+
"captionRibbonTilt": {
|
|
2891
|
+
"description": "A ribbon caption's turn in degrees, counter-clockwise positive (-10 to 10); without it, 4. Ignored by the other styles.",
|
|
2892
|
+
"type": "number",
|
|
2893
|
+
"minimum": -10,
|
|
2894
|
+
"maximum": 10
|
|
2895
|
+
},
|
|
2889
2896
|
"captionHighlightStyle": {
|
|
2890
2897
|
"default": "text",
|
|
2891
2898
|
"description": "How a highlight caption lights the word being said: text (the default) colours it captionHighlight; box puts it on a rounded box of brand.colors.captionHighlightBox with its text in captionHighlightText (both then required); underline keeps its text and underlines it in captionHighlight.",
|
package/src/config/config.ts
CHANGED
|
@@ -252,6 +252,7 @@ function resolveFootage(data: MarketingJson, at: (relative: string) => string):
|
|
|
252
252
|
},
|
|
253
253
|
captions: film.captions,
|
|
254
254
|
captionStyle: film.captionStyle,
|
|
255
|
+
...(film.captionRibbonTilt === undefined ? {} : { captionRibbonTilt: film.captionRibbonTilt }),
|
|
255
256
|
...(film.captionHighlightStyle === "text" ? {} : { captionHighlightStyle: film.captionHighlightStyle }),
|
|
256
257
|
...(film.captionEntrance === undefined ? {} : { captionEntrance: film.captionEntrance }),
|
|
257
258
|
...(film.captionPreset === undefined ? {} : { captionPreset: film.captionPreset }),
|
package/src/config/schema.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { bigNumberDataSchema, carouselDataSchema, headlineChartDataSchema, headlineCtaDataSchema } from "../og/templates/schemas.js";
|
|
16
16
|
import { CHANNEL_CODE_MAX_LENGTH, CHANNEL_CODE_PATTERN, DEFAULT_LINK_IN_BIO, PLATFORMS } from "../platforms.js";
|
|
17
17
|
import { DECLICK_LEVELS } from "../footage/declick.js";
|
|
18
|
-
import { CAPTION_ENTRANCES, CAPTION_HIGHLIGHT_STYLES, CAPTION_PRESETS, CAPTION_STYLES, CLIP_FITS, CLIP_ROLES, CUT_TRANSITIONS, JUMP_TRANSITIONS } from "../footage/film.js";
|
|
18
|
+
import { CAPTION_ENTRANCES, CAPTION_HIGHLIGHT_STYLES, CAPTION_PRESETS, CAPTION_RIBBON_MAX_TILT, CAPTION_RIBBON_TILT, CAPTION_STYLES, CLIP_FITS, CLIP_ROLES, CUT_TRANSITIONS, JUMP_TRANSITIONS } from "../footage/film.js";
|
|
19
19
|
import { normalizeKeyTerms } from "../footage/keyterms.js";
|
|
20
20
|
import { ELEVENLABS_DEFAULT_MODEL } from "../voice/voiceover.js";
|
|
21
21
|
import { actionSchema, type SceneAction } from "./actions-schema.js";
|
|
@@ -582,7 +582,13 @@ const footageSchema = z
|
|
|
582
582
|
captionStyle: z
|
|
583
583
|
.enum(CAPTION_STYLES)
|
|
584
584
|
.default("phrase")
|
|
585
|
-
.describe("phrase (the default): 2-6 words of plain text with a soft shadow; highlight: a pill that lights each word as it is said."),
|
|
585
|
+
.describe("phrase (the default): 2-6 words of plain text with a soft shadow; highlight: a pill that lights each word as it is said; ribbon: bold capitals, each line on its own flat strip of brand.colors.captionBackground, the block slightly turned (captionRibbonTilt)."),
|
|
586
|
+
captionRibbonTilt: z
|
|
587
|
+
.number()
|
|
588
|
+
.min(-CAPTION_RIBBON_MAX_TILT)
|
|
589
|
+
.max(CAPTION_RIBBON_MAX_TILT)
|
|
590
|
+
.optional()
|
|
591
|
+
.describe(`A ribbon caption's turn in degrees, counter-clockwise positive (-${String(CAPTION_RIBBON_MAX_TILT)} to ${String(CAPTION_RIBBON_MAX_TILT)}); without it, ${String(CAPTION_RIBBON_TILT)}. Ignored by the other styles.`),
|
|
586
592
|
captionHighlightStyle: z
|
|
587
593
|
.enum(CAPTION_HIGHLIGHT_STYLES)
|
|
588
594
|
.default("text")
|
package/src/footage/captions.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { BrandFont } from "../config/config.js";
|
|
|
5
5
|
import { readCharacterMap, type CharacterMap } from "../og/character-map.js";
|
|
6
6
|
import type { TimedWord } from "../voice/voiceover.js";
|
|
7
7
|
import { findCaptionRangeAt, findSegmentAt, type Edl, type EdlCaption, type EdlCaptionBounds } from "./edl.js";
|
|
8
|
-
import { DEFAULT_CAPTION_KEEP_WITH_NEXT, type CaptionPreset, type FootageFilm } from "./film.js";
|
|
8
|
+
import { CAPTION_RIBBON, CAPTION_RIBBON_TILT, DEFAULT_CAPTION_KEEP_WITH_NEXT, type CaptionPreset, type FootageFilm } from "./film.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The footage film's captions: plain phrases (the default style), the 9:16 caption box inside a platform's safe zone,
|
|
@@ -95,8 +95,8 @@ export function getCaptionKeepsWithNext(film: CaptionWordsFilm): (word: TimedWor
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* A footage film's caption cards in film time: none without captions, `captionChunks` for `highlight
|
|
99
|
-
* otherwise; both keep the film's kept words with the next (`getCaptionKeepsWithNext`) and take the film's
|
|
98
|
+
* A footage film's caption cards in film time: none without captions, `captionChunks` for `highlight` and `ribbon`,
|
|
99
|
+
* `phraseChunks` otherwise; both keep the film's kept words with the next (`getCaptionKeepsWithNext`) and take the film's
|
|
100
100
|
* `captionMaxWords`, `captionMinWords` and `captionMaxCharacters` (absent: each style's defaults, no evening out). The
|
|
101
101
|
* render and the draft share it.
|
|
102
102
|
*/
|
|
@@ -108,7 +108,35 @@ export function getFootageCaptionChunks(film: CaptionWordsFilm & Pick<FootageFil
|
|
|
108
108
|
...(film.captionMinWords === undefined ? {} : { minWords: film.captionMinWords }),
|
|
109
109
|
...(film.captionMaxCharacters === undefined ? {} : { maxCharacters: film.captionMaxCharacters }),
|
|
110
110
|
};
|
|
111
|
-
return film.captionStyle === "highlight" ? captionChunks(words, options) : phraseChunks(words, options);
|
|
111
|
+
return film.captionStyle === "highlight" || film.captionStyle === "ribbon" ? captionChunks(words, options) : phraseChunks(words, options);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** A caption's text as the film shows it: a `ribbon` caption in capitals of the film's locale, the others as said. */
|
|
115
|
+
export function toCaptionDisplayText(film: Pick<FootageFilm, "captionStyle">, text: string, locale: string): string {
|
|
116
|
+
return film.captionStyle === "ribbon" ? text.toLocaleUpperCase(locale) : text;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A `ribbon` caption's turn in degrees, counter-clockwise positive: the film's own, else `CAPTION_RIBBON_TILT`. */
|
|
120
|
+
export function getCaptionRibbonTilt(film: Pick<FootageFilm, "captionRibbonTilt">): number {
|
|
121
|
+
return film.captionRibbonTilt ?? CAPTION_RIBBON_TILT;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** How far a turned `ribbon` block reaches above and below its foot, in px of the frame. */
|
|
125
|
+
export interface RibbonCaptionExtent {
|
|
126
|
+
above: number;
|
|
127
|
+
below: number;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The vertical reach of a `ribbon` block of `lines` lines at `fontSize`, `width` px wide at most, turned `tilt` degrees
|
|
132
|
+
* about its middle while its foot stays where the caption box anchors it: a turned block dips below its foot by half
|
|
133
|
+
* its width's rise and rises as much above its top. An app placing captions off a face reads it.
|
|
134
|
+
*/
|
|
135
|
+
export function getRibbonCaptionExtent(input: { fontSize: number; tilt: number; width: number; lines: number }): RibbonCaptionExtent {
|
|
136
|
+
const height = input.lines * CAPTION_RIBBON.lineHeight * input.fontSize;
|
|
137
|
+
const radians = (Math.abs(input.tilt) * Math.PI) / 180;
|
|
138
|
+
const turned = (input.width / 2) * Math.sin(radians) + (height / 2) * (Math.cos(radians) - 1);
|
|
139
|
+
return { above: Math.ceil(height + turned), below: Math.ceil(Math.max(0, turned)) };
|
|
112
140
|
}
|
|
113
141
|
|
|
114
142
|
/** When a caption chunk is on screen, in film seconds. */
|
package/src/footage/compose.ts
CHANGED
|
@@ -5,12 +5,13 @@ import { assertLocalReferences, escapeHtml, fontFaces, fontStack } from "../comp
|
|
|
5
5
|
import { CAPTION_LINE_HEIGHT, getCaptionPillCss, getCaptionPositionCss, type CaptionLayout } from "../compose/timeline.js";
|
|
6
6
|
import type { TimedWord } from "../voice/voiceover.js";
|
|
7
7
|
import { CAPTION_HIGHLIGHT_BOX_PADDING_EM, CAPTION_HIGHLIGHT_BOX_RADIUS, CAPTION_HIGHLIGHT_SECONDS, CAPTION_UNDERLINE_EM, getCaptionEntranceTween, getCaptionHighlight } from "./caption-highlight.js";
|
|
8
|
-
import { CAPTION_SAFE_ZONES, getCaptionChunkLayouts, getCaptionSpans, getFootageCaptionChunks, isSameCaptionPlace, type CaptionSpan } from "./captions.js";
|
|
8
|
+
import { CAPTION_SAFE_ZONES, getCaptionChunkLayouts, getCaptionRibbonTilt, getCaptionSpans, getFootageCaptionChunks, isSameCaptionPlace, toCaptionDisplayText, type CaptionSpan } from "./captions.js";
|
|
9
9
|
import { getCameraGsapEase, getCameraMoveSeconds, getCameraOrigin, isCameraMoving, toTransformOrigin } from "./camera.js";
|
|
10
10
|
import { STUTTER_FRAMES, STUTTER_SCALE } from "./drawn-transitions.js";
|
|
11
11
|
import { getEdlDuration, getSegmentStarts, type Edl, type EdlSegment } from "./edl.js";
|
|
12
12
|
import {
|
|
13
13
|
CAPTION_MIN_FONT_SCALE,
|
|
14
|
+
CAPTION_RIBBON,
|
|
14
15
|
DEFAULT_EDIT,
|
|
15
16
|
DEFAULT_END_CARD_SECONDS,
|
|
16
17
|
DEFAULT_LOGO_END_CARD_FADE_SECONDS,
|
|
@@ -179,6 +180,8 @@ export function composeFootage(input: FootageComposeInput): string {
|
|
|
179
180
|
const kenBurnsScale = 1 + (edit.kenBurnsPercent > 0 ? edit.kenBurnsPercent : HAND_KEN_BURNS_PERCENT) / 100;
|
|
180
181
|
|
|
181
182
|
const picture = assets.picture;
|
|
183
|
+
// A split screen is drawn only into the cut's picture (`planFootagePicture`); one video per segment cannot show it.
|
|
184
|
+
if (picture === undefined && edl.segments.some((segment) => segment.split !== undefined)) throw new Error("The EDL has a split screen, which needs the cut's picture (assets.picture).");
|
|
182
185
|
const segments =
|
|
183
186
|
picture === undefined
|
|
184
187
|
? edl.segments.map((segment, index) => {
|
|
@@ -243,8 +246,9 @@ export function composeFootage(input: FootageComposeInput): string {
|
|
|
243
246
|
);
|
|
244
247
|
}
|
|
245
248
|
|
|
246
|
-
// --- Captions: plain phrases,
|
|
249
|
+
// --- Captions: plain phrases, the pill that lights each word, or the turned ribbon ---
|
|
247
250
|
const isHighlight = film.captionStyle === "highlight";
|
|
251
|
+
const isRibbon = film.captionStyle === "ribbon";
|
|
248
252
|
const highlight = isHighlight ? getCaptionHighlight(film, c) : ({ ok: true, look: { style: "text", color: c.captionHighlight } } as const);
|
|
249
253
|
// The pipeline refuses such a film before it composes; reaching here is a bug.
|
|
250
254
|
if (!highlight.ok) throw new Error(`composeFootage: ${highlight.error}`);
|
|
@@ -261,10 +265,12 @@ export function composeFootage(input: FootageComposeInput): string {
|
|
|
261
265
|
const place = boxes[i] ?? captionBox;
|
|
262
266
|
// A chunk in a segment's own box overrides the shared rule's anchor; one in the film's box is written as before.
|
|
263
267
|
const style = isSameCaptionPlace(place, captionBox) ? "" : ` style="${place.bottom === undefined ? `bottom:auto;top:${place.top}px` : `top:auto;bottom:${place.bottom}px`}"`;
|
|
264
|
-
const box =
|
|
268
|
+
const box = isRibbon
|
|
269
|
+
? `<p class="ribbon"><span class="rb">${escapeHtml(toCaptionDisplayText(film, chunk.words.map((w) => w.text).join(" "), input.locale))}</span></p>`
|
|
270
|
+
: isHighlight
|
|
265
271
|
? `<p class="pill">${chunk.words.map((w, j) => `<span id="cw${i}_${j}">${isBox ? `<i class="hl" id="cb${i}_${j}"></i>` : ""}${isUnderline ? `<i class="ul" id="cu${i}_${j}"></i>` : ""}${escapeHtml(w.text)}</span>`).join(" ")}</p>`
|
|
266
272
|
: `<p class="phrase">${escapeHtml(chunk.words.map((w) => w.text).join(" "))}</p>`;
|
|
267
|
-
return `<div id="cap${i}" class="clip caption" data-start="${start}" data-duration="${r3(stop - start)}"${style}>${box}</div>`;
|
|
273
|
+
return `<div id="cap${i}" class="clip caption${isRibbon ? " turned" : ""}" data-start="${start}" data-duration="${r3(stop - start)}"${style}>${box}</div>`;
|
|
268
274
|
})
|
|
269
275
|
.join("\n ");
|
|
270
276
|
|
|
@@ -340,7 +346,7 @@ ${isBox ? `.pill{position:relative;z-index:0}
|
|
|
340
346
|
.hl{position:absolute;top:0;bottom:0;left:-${CAPTION_HIGHLIGHT_BOX_PADDING_EM}em;right:-${CAPTION_HIGHLIGHT_BOX_PADDING_EM}em;z-index:-1;border-radius:${CAPTION_HIGHLIGHT_BOX_RADIUS}px;background:${look.box};opacity:0}
|
|
341
347
|
` : ""}${isUnderline ? `.pill span{position:relative}
|
|
342
348
|
.ul{position:absolute;left:0;right:0;top:${CAPTION_UNDERLINE_EM.top}em;height:${CAPTION_UNDERLINE_EM.thickness}em;border-radius:${CAPTION_UNDERLINE_EM.thickness / 2}em;background:${look.color};opacity:0}
|
|
343
|
-
` : ""}.phrase{font-weight:650;font-size:${captionBox.fontSize}px;line-height:${CAPTION_LINE_HEIGHT};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)}
|
|
349
|
+
` : ""}${isRibbon ? `${getRibbonCaptionCss(captionBox.fontSize, getCaptionRibbonTilt(film), { background: c.captionBackground, text: c.captionText })}\n` : ""}.phrase{font-weight:650;font-size:${captionBox.fontSize}px;line-height:${CAPTION_LINE_HEIGHT};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)}
|
|
344
350
|
.endcard{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:0 80px;text-align:center}
|
|
345
351
|
.brand{display:flex;justify-content:center;align-items:center;gap:18px;font-family:${headingFont};font-size:46px}
|
|
346
352
|
.logo{height:60px;width:auto}
|
|
@@ -365,10 +371,12 @@ ${overlayMarkup.css.map((rule) => `${rule}\n`).join("")}</style>
|
|
|
365
371
|
${captionFit}<script>
|
|
366
372
|
const tl = gsap.timeline({ paused: true });
|
|
367
373
|
${tweens.join("\n")}
|
|
368
|
-
const captions = ${JSON.stringify(isHighlight ? caption.map((chunk) => chunk.words.map((w) => w.start)) : [])};
|
|
374
|
+
const captions = ${JSON.stringify(isHighlight ? caption.map((chunk) => chunk.words.map((w) => w.start)) : isRibbon ? caption.map((chunk) => [chunk.start]) : [])};
|
|
369
375
|
captions.forEach((words, i) => {
|
|
370
|
-
${entrance === null ? "" : ` tl.fromTo("#cap" + i + " .pill", ${toTweenVars(entrance.from)}, ${toTweenVars(entrance.to)}, Math.max(0, words[0] - 0.05));\n`}${
|
|
371
|
-
|
|
376
|
+
${entrance === null ? "" : ` tl.fromTo("#cap" + i + " ${isRibbon ? ".ribbon" : ".pill"}", ${toTweenVars(entrance.from)}, ${toTweenVars(entrance.to)}, Math.max(0, words[0] - 0.05));\n`}${
|
|
377
|
+
isRibbon
|
|
378
|
+
? ""
|
|
379
|
+
: look.style === "underline"
|
|
372
380
|
? ` words.forEach((t, j) => tl.fromTo("#cu" + i + "_" + j, { opacity: 0 }, { opacity: 1, duration: 0.06, immediateRender: false }, t).to("#cu" + i + "_" + j, { opacity: 0, duration: 0.2 }, t + ${CAPTION_HIGHLIGHT_SECONDS}));`
|
|
373
381
|
: look.style === "box"
|
|
374
382
|
? ` words.forEach((t, j) => {
|
|
@@ -393,6 +401,20 @@ function toTweenVars(vars: Record<string, number | string>): string {
|
|
|
393
401
|
return `{ ${Object.entries(vars).map(([key, value]) => `${key}: ${typeof value === "string" ? JSON.stringify(value) : String(value)}`).join(", ")} }`;
|
|
394
402
|
}
|
|
395
403
|
|
|
404
|
+
/**
|
|
405
|
+
* A `ribbon` caption's rules: the caption box turned `tilt` degrees (counter-clockwise positive, as the draft turns it)
|
|
406
|
+
* about its middle; its capitals bold and centred, each wrapped line on its own flat strip of `background`
|
|
407
|
+
* (`box-decoration-break: clone` repeats the strip's padding and corner on every line).
|
|
408
|
+
*/
|
|
409
|
+
export function getRibbonCaptionCss(fontSize: number, tilt: number, colors: { background: string; text: string }): string {
|
|
410
|
+
const { lineHeight, padding, radius, weight } = CAPTION_RIBBON;
|
|
411
|
+
return [
|
|
412
|
+
`.caption.turned{transform:rotate(${String(-tilt)}deg);transform-origin:50% 50%}`,
|
|
413
|
+
`.ribbon{font-weight:${String(weight)};font-size:${String(fontSize)}px;line-height:${String(lineHeight)};letter-spacing:.01em;text-align:center;color:${colors.text}}`,
|
|
414
|
+
`.rb{background:${colors.background};padding:${String(padding.y)}em ${String(padding.x)}em;border-radius:${String(radius)}px;-webkit-box-decoration-break:clone;box-decoration-break:clone}`,
|
|
415
|
+
].join("\n");
|
|
416
|
+
}
|
|
417
|
+
|
|
396
418
|
/** The caption pill's rule in the brand's style, after the pill's own: its radius, padding, shadow and border in `accent`. */
|
|
397
419
|
export function getStyledPillCss(style: BrandStyle, accent: string): string {
|
|
398
420
|
const pad = getStylePadding(CAPTION_PILL_PADDING, style.padding);
|
package/src/footage/draft.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { BrandColors } from "../config/colors.js";
|
|
|
7
7
|
import { err, ok } from "./failure.js";
|
|
8
8
|
import type { TimedWord } from "../voice/voiceover.js";
|
|
9
9
|
import { CAPTION_HIGHLIGHT_BOX_PADDING_EM, CAPTION_HIGHLIGHT_SECONDS, CAPTION_UNDERLINE_EM, getCaptionHighlight, type CaptionHighlightLook } from "./caption-highlight.js";
|
|
10
|
-
import { getCaptionChunkLayouts, getCaptionSpans, getFootageCaptionChunks, getFootageCaptionLayout, isSameCaptionPlace, type CaptionWordsFilm } from "./captions.js";
|
|
10
|
+
import { getCaptionChunkLayouts, getCaptionRibbonTilt, getCaptionSpans, getFootageCaptionChunks, getFootageCaptionLayout, isSameCaptionPlace, toCaptionDisplayText, type CaptionWordsFilm } from "./captions.js";
|
|
11
11
|
import { getCameraMoveFrames, getCameraOrigin, getCameraScaleExpression, type CameraAnchor, type EdlCamera } from "./camera.js";
|
|
12
12
|
import { getSegmentFadeFrames, getSegmentScales, getSegmentZoomEases } from "./compose.js";
|
|
13
13
|
import { buildDrawnTransitionFilters, DRAWN_TRANSITION_FRAMES, FRAME_TIMING, isDrawnTransition, STUTTER_FRAMES, type DrawnTransition } from "./drawn-transitions.js";
|
|
@@ -24,10 +24,11 @@ import { resolveEdlOverlays, type OverlayFontRole, type ResolvedOverlay } from "
|
|
|
24
24
|
import { chooseFootageDraftFont } from "./draft-font.js";
|
|
25
25
|
import { getEdlDuration, getSegmentStarts, remapWords, type Edl } from "./edl.js";
|
|
26
26
|
import { declickSpeech, describeDeclick, type DeclickReport } from "./declick.js";
|
|
27
|
-
import { getDeclickLevel, getFootageEdit, type FootageFilm } from "./film.js";
|
|
27
|
+
import { CAPTION_RIBBON, getDeclickLevel, getFootageEdit, type FootageFilm } from "./film.js";
|
|
28
28
|
import { buildFilmMixArgs } from "./film-mix.js";
|
|
29
29
|
import { DEFAULT_LOUDNESS, formatDb, getLoudnessVerdict, measureLoudness, normalizeLoudness, type MixLoudnessTarget } from "./loudness.js";
|
|
30
30
|
import { duckingKeyframes, getDuckingOptions } from "./music.js";
|
|
31
|
+
import { buildSplitScreenFilters, getSplitLayerInputArgs, writeSplitLayers } from "./split-screen.js";
|
|
31
32
|
import { FOOTAGE_FPS, getThreadArgs, type Frame } from "./normalize.js";
|
|
32
33
|
import {
|
|
33
34
|
findFootageMusic,
|
|
@@ -124,7 +125,7 @@ function toAssText(text: string): string {
|
|
|
124
125
|
export type FootageDraftCaptionColors = Pick<BrandColors, "captionBackground" | "captionText" | "captionHighlight" | "captionHighlightBox" | "captionHighlightText">;
|
|
125
126
|
|
|
126
127
|
export interface FootageDraftCaptionsInput {
|
|
127
|
-
film: Pick<FootageFilm, "captions" | "captionStyle" | "captionHighlightStyle"> & CaptionWordsFilm;
|
|
128
|
+
film: Pick<FootageFilm, "captions" | "captionStyle" | "captionHighlightStyle" | "captionRibbonTilt"> & CaptionWordsFilm;
|
|
128
129
|
edl: Edl;
|
|
129
130
|
/** The film's words in film time (`remapWords`). */
|
|
130
131
|
words: TimedWord[];
|
|
@@ -279,6 +280,47 @@ function getDrawnPill(input: DrawnPillInput): DrawnPill {
|
|
|
279
280
|
return { breaks, events: getDraftBoxEvents({ layer: 0, at, styleName: "CaptionShape", box, radius, color: input.colors.background, accent: input.colors.accent, style, scale }), words };
|
|
280
281
|
}
|
|
281
282
|
|
|
283
|
+
interface RibbonInput {
|
|
284
|
+
text: string;
|
|
285
|
+
span: { start: number; end: number };
|
|
286
|
+
place: CaptionLayout;
|
|
287
|
+
frame: Frame;
|
|
288
|
+
tilt: number;
|
|
289
|
+
measure: DraftTextMeasure;
|
|
290
|
+
colors: { background: string; text: string };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* A `ribbon` chunk: its capitals broken greedily into lines that fit the caption box less a strip's padding, each line
|
|
295
|
+
* on its own flat strip (`CAPTION_RIBBON`) and centred on the box's axis, the block hung from the box's foot (or top)
|
|
296
|
+
* and turned `tilt` degrees about its middle (`\org`, `\frz`), as the render turns its caption box.
|
|
297
|
+
*/
|
|
298
|
+
function getRibbonEvents(input: RibbonInput): string[] {
|
|
299
|
+
const { place, frame, measure } = input;
|
|
300
|
+
const { lineHeight, padding, radius } = CAPTION_RIBBON;
|
|
301
|
+
const size = place.fontSize;
|
|
302
|
+
const scale = frame.width / 1080;
|
|
303
|
+
const areaWidth = frame.width - place.left - place.right;
|
|
304
|
+
const pad = { x: padding.x * size, y: padding.y * size };
|
|
305
|
+
const lines = wrapDraftLine(input.text.split(" "), areaWidth - 2 * pad.x, size, measure).map((line) => line.join(" "));
|
|
306
|
+
const step = lineHeight * size;
|
|
307
|
+
const blockTop = place.bottom === undefined ? place.top : frame.height - place.bottom - lines.length * step;
|
|
308
|
+
const centre = { x: place.left + areaWidth / 2, y: blockTop + (lines.length * step) / 2 };
|
|
309
|
+
const turn = `\\org(${String(Math.round(centre.x))},${String(Math.round(centre.y))})\\frz${String(input.tilt)}`;
|
|
310
|
+
const at = `${toAssTime(input.span.start)},${toAssTime(input.span.end)}`;
|
|
311
|
+
const text = toAssColor(input.colors.text);
|
|
312
|
+
return lines.flatMap((line, index) => {
|
|
313
|
+
const width = measure(line, size) + 2 * pad.x;
|
|
314
|
+
// libass draws a line one font size tall: the strip is that plus its padding, both centred in the line's step.
|
|
315
|
+
const textTop = blockTop + index * step + (step - size) / 2;
|
|
316
|
+
const strip = { left: centre.x - width / 2, top: textTop - pad.y, width, height: size + 2 * pad.y };
|
|
317
|
+
return [
|
|
318
|
+
...getDraftBoxEvents({ layer: 0, at, styleName: "CaptionShape", box: strip, radius: radius * scale, color: input.colors.background, accent: input.colors.background, style: { shadow: "none", border: "none" }, scale, motion: turn }),
|
|
319
|
+
`Dialogue: 1,${at},CaptionShape,,0,0,0,,{\\an8\\pos(${String(Math.round(centre.x))},${String(Math.round(textTop))})${turn}\\b1\\1c&H${text.slice(4)}&\\1a&H${text.slice(2, 4)}&\\bord0\\shad0}${toAssText(line)}`,
|
|
320
|
+
];
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
|
|
282
324
|
/** Where the draft's underline sits under a line, in font sizes: libass draws a line one font size tall, its baseline near 0.8. */
|
|
283
325
|
const DRAFT_UNDERLINE_TOP_EM = 0.9;
|
|
284
326
|
|
|
@@ -322,6 +364,7 @@ function getDraftHighlightLook(film: Pick<FootageFilm, "captionStyle" | "caption
|
|
|
322
364
|
export function buildFootageDraftCaptions(input: FootageDraftCaptionsInput): string | null {
|
|
323
365
|
const overlays = input.overlays ?? [];
|
|
324
366
|
const isHighlight = input.film.captionStyle === "highlight";
|
|
367
|
+
const isRibbon = input.film.captionStyle === "ribbon";
|
|
325
368
|
// No chunks without captions (`getFootageCaptionChunks`): then only the overlays, if any, make the file.
|
|
326
369
|
const chunks = input.film.captions ? getFootageCaptionChunks(input.film, input.words) : [];
|
|
327
370
|
if (chunks.length === 0 && overlays.length === 0) return null;
|
|
@@ -391,6 +434,10 @@ export function buildFootageDraftCaptions(input: FootageDraftCaptionsInput): str
|
|
|
391
434
|
const pillColors = { background: colors.captionBackground, accent: lit.style === "box" ? lit.box : colors.captionHighlight };
|
|
392
435
|
const events = chunks.flatMap((chunk, index) => {
|
|
393
436
|
const span = spans[index] as { start: number; end: number };
|
|
437
|
+
if (isRibbon) {
|
|
438
|
+
const ribbonText = toCaptionDisplayText(input.film, chunk.words.map((word) => word.text.replace(/\u00a0/g, " ")).join(" "), input.locale ?? "en-US");
|
|
439
|
+
return getRibbonEvents({ text: ribbonText, span, place: places[index] ?? caption, frame, tilt: getCaptionRibbonTilt(input.film), measure, colors: { background: colors.captionBackground, text: colors.captionText } });
|
|
440
|
+
}
|
|
394
441
|
const styleName = styleNames[index] ?? "Caption";
|
|
395
442
|
const pill =
|
|
396
443
|
style === undefined ? null : getDrawnPill({ words: chunk.words.map((word) => word.text.replace(/\u00a0/g, " ")), span, place: places[index] ?? caption, frame, style, measure, colors: pillColors });
|
|
@@ -417,7 +464,7 @@ export function buildFootageDraftCaptions(input: FootageDraftCaptionsInput): str
|
|
|
417
464
|
"[V4+ Styles]",
|
|
418
465
|
"Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding",
|
|
419
466
|
...styles.map((line) => `Style: ${line}`),
|
|
420
|
-
...(style === undefined || chunks.length === 0 ? [] : [`Style: CaptionShape,${family},${String(caption.fontSize)},&H00FFFFFF,&H00FFFFFF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,7,0,0,0,1`]),
|
|
467
|
+
...((style === undefined && !isRibbon) || chunks.length === 0 ? [] : [`Style: CaptionShape,${family},${String(caption.fontSize)},&H00FFFFFF,&H00FFFFFF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,7,0,0,0,1`]),
|
|
421
468
|
...(overlays.length === 0 ? [] : getDraftOverlayStyles(family, input.overlayColors ?? FOOTAGE_DRAFT_OVERLAY_COLORS)),
|
|
422
469
|
"",
|
|
423
470
|
"[Events]",
|
|
@@ -456,6 +503,8 @@ export interface FootageDraftArgsInput {
|
|
|
456
503
|
overlays?: readonly ResolvedOverlay[];
|
|
457
504
|
/** The folder libass loads the captions' font from, or null for the system's fonts. */
|
|
458
505
|
fontsDir: string | null;
|
|
506
|
+
/** Each split segment's layer (`renderSplitLayerPng` at the draft's size), by segment id; needed for every split. */
|
|
507
|
+
splitLayers?: Record<string, string>;
|
|
459
508
|
output: string;
|
|
460
509
|
/**
|
|
461
510
|
* ffmpeg's threads for every segment's decoder, the filter graph and the encoder; by default ffmpeg's own choice,
|
|
@@ -620,15 +669,15 @@ export function buildFootageDraftArgs(input: FootageDraftArgsInput): string[] {
|
|
|
620
669
|
const threads = getThreadArgs(input.threads, "draft.threads");
|
|
621
670
|
const inputs: string[] = [];
|
|
622
671
|
const parts: string[] = [];
|
|
672
|
+
let inputCount = 0;
|
|
673
|
+
const getClip = (id: string): string => {
|
|
674
|
+
const clip = input.clips[id];
|
|
675
|
+
if (clip === undefined) throw new Error(`No file for clip "${id}" of the EDL.`);
|
|
676
|
+
return clip;
|
|
677
|
+
};
|
|
623
678
|
edl.segments.forEach((segment, index) => {
|
|
624
|
-
const clip = input.clips[segment.clip];
|
|
625
|
-
if (clip === undefined) throw new Error(`No file for clip "${segment.clip}" of the EDL.`);
|
|
626
679
|
const plan = plans[index] as DraftSegmentPlan;
|
|
627
|
-
|
|
628
|
-
inputs.push(...threads.output, "-ss", String(r3(segment.start)), "-t", String(plan.seconds), "-i", clip);
|
|
629
|
-
const filters = [
|
|
630
|
-
"setpts=PTS-STARTPTS",
|
|
631
|
-
...buildPictureFilters(plan, draft),
|
|
680
|
+
const fit = [
|
|
632
681
|
"setsar=1",
|
|
633
682
|
`fps=${FOOTAGE_FPS}`,
|
|
634
683
|
"format=yuv420p",
|
|
@@ -640,7 +689,23 @@ export function buildFootageDraftArgs(input: FootageDraftArgsInput): string[] {
|
|
|
640
689
|
// ffmpeg 7.1's setpts leaves the frame rate unknown (1/0), which xfade refuses (#1057); fps states it again.
|
|
641
690
|
`fps=${FOOTAGE_FPS}`,
|
|
642
691
|
];
|
|
643
|
-
|
|
692
|
+
const { split } = segment;
|
|
693
|
+
if (split !== undefined) {
|
|
694
|
+
// A split screen holds still: its three bands and its layer, at the draft's size, as the render's picture draws them.
|
|
695
|
+
const layer = input.splitLayers?.[segment.id];
|
|
696
|
+
if (layer === undefined) throw new Error(`No split layer for segment "${segment.id}" of the EDL.`);
|
|
697
|
+
const first = inputCount;
|
|
698
|
+
for (const band of split.bands) inputs.push(...threads.output, "-ss", String(r3(band.start)), "-t", String(plan.seconds), "-i", getClip(band.clip));
|
|
699
|
+
inputs.push(...getSplitLayerInputArgs(layer, plan.seconds, FOOTAGE_FPS));
|
|
700
|
+
inputCount += 4;
|
|
701
|
+
const bands: [string, string, string] = [`${String(first)}:v`, `${String(first + 1)}:v`, `${String(first + 2)}:v`];
|
|
702
|
+
parts.push(...buildSplitScreenFilters({ inputs: bands, layer: `${String(first + 3)}:v`, split, frame: draft, fit: ["setpts=PTS-STARTPTS", ...fit], output: `v${index}`, prefix: `sp${String(index)}` }));
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
// Before an input, -threads sizes that input's decoder: one decoder runs per segment.
|
|
706
|
+
inputs.push(...threads.output, "-ss", String(r3(segment.start)), "-t", String(plan.seconds), "-i", getClip(segment.clip));
|
|
707
|
+
parts.push(`[${inputCount}:v]${["setpts=PTS-STARTPTS", ...buildPictureFilters(plan, draft), ...fit].join(",")}[v${index}]`);
|
|
708
|
+
inputCount += 1;
|
|
644
709
|
});
|
|
645
710
|
let joined = "v0";
|
|
646
711
|
plans.forEach((plan, index) => {
|
|
@@ -664,7 +729,7 @@ export function buildFootageDraftArgs(input: FootageDraftArgsInput): string[] {
|
|
|
664
729
|
} else {
|
|
665
730
|
parts.push(`[${joined}]null[draft]`);
|
|
666
731
|
}
|
|
667
|
-
const soundInput =
|
|
732
|
+
const soundInput = inputCount;
|
|
668
733
|
const mix = input.mix ?? null;
|
|
669
734
|
const music = mix === null ? (input.music ?? null) : null;
|
|
670
735
|
if (music !== null) parts.push(`[${soundInput}:a][${soundInput + 1}:a]amix=inputs=2:duration=first:normalize=0[sound]`);
|
|
@@ -848,7 +913,9 @@ async function runRenderFootageDraft(
|
|
|
848
913
|
...(overlays.length === 0 ? {} : { overlays, overlayColors }),
|
|
849
914
|
...(Object.keys(roleFonts).length === 0 ? {} : { overlayFonts: Object.fromEntries(Object.entries(roleFonts).map(([role, chosen]) => [role, chosen.family])) }),
|
|
850
915
|
...(options.brand?.locale === undefined ? {} : { locale: options.brand.locale }),
|
|
851
|
-
...(options.brand?.style === undefined ? {} : { style: options.brand.style
|
|
916
|
+
...(options.brand?.style === undefined ? {} : { style: options.brand.style }),
|
|
917
|
+
// A drawn pill and a ribbon break their lines by the font's own widths.
|
|
918
|
+
...(options.brand?.style !== undefined || film.captionStyle === "ribbon" ? { measure: createDraftTextMeasure(readFileSync(font.file)) } : {}),
|
|
852
919
|
});
|
|
853
920
|
if (captions !== null) {
|
|
854
921
|
writeFileSync(join(draftDir, "captions.ass"), captions);
|
|
@@ -901,6 +968,7 @@ async function runRenderFootageDraft(
|
|
|
901
968
|
prepared = mixed.value;
|
|
902
969
|
}
|
|
903
970
|
report("film", 0);
|
|
971
|
+
const splitLayers = writeSplitLayers(edl.segments, getFootageDraftFrame(frame, options.width), draftDir, true);
|
|
904
972
|
// Run in the draft folder: the captions file and the font folder are relative names, so no path needs escaping in the filter graph.
|
|
905
973
|
const args = buildFootageDraftArgs({
|
|
906
974
|
film,
|
|
@@ -915,6 +983,7 @@ async function runRenderFootageDraft(
|
|
|
915
983
|
captions: captions === null ? null : "captions.ass",
|
|
916
984
|
...(overlays.length === 0 ? {} : { overlays }),
|
|
917
985
|
fontsDir: captions === null ? null : "fonts",
|
|
986
|
+
...(Object.keys(splitLayers).length === 0 ? {} : { splitLayers }),
|
|
918
987
|
output,
|
|
919
988
|
});
|
|
920
989
|
await runFfmpeg("The footage draft", args, { ...aborting, output, cwd: draftDir, onSeconds: (done) => report("film", done) });
|