@softure-ai/marketing-kit 0.36.2 → 0.38.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.
@@ -1 +1 @@
1
- {"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../src/footage/draft.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAA6J,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjN,OAAO,EAAkE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAEhI,OAAO,EAAyG,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGrK,OAAO,EAA8D,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE/G,OAAO,EAAyC,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIrG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAE/F,OAAO,EAAgD,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,EAAkC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAmD,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAK9F,OAAO,EAA8B,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAML,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAEjB,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAIvB;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AAC;IACxN;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,4GAA4G;IAC5G,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,4HAA4H;AAC5H,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEjE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,iBAAiB,CAAC;IACzB,mEAAmE;IACnE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,6GAA6G;IAC7G,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,8GAA8G;IAC9G,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;CACzB;AA0BD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,iBAAiB,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAE1N"}
@@ -26,6 +26,7 @@ import { duckingKeyframes, getDuckingOptions } from "./music.js";
26
26
  import { buildSplitScreenFilters, getSplitLayerInputArgs, writeSplitLayers } from "./split-screen.js";
27
27
  import { FOOTAGE_FPS, getThreadArgs } from "./normalize.js";
28
28
  import { findFootageMusic, getFfmpegReporting, getFrame, getSpeechChainFiles, mixFootage, } from "./pipeline.js";
29
+ import { buildPictureList } from "./picture.js";
29
30
  import { runFfmpeg, withFfmpegFailureReporting } from "./process.js";
30
31
  import { buildMusicArgs, buildSpeechArgs, getSpeechCutOptions } from "./render.js";
31
32
  /**
@@ -440,8 +441,7 @@ function buildPictureFilters(plan, draft) {
440
441
  * incoming segment follows.
441
442
  */
