@softure-ai/marketing-kit 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +98 -0
- package/README.md +130 -17
- package/dist/cli/footage.d.ts.map +1 -1
- package/dist/cli/footage.js +5 -2
- package/dist/cli/footage.js.map +1 -1
- package/dist/compose/compose.d.ts.map +1 -1
- package/dist/compose/compose.js +3 -3
- package/dist/compose/compose.js.map +1 -1
- package/dist/compose/timeline.d.ts +16 -0
- package/dist/compose/timeline.d.ts.map +1 -1
- package/dist/compose/timeline.js +17 -1
- package/dist/compose/timeline.js.map +1 -1
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +25 -2
- package/dist/config/config.js.map +1 -1
- package/dist/config/schema.d.ts +17 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +61 -3
- package/dist/config/schema.js.map +1 -1
- package/dist/footage/audio.d.ts +6 -2
- package/dist/footage/audio.d.ts.map +1 -1
- package/dist/footage/audio.js +15 -3
- package/dist/footage/audio.js.map +1 -1
- package/dist/footage/captions.d.ts +26 -3
- package/dist/footage/captions.d.ts.map +1 -1
- package/dist/footage/captions.js +35 -2
- package/dist/footage/captions.js.map +1 -1
- package/dist/footage/compose.d.ts +13 -2
- package/dist/footage/compose.d.ts.map +1 -1
- package/dist/footage/compose.js +79 -28
- package/dist/footage/compose.js.map +1 -1
- package/dist/footage/cuts.d.ts +44 -0
- package/dist/footage/cuts.d.ts.map +1 -0
- package/dist/footage/cuts.js +83 -0
- package/dist/footage/cuts.js.map +1 -0
- package/dist/footage/disk.d.ts +25 -0
- package/dist/footage/disk.d.ts.map +1 -0
- package/dist/footage/disk.js +72 -0
- package/dist/footage/disk.js.map +1 -0
- package/dist/footage/draft.d.ts +119 -0
- package/dist/footage/draft.d.ts.map +1 -0
- package/dist/footage/draft.js +296 -0
- package/dist/footage/draft.js.map +1 -0
- package/dist/footage/edl.d.ts +2 -1
- package/dist/footage/edl.d.ts.map +1 -1
- package/dist/footage/edl.js +5 -2
- package/dist/footage/edl.js.map +1 -1
- package/dist/footage/elevenlabs.d.ts.map +1 -1
- package/dist/footage/elevenlabs.js +2 -0
- package/dist/footage/elevenlabs.js.map +1 -1
- package/dist/footage/film.d.ts +54 -3
- package/dist/footage/film.d.ts.map +1 -1
- package/dist/footage/film.js +7 -1
- package/dist/footage/film.js.map +1 -1
- package/dist/footage/keyterms.d.ts +26 -0
- package/dist/footage/keyterms.d.ts.map +1 -0
- package/dist/footage/keyterms.js +36 -0
- package/dist/footage/keyterms.js.map +1 -0
- package/dist/footage/loudness.d.ts +20 -3
- package/dist/footage/loudness.d.ts.map +1 -1
- package/dist/footage/loudness.js +36 -18
- package/dist/footage/loudness.js.map +1 -1
- package/dist/footage/music.d.ts +3 -0
- package/dist/footage/music.d.ts.map +1 -1
- package/dist/footage/music.js +5 -0
- package/dist/footage/music.js.map +1 -1
- package/dist/footage/normalize.d.ts +30 -2
- package/dist/footage/normalize.d.ts.map +1 -1
- package/dist/footage/normalize.js +39 -11
- package/dist/footage/normalize.js.map +1 -1
- package/dist/footage/paid.d.ts +2 -1
- package/dist/footage/paid.d.ts.map +1 -1
- package/dist/footage/paid.js +13 -3
- package/dist/footage/paid.js.map +1 -1
- package/dist/footage/picture.d.ts +42 -0
- package/dist/footage/picture.d.ts.map +1 -0
- package/dist/footage/picture.js +141 -0
- package/dist/footage/picture.js.map +1 -0
- package/dist/footage/pipeline.d.ts +66 -4
- package/dist/footage/pipeline.d.ts.map +1 -1
- package/dist/footage/pipeline.js +172 -34
- package/dist/footage/pipeline.js.map +1 -1
- package/dist/footage/process.d.ts +2 -0
- package/dist/footage/process.d.ts.map +1 -1
- package/dist/footage/process.js +1 -0
- package/dist/footage/process.js.map +1 -1
- package/dist/footage/providers.d.ts +12 -3
- package/dist/footage/providers.d.ts.map +1 -1
- package/dist/footage/providers.js.map +1 -1
- package/dist/footage/publish.d.ts +4 -2
- package/dist/footage/publish.d.ts.map +1 -1
- package/dist/footage/publish.js +8 -5
- package/dist/footage/publish.js.map +1 -1
- package/dist/footage/render.d.ts +18 -3
- package/dist/footage/render.d.ts.map +1 -1
- package/dist/footage/render.js +67 -16
- package/dist/footage/render.js.map +1 -1
- package/dist/footage/tools.d.ts +15 -3
- package/dist/footage/tools.d.ts.map +1 -1
- package/dist/footage/tools.js +15 -2
- package/dist/footage/tools.js.map +1 -1
- package/dist/index.d.ts +14 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/docker/footage-worker.Dockerfile +7 -0
- package/fonts/DejaVuSans-Bold-Latin.ttf +0 -0
- package/fonts/LICENSE-DejaVu.txt +46 -0
- package/fonts/README.md +12 -0
- package/package.json +2 -1
- package/schema/marketing.schema.json +112 -4
- package/src/cli/footage.ts +4 -2
- package/src/compose/compose.ts +13 -3
- package/src/compose/timeline.ts +27 -1
- package/src/config/config.ts +26 -2
- package/src/config/schema.ts +63 -3
- package/src/footage/audio.ts +16 -3
- package/src/footage/captions.ts +45 -4
- package/src/footage/compose.ts +90 -28
- package/src/footage/cuts.ts +104 -0
- package/src/footage/disk.ts +75 -0
- package/src/footage/draft.ts +395 -0
- package/src/footage/edl.ts +5 -2
- package/src/footage/elevenlabs.ts +1 -0
- package/src/footage/film.ts +63 -5
- package/src/footage/keyterms.ts +38 -0
- package/src/footage/loudness.ts +38 -16
- package/src/footage/music.ts +7 -0
- package/src/footage/normalize.ts +51 -10
- package/src/footage/paid.ts +12 -3
- package/src/footage/picture.ts +179 -0
- package/src/footage/pipeline.ts +219 -37
- package/src/footage/process.ts +3 -0
- package/src/footage/providers.ts +10 -3
- package/src/footage/publish.ts +8 -5
- package/src/footage/render.ts +77 -16
- package/src/footage/tools.ts +23 -3
- package/src/index.ts +70 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"film.d.ts","sourceRoot":"","sources":["../../src/footage/film.ts"],"names":[],"mappings":"AAA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0E;IAC1E,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,+GAA+G;IAC/G,eAAe,EAAE,MAAM,CAAC;IACxB,0DAA0D;IAC1D,eAAe,EAAE,OAAO,CAAC;IACzB,sEAAsE;IACtE,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY,EAAE,WAAiK,CAAC;AAE7L,4DAA4D;AAC5D,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,WAAW,CAE3E;AAED,eAAO,MAAM,oBAAoB;;;CAA+C,CAAC"}
|
package/dist/footage/film.js
CHANGED
|
@@ -14,6 +14,10 @@ export const CLIP_FITS = ["auto", "crop", "blur"];
|
|
|
14
14
|
* punch-in that hides a jump cut inside one talking clip) or `whoosh` (a hard cut with the whoosh sound).
|
|
15
15
|
*/
|
|
16
16
|
export const CUT_TRANSITIONS = ["cut", "fade", "zoom", "whoosh"];
|
|
17
|
+
/** A jump cut's default: a transition, or `auto` to choose `zoom` or `fade` from the frames around each cut. */
|
|
18
|
+
export const JUMP_TRANSITIONS = [...CUT_TRANSITIONS, "auto"];
|
|
19
|
+
/** The frame difference (0-1) from which an `auto` jump cut fades instead of zooming. */
|
|
20
|
+
export const DEFAULT_AUTO_THRESHOLD = 0.08;
|
|
17
21
|
/** Filler words per language, written with repeated letters collapsed (`yyy` and `yyyy` are both `y`). */
|
|
18
22
|
export const DEFAULT_FILLERS = {
|
|
19
23
|
pl: ["y", "e", "yhm", "yh", "ym", "em", "hm", "mhm", "eh", "uh"],
|
|
@@ -27,8 +31,10 @@ export const DEFAULT_CUT = { pauseSeconds: 0.6, padSeconds: 0.12, maxSeconds: nu
|
|
|
27
31
|
/** Hard cuts everywhere: an ordinary phone video, not a promo. */
|
|
28
32
|
export const DEFAULT_TRANSITIONS = { jump: "cut", clip: "cut" };
|
|
29
33
|
export const CAPTION_STYLES = ["phrase", "highlight"];
|
|
34
|
+
/** The smallest a caption line limit shrinks a card's font to, as a share of the caption box's size. */
|
|
35
|
+
export const CAPTION_MIN_FONT_SCALE = 0.7;
|
|
30
36
|
export const CAPTION_PRESETS = ["reels", "shorts", "tiktok", "all"];
|
|
31
|
-
export const DEFAULT_EDIT = { zoomPercent: 108, fadeFrames: 10, kenBurnsPercent: 0, isEndCardWhoosh: false };
|
|
37
|
+
export const DEFAULT_EDIT = { zoomPercent: 108, zoomEaseFrames: 0, fadeFrames: 10, kenBurnsPercent: 0, isEndCardWhoosh: false, cutAudioFadeMs: 20, isCutAudioCrossfade: false };
|
|
32
38
|
/** The film's edit settings with the defaults filled in. */
|
|
33
39
|
export function getFootageEdit(film) {
|
|
34
40
|
return { ...DEFAULT_EDIT, ...film.edit };
|
package/dist/footage/film.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"film.js","sourceRoot":"","sources":["../../src/footage/film.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,2HAA2H;AAC3H,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAIrD;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAI3D;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"film.js","sourceRoot":"","sources":["../../src/footage/film.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,2HAA2H;AAC3H,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAIrD;;;GAGG;AACH,MAAM,CAAC,MAAM,SAA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QAAQ,EAAE,KAAK,CAAU,CAAC;AA2B7E,MAAM,CAAC,MAAM,YAAY,GAAgB,EAAE,WAAW,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;AAE7L,4DAA4D;AAC5D,MAAM,UAAU,cAAc,CAAC,IAA+B;IAC5D,OAAO,EAAE,GAAG,YAAY,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;AAC3C,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,EAAW,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FootageFilm } from "./film.js";
|
|
2
|
+
/**
|
|
3
|
+
* Key terms (Scribe keyterm prompting): names and brand words the transcript should spell as given. Scribe v2 batch
|
|
4
|
+
* limits, checked 2026-11-03 (elevenlabs.io keyterm prompting guide): up to 1000 terms of at most 50 characters and
|
|
5
|
+
* 5 words each. Keyterm prompting is billed on top of the transcription.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SCRIBE_KEYTERM_LIMITS: {
|
|
8
|
+
readonly maxTerms: 1000;
|
|
9
|
+
readonly maxCharacters: 50;
|
|
10
|
+
readonly maxWords: 5;
|
|
11
|
+
};
|
|
12
|
+
export type KeyTermsResult = {
|
|
13
|
+
ok: true;
|
|
14
|
+
terms: string[];
|
|
15
|
+
} | {
|
|
16
|
+
ok: false;
|
|
17
|
+
errors: string[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Key terms trimmed (inner whitespace collapsed to one space), without blanks and exact duplicates, sorted by code
|
|
21
|
+
* point (the same order on every host, so the transcript's cache key is stable), or every limit a term breaks.
|
|
22
|
+
*/
|
|
23
|
+
export declare function normalizeKeyTerms(terms: readonly string[]): KeyTermsResult;
|
|
24
|
+
/** The film's key terms, normalized; none when the film has none. */
|
|
25
|
+
export declare function getFilmKeyTerms(film: Pick<FootageFilm, "keyTerms">): KeyTermsResult;
|
|
26
|
+
//# sourceMappingURL=keyterms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyterms.d.ts","sourceRoot":"","sources":["../../src/footage/keyterms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;CAA8D,CAAC;AAEjG,MAAM,MAAM,cAAc,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAI7F;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,cAAc,CAe1E;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,cAAc,CAEnF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Key terms (Scribe keyterm prompting): names and brand words the transcript should spell as given. Scribe v2 batch
|
|
3
|
+
* limits, checked 2026-11-03 (elevenlabs.io keyterm prompting guide): up to 1000 terms of at most 50 characters and
|
|
4
|
+
* 5 words each. Keyterm prompting is billed on top of the transcription.
|
|
5
|
+
*/
|
|
6
|
+
export const SCRIBE_KEYTERM_LIMITS = { maxTerms: 1000, maxCharacters: 50, maxWords: 5 };
|
|
7
|
+
const compareCodePoints = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
8
|
+
/**
|
|
9
|
+
* Key terms trimmed (inner whitespace collapsed to one space), without blanks and exact duplicates, sorted by code
|
|
10
|
+
* point (the same order on every host, so the transcript's cache key is stable), or every limit a term breaks.
|
|
11
|
+
*/
|
|
12
|
+
export function normalizeKeyTerms(terms) {
|
|
13
|
+
const unique = new Set();
|
|
14
|
+
for (const term of terms) {
|
|
15
|
+
const cleaned = term.trim().replace(/\s+/g, " ");
|
|
16
|
+
if (cleaned.length > 0)
|
|
17
|
+
unique.add(cleaned);
|
|
18
|
+
}
|
|
19
|
+
const { maxTerms, maxCharacters, maxWords } = SCRIBE_KEYTERM_LIMITS;
|
|
20
|
+
const errors = [];
|
|
21
|
+
if (unique.size > maxTerms)
|
|
22
|
+
errors.push(`key terms: ${unique.size} terms, at most ${maxTerms}.`);
|
|
23
|
+
for (const term of unique) {
|
|
24
|
+
if (term.length > maxCharacters)
|
|
25
|
+
errors.push(`key term "${term}": ${term.length} characters, at most ${maxCharacters}.`);
|
|
26
|
+
const words = term.split(" ").length;
|
|
27
|
+
if (words > maxWords)
|
|
28
|
+
errors.push(`key term "${term}": ${words} words, at most ${maxWords}.`);
|
|
29
|
+
}
|
|
30
|
+
return errors.length > 0 ? { ok: false, errors } : { ok: true, terms: [...unique].sort(compareCodePoints) };
|
|
31
|
+
}
|
|
32
|
+
/** The film's key terms, normalized; none when the film has none. */
|
|
33
|
+
export function getFilmKeyTerms(film) {
|
|
34
|
+
return normalizeKeyTerms(film.keyTerms ?? []);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=keyterms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyterms.js","sourceRoot":"","sources":["../../src/footage/keyterms.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAW,CAAC;AAIjG,MAAM,iBAAiB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAA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AC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;AAC9G,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAAC,IAAmC;IACjE,OAAO,iBAAiB,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The speech track's loudness, measured and normalized in two passes of ffmpeg's `loudnorm` (EBU R128): the first
|
|
3
3
|
* pass measures, the second applies one linear gain from that measurement, so a quiet phone clip is not left quiet
|
|
4
|
-
* and a loud one does not clip. It runs before the music is mixed under the
|
|
4
|
+
* and a loud one does not clip. It runs on the speech track before the music is mixed under it, and on the finished
|
|
5
|
+
* film's mix (`FootageFilm.mixLoudness`), so the published file plays at the target whatever the music adds.
|
|
5
6
|
*/
|
|
6
7
|
export interface LoudnessTarget {
|
|
7
8
|
/** Integrated loudness in LUFS. */
|
|
@@ -19,19 +20,35 @@ export interface LoudnessMeasurement {
|
|
|
19
20
|
inputThresh: number;
|
|
20
21
|
targetOffset: number;
|
|
21
22
|
}
|
|
22
|
-
/** The first pass: decodes the
|
|
23
|
+
/** The first pass: decodes the sound only (a film's picture is skipped), prints the measurement on stderr, writes nothing. */
|
|
23
24
|
export declare function buildLoudnessMeasureArgs(input: string, target: LoudnessTarget): string[];
|
|
24
25
|
/** The measurement from the first pass's stderr (its last JSON block); null when there is none or it is incomplete. */
|
|
25
26
|
export declare function readLoudnessMeasurement(stderr: string): LoudnessMeasurement | null;
|
|
26
27
|
/** True when the measured track is silence, which no gain can bring to the target. */
|
|
27
28
|
export declare function isSilent(measurement: LoudnessMeasurement): boolean;
|
|
28
|
-
/** The second pass: one linear gain from the measurement, resampled back to the film's rate (`loudnorm` runs at 192 kHz). */
|
|
29
|
+
/** The second pass's filter: one linear gain from the measurement, resampled back to the film's rate (`loudnorm` runs at 192 kHz). */
|
|
30
|
+
export declare function getLoudnessFilter(measurement: LoudnessMeasurement, target: LoudnessTarget): string;
|
|
31
|
+
/** The speech track's second pass, written as an mp3 at the film's rate. */
|
|
29
32
|
export declare function buildLoudnessArgs(options: {
|
|
30
33
|
input: string;
|
|
31
34
|
measurement: LoudnessMeasurement;
|
|
32
35
|
target: LoudnessTarget;
|
|
33
36
|
output: string;
|
|
34
37
|
}): string[];
|
|
38
|
+
export type LoudnessMeasureOutcome = {
|
|
39
|
+
kind: "measured";
|
|
40
|
+
measurement: LoudnessMeasurement;
|
|
41
|
+
} | {
|
|
42
|
+
kind: "silent";
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The first pass over `input`: its measurement, or silent when no gain can bring it to the target. Throws naming
|
|
46
|
+
* `label` (what is measured) when ffmpeg fails, rejects with the signal's reason on abort.
|
|
47
|
+
*/
|
|
48
|
+
export declare function measureLoudness(input: string, target: LoudnessTarget, options: {
|
|
49
|
+
label: string;
|
|
50
|
+
signal?: AbortSignal;
|
|
51
|
+
}): Promise<LoudnessMeasureOutcome>;
|
|
35
52
|
export type LoudnessOutcome = {
|
|
36
53
|
kind: "normalized";
|
|
37
54
|
measured: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loudness.d.ts","sourceRoot":"","sources":["../../src/footage/loudness.ts"],"names":[],"mappings":"AAOA
|
|
1
|
+
{"version":3,"file":"loudness.d.ts","sourceRoot":"","sources":["../../src/footage/loudness.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AAEH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,+CAA+C;AAC/C,eAAO,MAAM,gBAAgB,EAAE,cAA8C,CAAC;AAQ9E,sFAAsF;AACtF,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,O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AAE5F;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CActM"}
|
package/dist/footage/loudness.js
CHANGED
|
@@ -18,9 +18,9 @@ const measurementSchema = z.looseObject({
|
|
|
18
18
|
function getLoudnormFilter(target) {
|
|
19
19
|
return `loudnorm=I=${target.target}:TP=${target.truePeak}:LRA=${LOUDNESS_RANGE}`;
|
|
20
20
|
}
|
|
21
|
-
/** The first pass: decodes the
|
|
21
|
+
/** The first pass: decodes the sound only (a film's picture is skipped), prints the measurement on stderr, writes nothing. */
|
|
22
22
|
export function buildLoudnessMeasureArgs(input, target) {
|
|
23
|
-
return ["-hide_banner", "-nostats", "-i", input, "-af", `${getLoudnormFilter(target)}:print_format=json`, "-f", "null", "-"];
|
|
23
|
+
return ["-hide_banner", "-nostats", "-i", input, "-vn", "-af", `${getLoudnormFilter(target)}:print_format=json`, "-f", "null", "-"];
|
|
24
24
|
}
|
|
25
25
|
/** The measurement from the first pass's stderr (its last JSON block); null when there is none or it is incomplete. */
|
|
26
26
|
export function readLoudnessMeasurement(stderr) {
|
|
@@ -42,8 +42,13 @@ export function readLoudnessMeasurement(stderr) {
|
|
|
42
42
|
if (!parsed.success)
|
|
43
43
|
return null;
|
|
44
44
|
const value = parsed.data;
|
|
45
|
-
// `-inf`
|
|
46
|
-
const read = (text) =>
|
|
45
|
+
// Silence prints `-inf` loudness and an `inf` offset; both read as infinities, which `isSilent` tells apart.
|
|
46
|
+
const read = (text) => {
|
|
47
|
+
const trimmed = text.trim();
|
|
48
|
+
if (trimmed === "-inf")
|
|
49
|
+
return -Infinity;
|
|
50
|
+
return trimmed === "inf" || trimmed === "+inf" ? Infinity : Number(trimmed);
|
|
51
|
+
};
|
|
47
52
|
const measurement = {
|
|
48
53
|
inputI: read(value.input_i),
|
|
49
54
|
inputTp: read(value.input_tp),
|
|
@@ -57,11 +62,10 @@ export function readLoudnessMeasurement(stderr) {
|
|
|
57
62
|
export function isSilent(measurement) {
|
|
58
63
|
return !Number.isFinite(measurement.inputI) || measurement.inputI < SILENCE_LUFS || !Number.isFinite(measurement.inputThresh);
|
|
59
64
|
}
|
|
60
|
-
/** The second pass: one linear gain from the measurement, resampled back to the film's rate (`loudnorm` runs at 192 kHz). */
|
|
61
|
-
export function
|
|
62
|
-
const { measurement } = options;
|
|
65
|
+
/** The second pass's filter: one linear gain from the measurement, resampled back to the film's rate (`loudnorm` runs at 192 kHz). */
|
|
66
|
+
export function getLoudnessFilter(measurement, target) {
|
|
63
67
|
const filter = [
|
|
64
|
-
getLoudnormFilter(
|
|
68
|
+
getLoudnormFilter(target),
|
|
65
69
|
`measured_I=${measurement.inputI}`,
|
|
66
70
|
`measured_TP=${measurement.inputTp}`,
|
|
67
71
|
`measured_LRA=${measurement.inputLra}`,
|
|
@@ -69,6 +73,10 @@ export function buildLoudnessArgs(options) {
|
|
|
69
73
|
`offset=${measurement.targetOffset}`,
|
|
70
74
|
"linear=true",
|
|
71
75
|
].join(":");
|
|
76
|
+
return `${filter},aresample=${FOOTAGE_SAMPLE_RATE}`;
|
|
77
|
+
}
|
|
78
|
+
/** The speech track's second pass, written as an mp3 at the film's rate. */
|
|
79
|
+
export function buildLoudnessArgs(options) {
|
|
72
80
|
return [
|
|
73
81
|
"-v",
|
|
74
82
|
"error",
|
|
@@ -76,7 +84,7 @@ export function buildLoudnessArgs(options) {
|
|
|
76
84
|
"-i",
|
|
77
85
|
options.input,
|
|
78
86
|
"-af",
|
|
79
|
-
|
|
87
|
+
getLoudnessFilter(options.measurement, options.target),
|
|
80
88
|
"-ar",
|
|
81
89
|
String(FOOTAGE_SAMPLE_RATE),
|
|
82
90
|
"-c:a",
|
|
@@ -87,23 +95,33 @@ export function buildLoudnessArgs(options) {
|
|
|
87
95
|
];
|
|
88
96
|
}
|
|
89
97
|
/**
|
|
90
|
-
*
|
|
91
|
-
* when ffmpeg fails, rejects with the signal's reason on abort.
|
|
98
|
+
* The first pass over `input`: its measurement, or silent when no gain can bring it to the target. Throws naming
|
|
99
|
+
* `label` (what is measured) when ffmpeg fails, rejects with the signal's reason on abort.
|
|
92
100
|
*/
|
|
93
|
-
export async function
|
|
94
|
-
const
|
|
95
|
-
const measured = await runProcess({ command: "ffmpeg", args: buildLoudnessMeasureArgs(input, target), ...signal });
|
|
101
|
+
export async function measureLoudness(input, target, options) {
|
|
102
|
+
const step = `Measuring ${options.label}'s loudness`;
|
|
103
|
+
const measured = await runProcess({ command: "ffmpeg", args: buildLoudnessMeasureArgs(input, target), ...(options.signal === undefined ? {} : { signal: options.signal }) });
|
|
96
104
|
if (measured.kind === "not-started")
|
|
97
|
-
throw new Error(
|
|
105
|
+
throw new Error(`${step}: ffmpeg did not start (${measured.error}).`);
|
|
98
106
|
if (measured.code !== 0)
|
|
99
|
-
throw new Error(
|
|
107
|
+
throw new Error(`${step}: ffmpeg ended with code ${String(measured.code)}: ${measured.stderr.trim().split("\n").slice(-3).join(" | ")}.`);
|
|
100
108
|
const measurement = readLoudnessMeasurement(measured.stderr);
|
|
101
109
|
if (measurement === null)
|
|
102
|
-
throw new Error(
|
|
103
|
-
|
|
110
|
+
throw new Error(`${step}: ffmpeg printed no loudnorm measurement for ${input}.`);
|
|
111
|
+
return isSilent(measurement) ? { kind: "silent" } : { kind: "measured", measurement };
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Measures `input` and writes it normalized to `output`; a silent track is copied as it is. Throws naming the step
|
|
115
|
+
* when ffmpeg fails, rejects with the signal's reason on abort.
|
|
116
|
+
*/
|
|
117
|
+
export async function normalizeLoudness(input, output, target, options = {}) {
|
|
118
|
+
const signal = options.signal === undefined ? {} : { signal: options.signal };
|
|
119
|
+
const measured = await measureLoudness(input, target, { label: "the speech track", ...signal });
|
|
120
|
+
if (measured.kind === "silent") {
|
|
104
121
|
copyFileSync(input, output);
|
|
105
122
|
return { kind: "silent" };
|
|
106
123
|
}
|
|
124
|
+
const { measurement } = measured;
|
|
107
125
|
await runFfmpeg("Normalizing the speech track's loudness", buildLoudnessArgs({ input, measurement, target, output }), {
|
|
108
126
|
...signal,
|
|
109
127
|
output,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loudness.js","sourceRoot":"","sources":["../../src/footage/loudness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"loudness.js","sourceRoot":"","sources":["../../src/footage/loudness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgBrD,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAmB,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC;AAE9E,+GAA+G;AAC/G,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,sEAAsE;AACtE,MAAM,YAAY,GAAG,CAAC,EAAE,CAAC;AAWzB,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC;IACtC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM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,CAAC;IAChG,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/B,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC5B,CAAC;IACD,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAC;IACjC,MAAM,SAAS,CAAC,yCAAyC,EAAE,iBAAiB,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE;QACpH,GAAG,MAAM;QACT,MAAM;QACN,GAAG,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;KAC7E,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;AAC9D,CAAC"}
|
package/dist/footage/music.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TimedWord } from "../voice/voiceover.js";
|
|
2
|
+
import type { FootageMusic } from "./film.js";
|
|
2
3
|
/**
|
|
3
4
|
* Music under the voice: loud between sentences, ducked while someone speaks. The envelope is a list of keyframes
|
|
4
5
|
* computed from the film's word times; ffmpeg applies it to the music file (`volumeExpression`), so the composition
|
|
@@ -18,6 +19,8 @@ export interface DuckingOptions {
|
|
|
18
19
|
/** Two words closer than this stay one stretch of speech. */
|
|
19
20
|
gap?: number;
|
|
20
21
|
}
|
|
22
|
+
/** A film's music settings as ducking options: its volumes, and its attack and release when it sets them. */
|
|
23
|
+
export declare function getDuckingOptions(music: Pick<FootageMusic, "volume" | "duckedVolume" | "attack" | "release">): DuckingOptions;
|
|
21
24
|
/** Stretches of speech: the words joined when less than `gap` seconds apart. */
|
|
22
25
|
export declare function getSpeechSpans(words: TimedWord[], gap: number): {
|
|
23
26
|
start: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"music.d.ts","sourceRoot":"","sources":["../../src/footage/music.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"music.d.ts","sourceRoot":"","sources":["../../src/footage/music.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;GAIG;AAEH,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,6GAA6G;AAC7G,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC,GAAG,cAAc,CAG7H;AAID,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAQhG;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,cAAc,GAAG,cAAc,EAAE,CAsB9F;AAID;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,MAAM,CAapE"}
|
package/dist/footage/music.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/** A film's music settings as ducking options: its volumes, and its attack and release when it sets them. */
|
|
2
|
+
export function getDuckingOptions(music) {
|
|
3
|
+
const { volume, duckedVolume, attack, release } = music;
|
|
4
|
+
return { volume, duckedVolume, ...(attack === undefined ? {} : { attack }), ...(release === undefined ? {} : { release }) };
|
|
5
|
+
}
|
|
1
6
|
const r3 = (value) => Math.round(value * 1000) / 1000 || 0;
|
|
2
7
|
/** Stretches of speech: the words joined when less than `gap` seconds apart. */
|
|
3
8
|
export function getSpeechSpans(words, gap) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"music.js","sourceRoot":"","sources":["../../src/footage/music.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"music.js","sourceRoot":"","sources":["../../src/footage/music.ts"],"names":[],"mappings":"AAyBA,6GAA6G;AAC7G,MAAM,UAAU,iBAAiB,CAAC,KAA2E;IAC3G,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACxD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC9H,CAAC;AAED,MAAM,EAAE,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AAE3E,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC,KAAkB,EAAE,GAAW;IAC5D,MAAM,KAAK,GAAqC,EAAE,CAAC;IACnD,KAAK,MAAM,IAAI,IAAI,CAAC,GAA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CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1D,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC7C,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,GAAG,CAAC,CAAmB,CAAC;QAClD,MAAM,KAAK,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC1D,MAAM,KAAK,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7H,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -20,13 +20,31 @@ export declare function resolveFit(fit: ClipFit, probe: Pick<FootageProbe, "disp
|
|
|
20
20
|
* clip is read through its HLG base layer.
|
|
21
21
|
*/
|
|
22
22
|
export declare function toneMapFilter(hdr: HdrKind | null, transfer: string | null): string[];
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The video filter graph from input 0's picture to `[v]`. Every stage runs on as little as it can: frames are
|
|
25
|
+
* dropped to 30 fps first, then the picture is scaled to the frame (crop: covered and cropped to it; blur: fitted
|
|
26
|
+
* inside it), and only then tone-mapped, so the float stages of an HDR clip work on frame-sized pictures instead of
|
|
27
|
+
* the source's (a 4K phone clip has 4x the pixels of a 1080x1920 frame). The blur's background is made from the
|
|
28
|
+
* fitted picture.
|
|
29
|
+
*/
|
|
24
30
|
export declare function buildVideoFilter(options: {
|
|
25
31
|
fit: "crop" | "blur";
|
|
26
32
|
frame: Frame;
|
|
27
33
|
hdr: HdrKind | null;
|
|
28
34
|
transfer: string | null;
|
|
29
35
|
}): string;
|
|
36
|
+
/** x264's presets, fastest first. */
|
|
37
|
+
export declare const X264_PRESETS: readonly ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"];
|
|
38
|
+
export type X264Preset = (typeof X264_PRESETS)[number];
|
|
39
|
+
/**
|
|
40
|
+
* How the intermediate clips are encoded. A small worker can trade file size for speed: `preset` (default
|
|
41
|
+
* `veryfast`; `superfast` or `ultrafast` encode faster into bigger files), `threads` (ffmpeg's encoder and filter
|
|
42
|
+
* threads; by default ffmpeg's own choice, which follows the host's cores, not a container's CPU quota).
|
|
43
|
+
*/
|
|
44
|
+
export interface NormalizeEncoder {
|
|
45
|
+
preset?: X264Preset;
|
|
46
|
+
threads?: number;
|
|
47
|
+
}
|
|
30
48
|
export interface NormalizeInput {
|
|
31
49
|
clip: FootageClip;
|
|
32
50
|
/** The local file (a URL's downloaded copy). */
|
|
@@ -34,8 +52,18 @@ export interface NormalizeInput {
|
|
|
34
52
|
probe: FootageProbe;
|
|
35
53
|
frame: Frame;
|
|
36
54
|
output: string;
|
|
55
|
+
encoder?: NormalizeEncoder;
|
|
37
56
|
}
|
|
38
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* The thread arguments: global filter threads (before the inputs) and encoder threads (before the output; the same
|
|
59
|
+
* flag before an input sets that input's decoder threads). Throws, naming `option`, when `threads` is not a positive
|
|
60
|
+
* whole number.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getThreadArgs(threads: number | undefined, option: string): {
|
|
63
|
+
global: string[];
|
|
64
|
+
output: string[];
|
|
65
|
+
};
|
|
66
|
+
/** ffmpeg's arguments for one clip; pure, so the graph is tested without ffmpeg. Throws on an invalid `encoder.threads`. */
|
|
39
67
|
export declare function buildNormalizeArgs(input: NormalizeInput): string[];
|
|
40
68
|
/**
|
|
41
69
|
* Runs ffmpeg for one clip without blocking; throws with the clip's id when it fails (a broken file is not an expected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/footage/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE;;;;;GAKG;AAEH,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAI1C,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,iEAAiE;AACjE,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAKnI;AAID;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,EAAE,CAYpF;AAED
|
|
1
|
+
{"version":3,"file":"normalize.d.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AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAIjH;AAED,4HAA4H;AAC5H,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,EAAE,CAmDlE;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3H"}
|
|
@@ -37,32 +37,59 @@ export function toneMapFilter(hdr, transfer) {
|
|
|
37
37
|
"format=yuv420p",
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* The video filter graph from input 0's picture to `[v]`. Every stage runs on as little as it can: frames are
|
|
42
|
+
* dropped to 30 fps first, then the picture is scaled to the frame (crop: covered and cropped to it; blur: fitted
|
|
43
|
+
* inside it), and only then tone-mapped, so the float stages of an HDR clip work on frame-sized pictures instead of
|
|
44
|
+
* the source's (a 4K phone clip has 4x the pixels of a 1080x1920 frame). The blur's background is made from the
|
|
45
|
+
* fitted picture.
|
|
46
|
+
*/
|
|
41
47
|
export function buildVideoFilter(options) {
|
|
42
48
|
const { width, height } = options.frame;
|
|
43
|
-
const
|
|
44
|
-
const cover = `scale=${width}:${height}:force_original_aspect_ratio=increase,crop=${width}:${height}`;
|
|
49
|
+
const toneMap = toneMapFilter(options.hdr, options.transfer);
|
|
45
50
|
const tail = "setsar=1,format=yuv420p";
|
|
46
|
-
if (options.fit === "crop")
|
|
47
|
-
|
|
51
|
+
if (options.fit === "crop") {
|
|
52
|
+
const cover = `scale=${width}:${height}:force_original_aspect_ratio=increase,crop=${width}:${height}`;
|
|
53
|
+
return `[0:v]${[`fps=${FOOTAGE_FPS}`, cover, ...toneMap, tail].join(",")}[v]`;
|
|
54
|
+
}
|
|
55
|
+
// Even sizes: zscale refuses odd ones in 4:2:0.
|
|
56
|
+
const fitted = `scale=${width}:${height}:force_original_aspect_ratio=decrease:force_divisible_by=2`;
|
|
57
|
+
const backWidth = Math.round(width / 4);
|
|
58
|
+
const backHeight = Math.round(height / 4);
|
|
48
59
|
return [
|
|
49
|
-
`[0:v]${
|
|
50
|
-
`[bg]scale=${
|
|
51
|
-
`[fg]
|
|
52
|
-
`[back][front]overlay=(W-w)/2:(H-h)/2,${tail}[v]`,
|
|
60
|
+
`[0:v]${[`fps=${FOOTAGE_FPS}`, fitted, ...toneMap, "split=2[bg][fg]"].join(",")}`,
|
|
61
|
+
`[bg]scale=${backWidth}:${backHeight}:force_original_aspect_ratio=increase,crop=${backWidth}:${backHeight},boxblur=20:2,scale=${width}:${height},eq=brightness=-0.06[back]`,
|
|
62
|
+
`[back][fg]overlay=(W-w)/2:(H-h)/2,${tail}[v]`,
|
|
53
63
|
].join(";");
|
|
54
64
|
}
|
|
55
|
-
/**
|
|
65
|
+
/** x264's presets, fastest first. */
|
|
66
|
+
export const X264_PRESETS = ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow"];
|
|
67
|
+
const DEFAULT_NORMALIZE_PRESET = "veryfast";
|
|
68
|
+
/**
|
|
69
|
+
* The thread arguments: global filter threads (before the inputs) and encoder threads (before the output; the same
|
|
70
|
+
* flag before an input sets that input's decoder threads). Throws, naming `option`, when `threads` is not a positive
|
|
71
|
+
* whole number.
|
|
72
|
+
*/
|
|
73
|
+
export function getThreadArgs(threads, option) {
|
|
74
|
+
if (threads === undefined)
|
|
75
|
+
return { global: [], output: [] };
|
|
76
|
+
if (!Number.isInteger(threads) || threads < 1)
|
|
77
|
+
throw new Error(`${option} must be a positive whole number, got ${threads}.`);
|
|
78
|
+
return { global: ["-filter_complex_threads", String(threads)], output: ["-threads", String(threads)] };
|
|
79
|
+
}
|
|
80
|
+
/** ffmpeg's arguments for one clip; pure, so the graph is tested without ffmpeg. Throws on an invalid `encoder.threads`. */
|
|
56
81
|
export function buildNormalizeArgs(input) {
|
|
57
82
|
const { clip, file, probe, frame, output } = input;
|
|
58
83
|
const duration = getTrimmedDuration(clip, probe);
|
|
59
84
|
const fit = resolveFit(clip.fit, probe, frame);
|
|
60
85
|
const seek = clip.trim.start > 0 ? ["-ss", String(clip.trim.start)] : [];
|
|
86
|
+
const threads = getThreadArgs(input.encoder?.threads, "normalize.threads");
|
|
61
87
|
const silence = probe.hasAudio ? [] : ["-f", "lavfi", "-i", `anullsrc=r=${FOOTAGE_SAMPLE_RATE}:cl=stereo`];
|
|
62
88
|
return [
|
|
63
89
|
"-v",
|
|
64
90
|
"error",
|
|
65
91
|
"-y",
|
|
92
|
+
...threads.global,
|
|
66
93
|
...seek,
|
|
67
94
|
"-i",
|
|
68
95
|
file,
|
|
@@ -78,7 +105,7 @@ export function buildNormalizeArgs(input) {
|
|
|
78
105
|
"-c:v",
|
|
79
106
|
"libx264",
|
|
80
107
|
"-preset",
|
|
81
|
-
|
|
108
|
+
input.encoder?.preset ?? DEFAULT_NORMALIZE_PRESET,
|
|
82
109
|
"-crf",
|
|
83
110
|
"18",
|
|
84
111
|
"-g",
|
|
@@ -99,6 +126,7 @@ export function buildNormalizeArgs(input) {
|
|
|
99
126
|
"2",
|
|
100
127
|
"-movflags",
|
|
101
128
|
"+faststart",
|
|
129
|
+
...threads.output,
|
|
102
130
|
output,
|
|
103
131
|
];
|
|
104
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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AAK,KAAK,CAAC,IAAI,GAAG,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;AACxI,CAAC"}
|
package/dist/footage/paid.d.ts
CHANGED
|
@@ -64,7 +64,8 @@ export interface EstimateFootageOptions extends FootageCacheOptions {
|
|
|
64
64
|
* What a footage film will cost in the caller's credits, before anything runs: every clip probed (a URL clip not yet
|
|
65
65
|
* downloaded is probed at its URL), nothing normalized, no provider called. Talking clips need speech to text (and
|
|
66
66
|
* isolation when the film cleans the voice); generated music lasts the cut's length when the cut is known, else the
|
|
67
|
-
* clips' length plus the end card. A cached step costs 0.
|
|
67
|
+
* clips' length plus the end card. A cached step costs 0. With key terms, transcription costs `rates.transcribe` plus
|
|
68
|
+
* the keyterm surcharge `rates.keyTerms`; invalid key terms fail the estimate.
|
|
68
69
|
*/
|
|
69
70
|
export declare function estimateFootageFilm(film: FootageFilm, options: EstimateFootageOptions): Promise<TtsResult<FootageEstimate>>;
|
|
70
71
|
//# sourceMappingURL=paid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paid.d.ts","sourceRoot":"","sources":["../../src/footage/paid.ts"],"names":[],"mappings":"AAIA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAW,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"paid.d.ts","sourceRoot":"","sources":["../../src/footage/paid.ts"],"names":[],"mappings":"AAIA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAW,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,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