@nodetool-ai/video-nodes 0.8.3 → 0.8.4-a13.1
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/dist/.nodetool-build-stamp +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/nodes/ffmpeg-helpers.d.ts +2 -1
- package/dist/nodes/ffmpeg-helpers.d.ts.map +1 -1
- package/dist/nodes/ffmpeg-helpers.js +4 -5
- package/dist/nodes/ffmpeg-helpers.js.map +1 -1
- package/dist/nodes/model3d/convert.d.ts +2 -1
- package/dist/nodes/model3d/convert.d.ts.map +1 -1
- package/dist/nodes/model3d/convert.js +3 -3
- package/dist/nodes/model3d/convert.js.map +1 -1
- package/dist/nodes/model3d/render3d-headless.d.ts +15 -5
- package/dist/nodes/model3d/render3d-headless.d.ts.map +1 -1
- package/dist/nodes/model3d/render3d-headless.js +154 -36
- package/dist/nodes/model3d/render3d-headless.js.map +1 -1
- package/dist/nodes/model3d/types.d.ts +1 -0
- package/dist/nodes/model3d/types.d.ts.map +1 -1
- package/dist/nodes/model3d/utils.d.ts +6 -13
- package/dist/nodes/model3d/utils.d.ts.map +1 -1
- package/dist/nodes/model3d/utils.js +22 -65
- package/dist/nodes/model3d/utils.js.map +1 -1
- package/dist/nodes/timeline/browserRender.d.ts +83 -0
- package/dist/nodes/timeline/browserRender.d.ts.map +1 -0
- package/dist/nodes/timeline/browserRender.js +541 -0
- package/dist/nodes/timeline/browserRender.js.map +1 -0
- package/dist/nodes/timeline/browserSources.d.ts +26 -0
- package/dist/nodes/timeline/browserSources.d.ts.map +1 -0
- package/dist/nodes/timeline/browserSources.js +83 -0
- package/dist/nodes/timeline/browserSources.js.map +1 -0
- package/dist/nodes/timeline/compositeRender.d.ts.map +1 -1
- package/dist/nodes/timeline/compositeRender.js +27 -13
- package/dist/nodes/timeline/compositeRender.js.map +1 -1
- package/dist/nodes/timeline/pngSequence.d.ts +19 -0
- package/dist/nodes/timeline/pngSequence.d.ts.map +1 -1
- package/dist/nodes/timeline/pngSequence.js +21 -6
- package/dist/nodes/timeline/pngSequence.js.map +1 -1
- package/dist/nodes/timeline/rawFrames.d.ts +34 -1
- package/dist/nodes/timeline/rawFrames.d.ts.map +1 -1
- package/dist/nodes/timeline/rawFrames.js +68 -15
- package/dist/nodes/timeline/rawFrames.js.map +1 -1
- package/dist/nodes/timeline/renderPage.d.ts +14 -0
- package/dist/nodes/timeline/renderPage.d.ts.map +1 -0
- package/dist/nodes/timeline/renderPage.js +75 -0
- package/dist/nodes/timeline/renderPage.js.map +1 -0
- package/dist/nodes/timeline.d.ts +20 -14
- package/dist/nodes/timeline.d.ts.map +1 -1
- package/dist/nodes/timeline.js +226 -66
- package/dist/nodes/timeline.js.map +1 -1
- package/dist/timeline-render-page.js +6903 -0
- package/package.json +12 -11
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { fetchExternalMedia } from "@nodetool-ai/runtime";
|
|
2
|
+
import { fetchExternalMedia, loadMediaRefBytes } from "@nodetool-ai/runtime";
|
|
3
|
+
import { resolveModelBytes } from "@nodetool-ai/nodes-utils";
|
|
3
4
|
import { isNonEmptyString, isObjectLike } from "@nodetool-ai/node-sdk";
|
|
4
5
|
export function toBytes(data) {
|
|
5
6
|
if (!data)
|
|
@@ -16,38 +17,13 @@ export function modelBytes(model) {
|
|
|
16
17
|
export async function modelRefToBytes(model, context) {
|
|
17
18
|
if (!isObjectLike(model))
|
|
18
19
|
return new Uint8Array();
|
|
19
|
-
|
|
20
|
-
const inline = toBytes(obj.data);
|
|
21
|
-
if (inline.length > 0)
|
|
22
|
-
return inline;
|
|
23
|
-
const uri = obj.uri ?? "";
|
|
24
|
-
if (!uri)
|
|
25
|
-
return new Uint8Array();
|
|
26
|
-
if (context?.storage) {
|
|
27
|
-
const stored = await context.storage.retrieve(uri);
|
|
28
|
-
if (stored && stored.length > 0)
|
|
29
|
-
return new Uint8Array(stored);
|
|
30
|
-
}
|
|
31
|
-
if (uri.startsWith("file://")) {
|
|
32
|
-
const { readFile } = await import("node:fs/promises");
|
|
33
|
-
const { fileURLToPath } = await import("node:url");
|
|
34
|
-
return new Uint8Array(await readFile(fileURLToPath(uri)));
|
|
35
|
-
}
|
|
36
|
-
if (uri.startsWith("http://") || uri.startsWith("https://")) {
|
|
37
|
-
// Caller-supplied uri — the media-ref egress policy decides whether this
|
|
38
|
-
// host opens the socket; a refusal throws and names the URL.
|
|
39
|
-
const res = await fetchExternalMedia(uri);
|
|
40
|
-
if (!res.ok)
|
|
41
|
-
throw new Error(`Failed to fetch model (${res.status}): ${uri}`);
|
|
42
|
-
return new Uint8Array(await res.arrayBuffer());
|
|
43
|
-
}
|
|
44
|
-
return new Uint8Array();
|
|
20
|
+
return resolveModelBytes(model, context);
|
|
45
21
|
}
|
|
46
22
|
/**
|
|
47
23
|
* Resolve an image-ref-shaped value (`{uri, data, asset_id, ...}`) to raw
|
|
48
|
-
* image bytes
|
|
49
|
-
* `data:` URI,
|
|
50
|
-
* URI
|
|
24
|
+
* image bytes through the shared media-ref resolver: inline `data`, a
|
|
25
|
+
* `data:` URI, an `asset://` URI or bare `asset_id`, a storage URI, a
|
|
26
|
+
* `file://` URI, or an http(s) URL.
|
|
51
27
|
*
|
|
52
28
|
* Throws when nothing resolvable is present so the caller can surface a
|
|
53
29
|
* clear "missing image" error rather than silently sending zero bytes.
|
|
@@ -57,45 +33,26 @@ export async function imageRefToBytes(ref, context) {
|
|
|
57
33
|
throw new Error("Image input is empty");
|
|
58
34
|
}
|
|
59
35
|
const obj = ref;
|
|
60
|
-
if (obj.data instanceof Uint8Array && obj.data.length > 0) {
|
|
61
|
-
return new Uint8Array(obj.data);
|
|
62
|
-
}
|
|
63
|
-
if (isNonEmptyString(obj.data)) {
|
|
64
|
-
return Uint8Array.from(Buffer.from(obj.data, "base64"));
|
|
65
|
-
}
|
|
66
36
|
const uri = obj.uri ?? "";
|
|
67
|
-
if (!uri
|
|
37
|
+
if (!uri &&
|
|
38
|
+
!obj.asset_id &&
|
|
39
|
+
!(obj.data instanceof Uint8Array && obj.data.length > 0) &&
|
|
40
|
+
!isNonEmptyString(obj.data)) {
|
|
68
41
|
throw new Error("Image input has no data or uri");
|
|
69
|
-
if (uri.startsWith("data:")) {
|
|
70
|
-
const comma = uri.indexOf(",");
|
|
71
|
-
if (comma === -1)
|
|
72
|
-
throw new Error(`Malformed data URI: ${uri.slice(0, 32)}…`);
|
|
73
|
-
const meta = uri.slice(0, comma);
|
|
74
|
-
const payload = uri.slice(comma + 1);
|
|
75
|
-
if (meta.includes(";base64")) {
|
|
76
|
-
return Uint8Array.from(Buffer.from(payload, "base64"));
|
|
77
|
-
}
|
|
78
|
-
return Uint8Array.from(Buffer.from(decodeURIComponent(payload), "utf-8"));
|
|
79
|
-
}
|
|
80
|
-
if (context?.storage) {
|
|
81
|
-
const stored = await context.storage.retrieve(uri);
|
|
82
|
-
if (stored && stored.length > 0)
|
|
83
|
-
return new Uint8Array(stored);
|
|
84
42
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (!res.ok) {
|
|
94
|
-
throw new Error(`Failed to fetch image (${res.status}): ${uri}`);
|
|
43
|
+
const bytes = await loadMediaRefBytes({ data: obj.data, uri, asset_id: obj.asset_id, type: "image" }, context, {
|
|
44
|
+
fetchHttp: async (url) => {
|
|
45
|
+
// Same policy as every other caller-supplied media uri.
|
|
46
|
+
const res = await fetchExternalMedia(url);
|
|
47
|
+
if (!res.ok) {
|
|
48
|
+
throw new Error(`Failed to fetch image (${res.status}): ${url}`);
|
|
49
|
+
}
|
|
50
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
95
51
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
52
|
+
});
|
|
53
|
+
if (bytes && bytes.length > 0)
|
|
54
|
+
return bytes;
|
|
55
|
+
throw new Error(`Unable to resolve image uri: ${uri || `asset://${obj.asset_id ?? ""}`}`);
|
|
99
56
|
}
|
|
100
57
|
export function modelRef(data, extras = {}) {
|
|
101
58
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nodes/model3d/utils.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nodes/model3d/utils.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAO7D,OAAO,EACL,gBAAgB,EAChB,YAAY,EACb,MAAM,uBAAuB,CAAC;AAE/B,MAAM,UAAU,OAAO,CAAC,IAAqC;IAC3D,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,UAAU,EAAE,CAAC;IACnC,IAAI,IAAI,YAAY,UAAU;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,UAAU,EAAE,CAAC;IAClD,OAAO,OAAO,CAAE,KAAwB,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAc,EACd,OAA2B;IAE3B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,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,CAAC,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE;YACtB,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,EAAE;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK;SAC9B,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RenderTimeline` in headless Chromium.
|
|
3
|
+
*
|
|
4
|
+
* The editor exports a timeline with `renderTimeline`
|
|
5
|
+
* (`web/src/components/timeline/render/TimelineRenderer.ts`): the live
|
|
6
|
+
* preview's compositor and scene model, WebCodecs decode, mediabunny mux. This
|
|
7
|
+
* runs that same exporter on the server so a workflow render is the picture
|
|
8
|
+
* the preview showed, and variable-frame-rate clips decode by their own
|
|
9
|
+
* timestamps instead of through a per-frame ffmpeg seek.
|
|
10
|
+
*
|
|
11
|
+
* A loopback HTTP server, bound to 127.0.0.1 behind a random path prefix,
|
|
12
|
+
* serves the page (`renderPage.ts`), the clip media (with byte ranges, which
|
|
13
|
+
* WebCodecs and `<video>` both read through) and the bundled and Google
|
|
14
|
+
* fonts, and receives the output: muxed chunks at their byte positions, or
|
|
15
|
+
* one PNG per frame. Playwright drives the page and blocks every request to
|
|
16
|
+
* any other origin. Nothing is held whole in the page or here.
|
|
17
|
+
*
|
|
18
|
+
* What the browser writes depends on what it can encode
|
|
19
|
+
* ({@link encodingsFor}): H.264 MP4 and VP9 WebM are written as they are;
|
|
20
|
+
* MP4 from a Chromium without an H.264 encoder (Playwright's own build) comes
|
|
21
|
+
* back as VP9 or AV1 and ffmpeg transcodes it; ProRes MOV, a PNG sequence and
|
|
22
|
+
* alpha WebM from a browser without a VP9 alpha encoder come back as PNG
|
|
23
|
+
* frames that ffmpeg encodes or the zip writer stores.
|
|
24
|
+
*
|
|
25
|
+
* Audio is not mixed here. The caller mixes it with ffmpeg, as it does for the
|
|
26
|
+
* other render path, so the soundtrack does not depend on which path ran.
|
|
27
|
+
*/
|
|
28
|
+
import { type TimelineSequence } from "@nodetool-ai/timeline";
|
|
29
|
+
import { type HeadlessRenderEncoding } from "@nodetool-ai/timeline/render";
|
|
30
|
+
import type { ResolvedTimelineOutput } from "./outputFormats.js";
|
|
31
|
+
/**
|
|
32
|
+
* No headless browser could be started here: Playwright is not installed, or
|
|
33
|
+
* no Chromium it can launch is. The caller falls back to the Node compositor.
|
|
34
|
+
*/
|
|
35
|
+
export declare class BrowserRenderUnavailableError extends Error {
|
|
36
|
+
constructor(message: string, options?: ErrorOptions);
|
|
37
|
+
}
|
|
38
|
+
export interface BrowserRenderOptions {
|
|
39
|
+
sequence: TimelineSequence;
|
|
40
|
+
/** Output size; the sequence's own size is the layout reference. */
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
fps: number;
|
|
44
|
+
durationMs: number;
|
|
45
|
+
output: ResolvedTimelineOutput;
|
|
46
|
+
/** Video bitrate in bits per second; 0 leaves it to the encoder. */
|
|
47
|
+
bitrate: number;
|
|
48
|
+
resolveAssetPath: (assetId: string) => Promise<string | null>;
|
|
49
|
+
/** Destination: the video container, or the PNG sequence's zip. */
|
|
50
|
+
outPath: string;
|
|
51
|
+
/** Scratch space for an intermediate file the server transcodes. */
|
|
52
|
+
workDir: string;
|
|
53
|
+
onProgress?: (frame: number, totalFrames: number) => void;
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}
|
|
56
|
+
export interface BrowserRenderResult {
|
|
57
|
+
/** The compositor the page drew with. */
|
|
58
|
+
backend: "webgpu" | "canvas2d";
|
|
59
|
+
adapter: string | null;
|
|
60
|
+
/** Why the page drew with Canvas 2D although it had WebGPU, else null. */
|
|
61
|
+
webgpuUnusable: string | null;
|
|
62
|
+
/** Which browser ran: a path, a Playwright channel, or "bundled". */
|
|
63
|
+
browser: string;
|
|
64
|
+
encoding: HeadlessRenderEncoding;
|
|
65
|
+
/** Whether ffmpeg re-encoded what the browser wrote. */
|
|
66
|
+
transcoded: boolean;
|
|
67
|
+
frames: number;
|
|
68
|
+
degradedBakes: number;
|
|
69
|
+
/** Google font families the page asked for that could not be resolved. */
|
|
70
|
+
fontsUnavailable: string[];
|
|
71
|
+
/** Clips converted to VP9 first because the browser cannot decode them. */
|
|
72
|
+
convertedSources: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* What to ask the page for, in preference order. The last entry is always
|
|
76
|
+
* PNG frames, which every browser can produce and ffmpeg encodes to any of
|
|
77
|
+
* the formats, so a missing WebCodecs encoder never fails the render.
|
|
78
|
+
*/
|
|
79
|
+
export declare function encodingsFor(output: ResolvedTimelineOutput): HeadlessRenderEncoding[];
|
|
80
|
+
/** Re-encode the browser's intermediate file with the output's own encoder. */
|
|
81
|
+
export declare function transcodeIntermediate(inPath: string, outPath: string, output: ResolvedTimelineOutput): Promise<void>;
|
|
82
|
+
export declare function renderTimelineInBrowser(opts: BrowserRenderOptions): Promise<BrowserRenderResult>;
|
|
83
|
+
//# sourceMappingURL=browserRender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserRender.d.ts","sourceRoot":"","sources":["../../../src/nodes/timeline/browserRender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAUH,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAIL,KAAK,sBAAsB,EAI5B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAMjE;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC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