442
443
  function buildDrawnJoin(input) {
443
- const { joined, incoming, output, drawn, index } = input;
444
- const at = Math.round(input.plan.start * FOOTAGE_FPS);
444
+ const { joined, incoming, output, drawn, index, at } = input;
445
445
  const p = `d${String(index)}`;
446
446
  return [
447
447
  `[${joined}]split[${p}a][${p}b]`,
@@ -456,16 +456,12 @@ function buildDrawnJoin(input) {
456
456
  ];
457
457
  }
458
458
  /**
459
- * The ffmpeg arguments of the draft: each segment read from its own seek into its clip, zoomed and scaled to the
460
- * draft's width, joined by `xfade` at `fade` cuts and `concat` at the others, the captions burned in (`ass`), the
461
- * film's mix copied under it (or the speech and music tracks mixed and encoded to AAC); H.264 yuv420p with fast start,
462
- * exactly the cut's length.
459
+ * Segments `first` to `last` read from their clips, zoomed and joined as the draft joins them (`xfade` at a fade,
460
+ * `concat` at the others, a drawn transition blended in), on a stream that starts at segment `first`'s start. The
461
+ * whole cut (`first` 0) gives exactly the one-run draft's graph.
463
462
  */
464
- export function buildFootageDraftArgs(input) {
463
+ function buildDraftPictureGraph({ input, plans, draft, threads, first, last }) {
465
464
  const { edl } = input;
466
- const draft = getFootageDraftFrame(input.frame, input.width);
467
- const plans = planFootageDraft(input.film, edl, input.overlays ?? []);
468
- const threads = getThreadArgs(input.threads, "draft.threads");
469
465
  const inputs = [];
470
466
  const parts = [];
471
467
  let inputCount = 0;
@@ -475,7 +471,9 @@ export function buildFootageDraftArgs(input) {
475
471
  throw new Error(`No file for clip "${id}" of the EDL.`);
476
472
  return clip;
477
473
  };
478
- edl.segments.forEach((segment, index) => {
474
+ const base = plans[first].start;
475
+ for (let index = first; index <= last; index += 1) {
476
+ const segment = edl.segments[index];
479
477
  const plan = plans[index];
480
478
  const fit = [
481
479
  "setsar=1",
@@ -495,67 +493,67 @@ export function buildFootageDraftArgs(input) {
495
493
  const layer = input.splitLayers?.[segment.id];
496
494
  if (layer === undefined)
497
495
  throw new Error(`No split layer for segment "${segment.id}" of the EDL.`);
498
- const first = inputCount;
496
+ const bandsFrom = inputCount;
499
497
  for (const band of split.bands)
500
498
  inputs.push(...threads.output, "-ss", String(r3(band.start)), "-t", String(plan.seconds), "-i", getClip(band.clip));
501
499
  inputs.push(...getSplitLayerInputArgs(layer, plan.seconds, FOOTAGE_FPS));
502
500
  inputCount += 4;
503
- const bands = [`${String(first)}:v`, `${String(first + 1)}:v`, `${String(first + 2)}:v`];
504
- 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)}` }));
505
- return;
501
+ const bands = [`${String(bandsFrom)}:v`, `${String(bandsFrom + 1)}:v`, `${String(bandsFrom + 2)}:v`];
502
+ parts.push(...buildSplitScreenFilters({ inputs: bands, layer: `${String(bandsFrom + 3)}:v`, split, frame: draft, fit: ["setpts=PTS-STARTPTS", ...fit], output: `v${index}`, prefix: `sp${String(index)}` }));
503
+ continue;
506
504
  }
507
505
  // Before an input, -threads sizes that input's decoder: one decoder runs per segment.
508
506
  inputs.push(...threads.output, "-ss", String(r3(segment.start)), "-t", String(plan.seconds), "-i", getClip(segment.clip));
509
507
  parts.push(`[${inputCount}:v]${["setpts=PTS-STARTPTS", ...buildPictureFilters(plan, draft), ...fit].join(",")}[v${index}]`);
510
508
  inputCount += 1;
511
- });
512
- let joined = "v0";
513
- plans.forEach((plan, index) => {
514
- if (index === 0)
515
- return;
509
+ }
510
+ let joined = `v${String(first)}`;
511
+ for (let index = first + 1; index <= last; index += 1) {
512
+ const plan = plans[index];
516
513
  const label = `j${index}`;
514
+ // The joined stream starts at segment `first`: offsets are counted from there (from 0 for the whole cut).
515
+ const start = base === 0 ? plan.start : r3(plan.start - base);
517
516
  if (plan.drawn !== null) {
518
- parts.push(...buildDrawnJoin({ joined, incoming: `v${index}`, output: label, plan, drawn: plan.drawn, frame: draft, index }));
517
+ const at = base === 0 ? Math.round(plan.start * FOOTAGE_FPS) : Math.round(plan.start * FOOTAGE_FPS) - Math.round(base * FOOTAGE_FPS);
518
+ parts.push(...buildDrawnJoin({ joined, incoming: `v${index}`, output: label, at, drawn: plan.drawn, frame: draft, index }));
519
519
  joined = label;
520
- return;
520
+ continue;
521
521
  }
522
522
  parts.push(plan.fade > 0
523
- ? `[${joined}][v${index}]xfade=transition=fade:duration=${plan.fade}:offset=${plan.start}[${label}]`
523
+ ? `[${joined}][v${index}]xfade=transition=fade:duration=${plan.fade}:offset=${start}[${label}]`
524
524
  : // concat changes the time base; xfade needs both of its inputs on the segments' own.
525
525
  `[${joined}][v${index}]concat=n=2:v=1:a=0,settb=1/${FOOTAGE_FPS},fps=${FOOTAGE_FPS}[${label}]`);
526
526
  joined = label;
527
- });
528
- if (input.captions !== null) {
529
- parts.push(`[${joined}]ass=filename=${input.captions}${input.fontsDir === null ? "" : `:fontsdir=${input.fontsDir}`}[draft]`);
530
- }
531
- else {
532
- parts.push(`[${joined}]null[draft]`);
533
527
  }
534
- const soundInput = inputCount;
528
+ return { inputs, parts, joined, inputCount };
529
+ }
530
+ /** The draft's sound read from input `soundInput` on: the film's prepared mix copied, or the speech (and music) mixed. */
531
+ function getDraftSound(input, soundInput) {
535
532
  const mix = input.mix ?? null;
536
533
  const music = mix === null ? (input.music ?? null) : null;
537
- if (music !== null)
538
- parts.push(`[${soundInput}:a][${soundInput + 1}:a]amix=inputs=2:duration=first:normalize=0[sound]`);
539
- const seconds = getEdlDuration(edl);
540
- // A prepared mix is copied: it was measured as encoded, and a second encode would move its loudness and true peak.
541
- const audioCodec = mix === null ? ["-c:a", "aac", "-b:a", DRAFT_AUDIO_BITRATE] : ["-c:a", "copy"];
534
+ return {
535
+ inputs: ["-i", mix ?? input.speech, ...(music === null ? [] : ["-i", music])],
536
+ parts: music === null ? [] : [`[${soundInput}:a][${soundInput + 1}:a]amix=inputs=2:duration=first:normalize=0[sound]`],
537
+ map: music === null ? `${soundInput}:a` : "[sound]",
538
+ // A prepared mix is copied: it was measured as encoded, and a second encode would move its loudness and true peak.
539
+ codec: mix === null ? ["-c:a", "aac", "-b:a", DRAFT_AUDIO_BITRATE] : ["-c:a", "copy"],
540
+ };
541
+ }
542
+ /** The filter that burns the captions into `joined` (or passes it through) as `[draft]`. */
543
+ function getCaptionsFilter(joined, input) {
544
+ if (input.captions === null)
545
+ return `[${joined}]null[draft]`;
546
+ return `[${joined}]ass=filename=${input.captions}${input.fontsDir === null ? "" : `:fontsdir=${input.fontsDir}`}[draft]`;
547
+ }
548
+ /** The draft's output: the picture and sound mapped, exactly `seconds` long, H.264 yuv420p with fast start. */
549
+ function getDraftOutputArgs(input) {
542
550
  return [
543
- "-v",
544
- "error",
545
- "-y",
546
- ...threads.global,
547
- ...inputs,
548
- "-i",
549
- mix ?? input.speech,
550
- ...(music === null ? [] : ["-i", music]),
551
- "-filter_complex",
552
- parts.join(";"),
553
551
  "-map",
554
552
  "[draft]",
555
553
  "-map",
556
- music === null ? `${soundInput}:a` : "[sound]",
554
+ input.sound.map,
557
555
  "-t",
558
- String(seconds),
556
+ String(input.seconds),
559
557
  "-c:v",
560
558
  "libx264",
561
559
  "-preset",
@@ -564,13 +562,141 @@ export function buildFootageDraftArgs(input) {
564
562
  String(DRAFT_CRF),
565
563
  "-pix_fmt",
566
564
  "yuv420p",
567
- ...audioCodec,
565
+ ...input.sound.codec,
568
566
  "-movflags",
569
567
  "+faststart",
568
+ ...input.threads,
569
+ input.output,
570
+ ];
571
+ }
572
+ /**
573
+ * The ffmpeg arguments of the draft in one run (`assembly: "single"`): each segment read from its own seek into its
574
+ * clip, zoomed and scaled to the draft's width, joined by `xfade` at `fade` cuts and `concat` at the others, the
575
+ * captions burned in (`ass`), the film's mix copied under it (or the speech and music tracks mixed and encoded to AAC);
576
+ * H.264 yuv420p with fast start, exactly the cut's length. Every segment keeps its own decoder for the whole run, so
577
+ * its memory grows with the number of cuts (`estimateFootageDraftMemory`).
578
+ */
579
+ export function buildFootageDraftArgs(input) {
580
+ const { edl } = input;
581
+ const draft = getFootageDraftFrame(input.frame, input.width);
582
+ const plans = planFootageDraft(input.film, edl, input.overlays ?? []);
583
+ const threads = getThreadArgs(input.threads, "draft.threads");
584
+ const graph = buildDraftPictureGraph({ input, plans, draft, threads, first: 0, last: edl.segments.length - 1 });
585
+ const sound = getDraftSound(input, graph.inputCount);
586
+ const parts = [...graph.parts, getCaptionsFilter(graph.joined, input), ...sound.parts];
587
+ return ["-v", "error", "-y", ...threads.global, ...graph.inputs, ...sound.inputs, "-filter_complex", parts.join(";"), ...getDraftOutputArgs({ sound, seconds: getEdlDuration(edl), threads: threads.output, output: input.output })];
588
+ }
589
+ /** How a footage draft's picture is assembled: in pieces then joined (bounded memory), or in one ffmpeg run. */
590
+ export const FOOTAGE_DRAFT_ASSEMBLIES = ["pieces", "single"];
591
+ /** How many segments a piece of a `pieces` draft holds by default: one ffmpeg run decodes at most these (and a lead). */
592
+ export const FOOTAGE_DRAFT_PIECE_SEGMENTS = 4;
593
+ /** The CRF of a piece: near transparent, so the join's one encode at the draft's CRF sets the draft's quality. */
594
+ const DRAFT_PIECE_CRF = 16;
595
+ /** The film frame a film second falls on. */
596
+ function toDraftFrame(seconds) {
597
+ return Math.round(seconds * FOOTAGE_FPS);
598
+ }
599
+ /**
600
+ * The pieces of a `pieces` draft: `segmentsPerPiece` segments each (a positive whole number), the last piece what is
601
+ * left. Throws on an EDL without segments.
602
+ */
603
+ export function planFootageDraftPieces(plans, seconds, segmentsPerPiece = FOOTAGE_DRAFT_PIECE_SEGMENTS) {
604
+ if (!Number.isInteger(segmentsPerPiece) || segmentsPerPiece < 1)
605
+ throw new Error(`draft.segmentsPerPiece must be a positive whole number, got ${segmentsPerPiece}.`);
606
+ if (plans.length === 0)
607
+ throw new Error("The EDL has no segments.");
608
+ const pieces = [];
609
+ for (let first = 0; first < plans.length; first += segmentsPerPiece) {
610
+ const last = Math.min(plans.length, first + segmentsPerPiece) - 1;
611
+ const plan = plans[first];
612
+ const from = first > 0 && (plan.fade > 0 || plan.drawn !== null) ? first - 1 : first;
613
+ const frame = toDraftFrame(plan.start);
614
+ const next = plans[last + 1];
615
+ const end = next === undefined ? toDraftFrame(seconds) : toDraftFrame(next.start);
616
+ pieces.push({ first, last, from, skipFrames: frame - toDraftFrame(plans[from].start), frame, frames: Math.max(1, end - frame) });
617
+ }
618
+ return pieces;
619
+ }
620
+ /**
621
+ * One piece's ffmpeg arguments: its segments (and a lead segment's tail) as the one-run draft draws them, cut to the
622
+ * piece's own frames, H.264 without sound or captions. A piece decodes only its own segments, so its memory does not
623
+ * grow with the cut.
624
+ */
625
+ export function buildFootageDraftPieceArgs(input) {
626
+ const { piece } = input;
627
+ const draft = getFootageDraftFrame(input.frame, input.width);
628
+ const plans = planFootageDraft(input.film, input.edl, input.overlays ?? []);
629
+ const threads = getThreadArgs(input.threads, "draft.threads");
630
+ const full = { ...input, speech: "", captions: null, fontsDir: null };
631
+ const graph = buildDraftPictureGraph({ input: full, plans, draft, threads, first: piece.from, last: piece.last });
632
+ const cut = `[${graph.joined}]trim=start_frame=${String(piece.skipFrames)}:end_frame=${String(piece.skipFrames + piece.frames)},setpts=PTS-STARTPTS[picture]`;
633
+ return [
634
+ "-v",
635
+ "error",
636
+ "-y",
637
+ ...threads.global,
638
+ ...graph.inputs,
639
+ "-filter_complex",
640
+ [...graph.parts, cut].join(";"),
641
+ "-map",
642
+ "[picture]",
643
+ "-an",
644
+ "-frames:v",
645
+ String(piece.frames),
646
+ "-c:v",
647
+ "libx264",
648
+ "-preset",
649
+ "veryfast",
650
+ "-crf",
651
+ String(DRAFT_PIECE_CRF),
652
+ "-pix_fmt",
653
+ "yuv420p",
570
654
  ...threads.output,
571
655
  input.output,
572
656
  ];
573
657
  }
658
+ /**
659
+ * The join of a `pieces` draft: the pieces read one after the other by the concat demuxer (one decoder), the captions
660
+ * burned in once over the whole film, the sound as the one-run draft takes it, the same encoder and length.
661
+ */
662
+ export function buildFootageDraftJoinArgs(input) {
663
+ const threads = getThreadArgs(input.threads, "draft.threads");
664
+ const sound = getDraftSound(input, 1);
665
+ const parts = [getCaptionsFilter("0:v", input), ...sound.parts];
666
+ return ["-v", "error", "-y", ...threads.global, ...threads.output, "-f", "concat", "-safe", "0", "-i", input.list, ...sound.inputs, "-filter_complex", parts.join(";"), ...getDraftOutputArgs({ sound, seconds: input.seconds, threads: threads.output, output: input.output })];
667
+ }
668
+ /** The working memory of a draft's ffmpeg run that does not grow with the cut (the encoder, libass, the graph's base). */
669
+ const DRAFT_BASE_MB = 250;
670
+ /** One decoder of a 1080x1920 source with its zoom and frame queues, as measured on a production worker (about 70 MB). */
671
+ const DRAFT_DECODER_MB_AT_1080P = 70;
672
+ const FULL_HD_PIXELS = 1080 * 1920;
673
+ /** The decoders a segment opens: its clip, or a split screen's three bands. */
674
+ function countDecoders(segment) {
675
+ return segment.split === undefined ? 1 : segment.split.bands.length;
676
+ }
677
+ /**
678
+ * The draft's peak memory by the kit's estimate, before it runs: a `single` draft opens every segment's decoder at
679
+ * once, a `pieces` draft at most one piece's (with a lead segment). An app compares it with its worker's memory limit
680
+ * and warns before a draft that would not fit.
681
+ */
682
+ export function estimateFootageDraftMemory(input) {
683
+ const segments = input.edl.segments;
684
+ const per = segments.map(countDecoders);
685
+ let decoders = per.reduce((sum, count) => sum + count, 0);
686
+ if (input.assembly === "pieces") {
687
+ const size = input.segmentsPerPiece ?? FOOTAGE_DRAFT_PIECE_SEGMENTS;
688
+ if (!Number.isInteger(size) || size < 1)
689
+ throw new Error(`draft.segmentsPerPiece must be a positive whole number, got ${size}.`);
690
+ decoders = 0;
691
+ for (let first = 0; first < per.length; first += size) {
692
+ // A lead segment is counted whenever there is one before: the estimate does not read transitions.
693
+ const piece = per.slice(Math.max(0, first - 1), first + size).reduce((sum, count) => sum + count, 0);
694
+ decoders = Math.max(decoders, piece);
695
+ }
696
+ }
697
+ const decoderMb = (DRAFT_DECODER_MB_AT_1080P * input.frame.width * input.frame.height) / FULL_HD_PIXELS;
698
+ return { decoders, peakMb: Math.round(DRAFT_BASE_MB + decoders * decoderMb) };
699
+ }
574
700
  /**
575
701
  * The music the draft can play without spending: the film's own file, or generated music already in the paid cache
576
702
  * (looked up as the render looks it up, `findFootageMusic`). Never calls a provider.
@@ -599,8 +725,9 @@ async function findDraftMusic(film, edl, clips, options) {
599
725
  }
600
726
  /**
601
727
  * Makes the draft of a cut film: the speech track, the ducked music track (when it costs nothing), the captions file
602
- * and its font in `<buildDir>/draft/`, then one ffmpeg run (`buildFootageDraftArgs`). Spends nothing: no provider is
603
- * called; takes the same clips, transcript and EDL as `renderFootage`.
728
+ * and its font in `<buildDir>/draft/`, then the picture: in pieces joined with the captions (`assembly: "pieces"`, the
729
+ * default, memory bounded by one piece) or in one ffmpeg run (`"single"`, `buildFootageDraftArgs`). Spends nothing: no
730
+ * provider is called; takes the same clips, transcript and EDL as `renderFootage`.
604
731
  */
605
732
  export function renderFootageDraft(film, clips, transcript, edl, options) {
606
733
  return withFfmpegFailureReporting(getFfmpegReporting(options), () => runRenderFootageDraft(film, clips, transcript, edl, options));
@@ -723,24 +850,26 @@ async function runRenderFootageDraft(film, clips, transcript, edl, options) {
723
850
  }
724
851
  report("film", 0);
725
852
  const splitLayers = writeSplitLayers(edl.segments, getFootageDraftFrame(frame, options.width), draftDir, true);
853
+ const assembly = options.assembly ?? "pieces";
726
854
  // Run in the draft folder: the captions file and the font folder are relative names, so no path needs escaping in the filter graph.
727
- const args = buildFootageDraftArgs({
855
+ const picture = {
728
856
  film,
729
857
  edl,
730
858
  clips: clipFiles,
731
- speech: speechFile,
732
- music: musicFile,
733
- mix: prepared?.audioFile ?? null,
734
859
  frame,
735
860
  ...(options.width === undefined ? {} : { width: options.width }),
736
861
  ...(options.threads === undefined ? {} : { threads: options.threads }),
737
- captions: captions === null ? null : "captions.ass",
738
862
  ...(overlays.length === 0 ? {} : { overlays }),
739
- fontsDir: captions === null ? null : "fonts",
740
863
  ...(Object.keys(splitLayers).length === 0 ? {} : { splitLayers }),
741
- output,
742
- });
743
- await runFfmpeg("The footage draft", args, { ...aborting, output, cwd: draftDir, onSeconds: (done) => report("film", done) });
864
+ };
865
+ const sound = { speech: speechFile, music: musicFile, mix: prepared?.audioFile ?? null, captions: captions === null ? null : "captions.ass", fontsDir: captions === null ? null : "fonts" };
866
+ let pieceCount = 1;
867
+ if (assembly === "single") {
868
+ await runFfmpeg("The footage draft", buildFootageDraftArgs({ ...picture, ...sound, output }), { ...aborting, output, cwd: draftDir, onSeconds: (done) => report("film", done) });
869
+ }
870
+ else {
871
+ pieceCount = await assembleDraftInPieces({ picture, sound, seconds, draftDir, output, aborting, segmentsPerPiece: options.segmentsPerPiece, onSeconds: (done) => report("film", done) });
872
+ }
744
873
  const measured = await measureDraftLoudness(output, mixLoudness, prepared !== null, aborting);
745
874
  if (!measured.ok)
746
875
  return measured;
@@ -761,6 +890,8 @@ async function runRenderFootageDraft(film, clips, transcript, edl, options) {
761
890
  music: draftMusic,
762
891
  captionFont: captions === null ? null : font.family,
763
892
  seconds,
893
+ assembly,
894
+ pieces: pieceCount,
764
895
  width: draft.width,
765
896
  height: draft.height,
766
897
  bytes,
@@ -769,6 +900,43 @@ async function runRenderFootageDraft(film, clips, transcript, edl, options) {
769
900
  mix: prepared?.mix ?? null,
770
901
  });
771
902
  }
903
+ /** The share of the film step the pieces take; the join takes the rest. */
904
+ const PIECES_SHARE = 0.8;
905
+ /**
906
+ * Draws the picture piece by piece into `<draftDir>/pieces/` (one ffmpeg at a time), then joins the pieces with the
907
+ * captions and the sound into `output`. The pieces are removed after the join; a failed run leaves them for its
908
+ * snapshot. Answers the number of pieces.
909
+ */
910
+ async function assembleDraftInPieces(run) {
911
+ const { picture, aborting, draftDir } = run;
912
+ const plans = planFootageDraft(picture.film, picture.edl, picture.overlays ?? []);
913
+ const pieces = planFootageDraftPieces(plans, run.seconds, run.segmentsPerPiece);
914
+ const piecesDir = join(draftDir, "pieces");
915
+ mkdirSync(piecesDir, { recursive: true });
916
+ const files = [];
917
+ for (const [index, piece] of pieces.entries()) {
918
+ const name = `piece-${String(index).padStart(4, "0")}.mp4`;
919
+ const file = join(piecesDir, name);
920
+ const at = piece.frame / FOOTAGE_FPS;
921
+ await runFfmpeg(`The footage draft's piece ${String(index + 1)} of ${String(pieces.length)}`, buildFootageDraftPieceArgs({ ...picture, piece, output: join("pieces", name) }), {
922
+ ...aborting,
923
+ output: file,
924
+ cwd: draftDir,
925
+ onSeconds: (done) => run.onSeconds(Math.min(run.seconds, at + done) * PIECES_SHARE),
926
+ });
927
+ files.push(name);
928
+ }
929
+ const list = join(piecesDir, "pieces.txt");
930
+ writeFileSync(list, buildPictureList(files));
931
+ await runFfmpeg("The footage draft's join", buildFootageDraftJoinArgs({ ...run.sound, list: join("pieces", "pieces.txt"), seconds: run.seconds, ...(picture.threads === undefined ? {} : { threads: picture.threads }), output: run.output }), {
932
+ ...aborting,
933
+ output: run.output,
934
+ cwd: draftDir,
935
+ onSeconds: (done) => run.onSeconds(run.seconds * PIECES_SHARE + Math.min(run.seconds, done) * (1 - PIECES_SHARE)),
936
+ });
937
+ rmSync(piecesDir, { recursive: true, force: true });
938
+ return pieces.length;
939
+ }
772
940
  /**
773
941
  * The written draft's sound measured as `finishFootage` measures the finished film: held to `mixLoudness` when the mix
774
942
  * stage made it (a miss fails, a near miss inside `warnTolerance` carries `warning`), reported otherwise; null when