@motionscript/browser 0.1.1-alpha.0 → 0.1.1-alpha.2
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 +14 -0
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +2 -2
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/ms_renderer_bg.wasm +0 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/native-export.d.ts +10 -10
- package/dist/native-export.d.ts.map +1 -1
- package/dist/native-export.js +4 -4
- package/dist/native-export.js.map +1 -1
- package/package.json +4 -4
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export { concatVideoSegments, createSegmentJoiner, ConcatMismatchError } from ".
|
|
|
16
16
|
// One export across several renderers: chunks of frames on lanes the run admits
|
|
17
17
|
// while they add throughput, joined as they land. See `parallel/export-parallel.ts`.
|
|
18
18
|
export { exportVideoParallel } from "./parallel/export-parallel";
|
|
19
|
-
// Experimental: the same export rendered and encoded by
|
|
19
|
+
// Experimental: the same export rendered and encoded by a native host process, fed a stream through a host transport. See `native-export.ts`.
|
|
20
20
|
export { exportVideoNative } from "./native-export";
|
|
21
21
|
export { localLane, messagePortLane, serveExportLane } from "./parallel/lanes";
|
|
22
22
|
// Mixes a timeline's audio without rendering a frame: the other half of a split export (AAC cannot be concatenated across pieces). See `mix-timeline-audio.ts`.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,4EAA4E;AAE5E,yGAAyG;AACzG,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAwB,MAAM,eAAe,CAAC;AACzF,OAAO,EACH,WAAW,GAKd,MAAM,YAAY,CAAC;AACpB,8EAA8E;AAC9E,OAAO,EAAE,WAAW,EAAE,YAAY,EAA0B,MAAM,gBAAgB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C;AAC5F,8IAA8I;AAC9I,OAAO,EAAE,iBAAiB,EAAuD,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAA+B,MAAM,kBAAkB,CAAC;AAG5G,gKAAgK;AAChK,OAAO,EAAE,gBAAgB,EAA+B,MAAM,sBAAsB,CAAC;AACrF,sLAAsL;AACtL,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAQ7D,OAAO,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChE,2EAA2E;AAC3E,iEAAiE;AACjE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAwB,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAA2B,MAAM,YAAY,CAAC;AAE7E,wEAAwE;AACxE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["// @motionscript/browser — @motionscript/core in the browser: WebGPU surfaces\n// (through @motionscript/renderer), video export, audio playback and clock.\n\n// Lets a host answer for an asset's bytes before the adapter goes to the network (see `asset-bytes.ts`).\nexport { loadAssetBytes, setAssetByteSource, type AssetByteSource } from \"./asset-bytes\";\nexport {\n exportVideo,\n type ExportParams,\n type ExportProgressCallback,\n type VideoEncoderOptions,\n type AudioEncoderOptions,\n} from \"./exporter\";\n// Mixes the timeline's audio and encodes it alone, without rendering a frame.\nexport { exportAudio, NoAudioError, type ExportAudioParams } from \"./export-audio\";\nexport {\n EXPORT_FORMATS,\n type ExportFormat,\n type ExportFormatInfo,\n type VideoFormat,\n type AudioFormat,\n} from \"./formats\";\n// mediabunny's resolution-aware quality levels, for `ExportParams.video.bitrate` without a direct encoder dependency.\nexport {\n QUALITY_VERY_LOW,\n QUALITY_LOW,\n QUALITY_MEDIUM,\n QUALITY_HIGH,\n QUALITY_VERY_HIGH,\n type Quality,\n} from \"mediabunny\";\nexport { exportScreenshot, type ScreenshotParams, type ScreenshotResult, type ScreenshotFormat, type FrameSpec } from \"./screenshot\";\n// Thrown by a still and an export alike for a frame whose every track failed to build.\nexport { NothingToDrawError } from \"./frame-loop\";\n// Joins separately-encoded MP4s (or WebMs) without re-encoding, which is what makes parallel export worthwhile; see `concat.ts` for the two things a caller must guarantee.\nexport { concatVideoSegments, createSegmentJoiner, ConcatMismatchError, type ConcatOptions, type SegmentJoiner } from \"./concat\";\n// One export across several renderers: chunks of frames on lanes the run admits\n// while they add throughput, joined as they land. See `parallel/export-parallel.ts`.\nexport { exportVideoParallel, type ParallelExportParams } from \"./parallel/export-parallel\";\n// Experimental: the same export rendered and encoded by a native host process, fed a stream through a host transport. See `native-export.ts`.\nexport { exportVideoNative, type NativeExportParams, type NativeExportTransport } from \"./native-export\";\nexport { localLane, messagePortLane, serveExportLane, type MessagePortLaneOptions } from \"./parallel/lanes\";\nexport type { ExportLane, LaneEnvironment, LaneReport, LaneSession, SegmentSpec } from \"./parallel/lane\";\nexport type { ExportChunk } from \"./parallel/plan\";\n// Mixes a timeline's audio without rendering a frame: the other half of a split export (AAC cannot be concatenated across pieces). See `mix-timeline-audio.ts`.\nexport { mixTimelineAudio, type MixTimelineAudioParams } from \"./mix-timeline-audio\";\n// Single frames as a first-class capability: one long-lived renderer that repaints into a host-owned canvas (thumbnails, still previews); `exportScreenshot` is its one-shot wrapper.\nexport { StillRenderer, createStillRenderer } from \"./still\";\nexport type {\n StillRendererOptions,\n RenderStillOptions,\n EncodeStillOptions,\n StillSource,\n FrameRef,\n} from \"./still\";\nexport { WebAudioSink as WebAudioPlayer } from \"./audio/player\";\n// Mixdown. Also on the `@motionscript/browser/audio` subpath, which is the\n// import to prefer — it reaches it without loading the renderer.\nexport { mixAudio, encodeWav, type MixAudioOptions } from \"./audio/mixer\";\nexport { WebTicker } from \"./ticker\";\n\nexport { createBrowserEngine } from \"./engine\";\nexport type { BrowserEngineOptions, BrowserEncodeOptions } from \"./engine\";\nexport { WebGpuUnavailableError, type RendererWasmOption } from \"./renderer\";\n\n// The renderer's host-facing surface, so a host needs no second import.\nexport { isWgpuSupported, onWgpuEvent, ShaderPreview, validateShader, WGSL_PRELUDE } from \"@motionscript/renderer\";\nexport type {\n WgpuEvent, ShaderDiagnostic, ShaderField, ShaderPreviewInput, ShaderReport, ShaderScope, ShaderStatus,\n} from \"@motionscript/renderer\";\n"]}
|
package/dist/native-export.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type ExportParams } from "./exporter";
|
|
2
2
|
/**
|
|
3
|
-
* Where a native export's stream goes:
|
|
4
|
-
* `
|
|
5
|
-
*
|
|
3
|
+
* Where a native export's stream goes: a host process that replays it with
|
|
4
|
+
* the renderer's `replay` module (Rust, feature `native`) on the native GPU
|
|
5
|
+
* and encodes the frames itself. Experimental.
|
|
6
6
|
*/
|
|
7
7
|
export interface NativeExportTransport {
|
|
8
|
-
/** The
|
|
8
|
+
/** The host renderer's built-in effect names, in its index order (`NativeRenderer::effect_names`). */
|
|
9
9
|
readonly effects: readonly string[];
|
|
10
10
|
/** The next bytes of the stream, in order. Resolves when the transport can take more. */
|
|
11
11
|
write(bytes: Uint8Array): Promise<void>;
|
|
12
|
-
/** The stream is complete; resolves with the file's bytes, or nothing when the
|
|
12
|
+
/** The stream is complete; resolves with the file's bytes, or nothing when the host wrote it elsewhere. */
|
|
13
13
|
finish(): Promise<Uint8Array | void>;
|
|
14
|
-
/** The export failed or was cancelled: stop the
|
|
14
|
+
/** The export failed or was cancelled: stop the host process, keep no file. */
|
|
15
15
|
abort?(reason: unknown): void;
|
|
16
16
|
}
|
|
17
17
|
export type NativeExportParams = Omit<ExportParams, "format" | "returnBytes" | "filename" | "rendererWasmUrl"> & {
|
|
@@ -19,11 +19,11 @@ export type NativeExportParams = Omit<ExportParams, "format" | "returnBytes" | "
|
|
|
19
19
|
transport: NativeExportTransport;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
|
-
* Experimental: {@link exportVideo} through
|
|
22
|
+
* Experimental: {@link exportVideo} through a native host process. The frame
|
|
23
23
|
* loop, adapter, text and assets run here exactly as for a canvas export;
|
|
24
|
-
* what would be drawn is streamed to `transport` instead, and the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* what would be drawn is streamed to `transport` instead, and the host draws
|
|
25
|
+
* it with the same renderer on the native GPU and encodes it. `video.codec`
|
|
26
|
+
* (avc by default, hevc or av1) and the bitrate are passed on in the stream.
|
|
27
27
|
*/
|
|
28
28
|
export declare function exportVideoNative(params: NativeExportParams): Promise<Uint8Array | void>;
|
|
29
29
|
//# sourceMappingURL=native-export.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-export.d.ts","sourceRoot":"","sources":["../src/native-export.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyC,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAItF;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IAClC,
|
|
1
|
+
{"version":3,"file":"native-export.d.ts","sourceRoot":"","sources":["../src/native-export.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyC,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAItF;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IAClC,sGAAsG;IACtG,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,yFAAyF;IACzF,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,2GAA2G;IAC3G,MAAM,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACrC,+EAA+E;IAC/E,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,aAAa,GAAG,UAAU,GAAG,iBAAiB,CAAC,GAAG;IAC7G,eAAe,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAC/B,SAAS,EAAE,qBAAqB,CAAC;CACpC,CAAC;AAmDF;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAsC9F"}
|
package/dist/native-export.js
CHANGED
|
@@ -51,11 +51,11 @@ class NativeSink {
|
|
|
51
51
|
}
|
|
52
52
|
const EMPTY_MANIFEST = { image: {}, video: {}, audio: {}, font: {} };
|
|
53
53
|
/**
|
|
54
|
-
* Experimental: {@link exportVideo} through
|
|
54
|
+
* Experimental: {@link exportVideo} through a native host process. The frame
|
|
55
55
|
* loop, adapter, text and assets run here exactly as for a canvas export;
|
|
56
|
-
* what would be drawn is streamed to `transport` instead, and the
|
|
57
|
-
*
|
|
58
|
-
*
|
|
56
|
+
* what would be drawn is streamed to `transport` instead, and the host draws
|
|
57
|
+
* it with the same renderer on the native GPU and encodes it. `video.codec`
|
|
58
|
+
* (avc by default, hevc or av1) and the bitrate are passed on in the stream.
|
|
59
59
|
*/
|
|
60
60
|
export async function exportVideoNative(params) {
|
|
61
61
|
const { document: source, registry = new Registry(), scale = 1, manifest = EMPTY_MANIFEST, theme, includeAudio = true, video, audio = {}, frames, onProgress, signal, supersample = 2, transport, } = params;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-export.js","sourceRoot":"","sources":["../src/native-export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,sBAAsB,EAAE,cAAc,EAAsB,MAAM,oBAAoB,CAAC;AAChI,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAA4B,MAAM,wBAAwB,CAAC;AAC5G,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;A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AO,EAAE,MAAM;SAC9C,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,SAAS,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;QACzB,MAAM,KAAK,CAAC;IAChB,CAAC;YAAS,CAAC;QACP,aAAa,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;AACL,CAAC","sourcesContent":["import { ManifestAssetCatalog, Registry, resolveProjectDocument, DEFAULT_OUTPUT, type AssetManifest } from \"@motionscript/core\";\nimport { createNativeExportContext, NATIVE_RECORD, type NativeExportContext } from \"@motionscript/renderer\";\nimport { renderTimeline, type VideoFrameSink } from \"./frame-loop\";\nimport { exportGeometry, motionGraphicsBitrate, type ExportParams } from \"./exporter\";\nimport { loadRenderer } from \"./renderer\";\nimport { WebAudioMixer } from \"./audio/mixer\";\n\n/**\n * Where a native export's stream goes: in a desktop host, a pipe into the\n * `ms-export` sidecar (`packages/renderer/crates/export`), which renders on\n * the native GPU and encodes with NVENC (or libx264). Experimental.\n */\nexport interface NativeExportTransport {\n /** The sidecar's built-in effect names, in its index order (`ms-export info`). */\n readonly effects: readonly string[];\n /** The next bytes of the stream, in order. Resolves when the transport can take more. */\n write(bytes: Uint8Array): Promise<void>;\n /** The stream is complete; resolves with the file's bytes, or nothing when the sidecar wrote it where the host asked. */\n finish(): Promise<Uint8Array | void>;\n /** The export failed or was cancelled: stop the sidecar, keep no file. */\n abort?(reason: unknown): void;\n}\n\nexport type NativeExportParams = Omit<ExportParams, \"format\" | \"returnBytes\" | \"filename\" | \"rendererWasmUrl\"> & {\n rendererWasmUrl?: string | URL;\n transport: NativeExportTransport;\n};\n\n/** Stream bytes held before they are handed to the transport. */\nconst FLUSH_BYTES = 1 << 18;\n\nconst CODEC_INDEX = { avc: 0, hevc: 1, av1: 2 } as const;\n\nclass NativeSink implements VideoFrameSink<AudioBuffer> {\n constructor(\n private readonly context: NativeExportContext,\n private readonly transport: NativeExportTransport,\n private readonly output: { width: number; height: number },\n private readonly encoding: { codec: number; bitrate?: number },\n ) { }\n\n private async flush(force = false): Promise<void> {\n if (this.context.out.size >= (force ? 1 : FLUSH_BYTES)) await this.transport.write(this.context.out.take());\n }\n\n async start(info: { width: number; height: number; fps: number; totalFrames: number }): Promise<void> {\n const { width, height } = this.output;\n const bitrate = this.encoding.bitrate ?? motionGraphicsBitrate(width, height, info.fps);\n this.context.out.record(NATIVE_RECORD.BEGIN, [width, height, Math.round(info.fps * 1000), info.totalFrames, bitrate, this.encoding.codec, 0]);\n await this.flush(true);\n }\n\n async addFrame(): Promise<void> {\n this.context.frameDone();\n await this.flush();\n }\n\n async addAudio(mixed: AudioBuffer): Promise<void> {\n const channels = mixed.numberOfChannels, frames = mixed.length;\n const pcm = new Float32Array(frames * channels);\n for (let c = 0; c < channels; c++) {\n const data = mixed.getChannelData(c);\n for (let i = 0; i < frames; i++) pcm[i * channels + c] = data[i];\n }\n this.context.out.record(NATIVE_RECORD.AUDIO, [mixed.sampleRate, channels], new Uint8Array(pcm.buffer));\n await this.flush(true);\n }\n\n async finalize(): Promise<Uint8Array | void> {\n this.context.out.record(NATIVE_RECORD.END, []);\n await this.flush(true);\n return this.transport.finish();\n }\n}\n\nconst EMPTY_MANIFEST: AssetManifest = { image: {}, video: {}, audio: {}, font: {} };\n\n/**\n * Experimental: {@link exportVideo} through the native sidecar. The frame\n * loop, adapter, text and assets run here exactly as for a canvas export;\n * what would be drawn is streamed to `transport` instead, and the sidecar\n * draws it with the same renderer on the native GPU and encodes it. MP4\n * only; `video.codec` picks avc (default), hevc or av1.\n */\nexport async function exportVideoNative(params: NativeExportParams): Promise<Uint8Array | void> {\n const {\n document: source, registry = new Registry(), scale = 1, manifest = EMPTY_MANIFEST, theme,\n includeAudio = true, video, audio = {}, frames, onProgress, signal, supersample = 2, transport,\n } = params;\n const project = resolveProjectDocument(source, params, DEFAULT_OUTPUT);\n if (project.tracks.length === 0) return;\n signal?.throwIfAborted();\n const viewport = project.viewport!;\n const fps = project.fps!;\n const { output, oversample, renderScale } = exportGeometry(viewport, scale, supersample);\n if (output.width % 4 !== 0) throw new RangeError(`A native export's width must be a multiple of 4 (NV12 packing); ${output.width} is not.`);\n\n // The WASM for text and shader validation only: nothing here draws.\n const renderer = await loadRenderer({ rendererWasmUrl: params.rendererWasmUrl }, { gpu: false });\n const assetCatalog = new ManifestAssetCatalog(manifest);\n const storageAdapter = renderer.createStorageAdapter({ catalog: assetCatalog, viewport, fps });\n const renderContext = createNativeExportContext(storageAdapter, {\n viewport,\n effects: transport.effects,\n size: { width: output.width * oversample, height: output.height * oversample },\n });\n const codec = video?.codec === \"hevc\" || video?.codec === \"av1\" ? CODEC_INDEX[video.codec] : CODEC_INDEX.avc;\n const bitrate = typeof video?.bitrate === \"number\" ? video.bitrate : undefined;\n try {\n return await renderTimeline<AudioBuffer>({\n project, registry, theme, scale: renderScale, includeAudio, frames,\n renderContext: renderContext as never, storageAdapter, assetCatalog,\n sink: new NativeSink(renderContext, transport, output, { codec, bitrate }),\n mixer: new WebAudioMixer(audio.sampleRate, assetCatalog),\n onProgress, onIssue: params.onIssue, signal,\n });\n } catch (error) {\n transport.abort?.(error);\n throw error;\n } finally {\n renderContext.dispose();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"native-export.js","sourceRoot":"","sources":["../src/native-export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,sBAAsB,EAAE,cAAc,EAAsB,MAAM,oBAAoB,CAAC;AAChI,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAA4B,MAAM,wBAAwB,CAAC;AAC5G,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAqB,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAuB9C,iEAAiE;AACjE,MAAM,W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AC,OAAO,EAAE,CAAC;IAC5B,CAAC;AACL,CAAC","sourcesContent":["import { ManifestAssetCatalog, Registry, resolveProjectDocument, DEFAULT_OUTPUT, type AssetManifest } from \"@motionscript/core\";\nimport { createNativeExportContext, NATIVE_RECORD, type NativeExportContext } from \"@motionscript/renderer\";\nimport { renderTimeline, type VideoFrameSink } from \"./frame-loop\";\nimport { exportGeometry, motionGraphicsBitrate, type ExportParams } from \"./exporter\";\nimport { loadRenderer } from \"./renderer\";\nimport { WebAudioMixer } from \"./audio/mixer\";\n\n/**\n * Where a native export's stream goes: a host process that replays it with\n * the renderer's `replay` module (Rust, feature `native`) on the native GPU\n * and encodes the frames itself. Experimental.\n */\nexport interface NativeExportTransport {\n /** The host renderer's built-in effect names, in its index order (`NativeRenderer::effect_names`). */\n readonly effects: readonly string[];\n /** The next bytes of the stream, in order. Resolves when the transport can take more. */\n write(bytes: Uint8Array): Promise<void>;\n /** The stream is complete; resolves with the file's bytes, or nothing when the host wrote it elsewhere. */\n finish(): Promise<Uint8Array | void>;\n /** The export failed or was cancelled: stop the host process, keep no file. */\n abort?(reason: unknown): void;\n}\n\nexport type NativeExportParams = Omit<ExportParams, \"format\" | \"returnBytes\" | \"filename\" | \"rendererWasmUrl\"> & {\n rendererWasmUrl?: string | URL;\n transport: NativeExportTransport;\n};\n\n/** Stream bytes held before they are handed to the transport. */\nconst FLUSH_BYTES = 1 << 18;\n\nconst CODEC_INDEX = { avc: 0, hevc: 1, av1: 2 } as const;\n\nclass NativeSink implements VideoFrameSink<AudioBuffer> {\n constructor(\n private readonly context: NativeExportContext,\n private readonly transport: NativeExportTransport,\n private readonly output: { width: number; height: number },\n private readonly encoding: { codec: number; bitrate?: number },\n ) { }\n\n private async flush(force = false): Promise<void> {\n if (this.context.out.size >= (force ? 1 : FLUSH_BYTES)) await this.transport.write(this.context.out.take());\n }\n\n async start(info: { width: number; height: number; fps: number; totalFrames: number }): Promise<void> {\n const { width, height } = this.output;\n const bitrate = this.encoding.bitrate ?? motionGraphicsBitrate(width, height, info.fps);\n this.context.out.record(NATIVE_RECORD.BEGIN, [width, height, Math.round(info.fps * 1000), info.totalFrames, bitrate, this.encoding.codec, 0]);\n await this.flush(true);\n }\n\n async addFrame(): Promise<void> {\n this.context.frameDone();\n await this.flush();\n }\n\n async addAudio(mixed: AudioBuffer): Promise<void> {\n const channels = mixed.numberOfChannels, frames = mixed.length;\n const pcm = new Float32Array(frames * channels);\n for (let c = 0; c < channels; c++) {\n const data = mixed.getChannelData(c);\n for (let i = 0; i < frames; i++) pcm[i * channels + c] = data[i];\n }\n this.context.out.record(NATIVE_RECORD.AUDIO, [mixed.sampleRate, channels], new Uint8Array(pcm.buffer));\n await this.flush(true);\n }\n\n async finalize(): Promise<Uint8Array | void> {\n this.context.out.record(NATIVE_RECORD.END, []);\n await this.flush(true);\n return this.transport.finish();\n }\n}\n\nconst EMPTY_MANIFEST: AssetManifest = { image: {}, video: {}, audio: {}, font: {} };\n\n/**\n * Experimental: {@link exportVideo} through a native host process. The frame\n * loop, adapter, text and assets run here exactly as for a canvas export;\n * what would be drawn is streamed to `transport` instead, and the host draws\n * it with the same renderer on the native GPU and encodes it. `video.codec`\n * (avc by default, hevc or av1) and the bitrate are passed on in the stream.\n */\nexport async function exportVideoNative(params: NativeExportParams): Promise<Uint8Array | void> {\n const {\n document: source, registry = new Registry(), scale = 1, manifest = EMPTY_MANIFEST, theme,\n includeAudio = true, video, audio = {}, frames, onProgress, signal, supersample = 2, transport,\n } = params;\n const project = resolveProjectDocument(source, params, DEFAULT_OUTPUT);\n if (project.tracks.length === 0) return;\n signal?.throwIfAborted();\n const viewport = project.viewport!;\n const fps = project.fps!;\n const { output, oversample, renderScale } = exportGeometry(viewport, scale, supersample);\n if (output.width % 4 !== 0) throw new RangeError(`A native export's width must be a multiple of 4 (NV12 packing); ${output.width} is not.`);\n\n // The WASM for text and shader validation only: nothing here draws.\n const renderer = await loadRenderer({ rendererWasmUrl: params.rendererWasmUrl }, { gpu: false });\n const assetCatalog = new ManifestAssetCatalog(manifest);\n const storageAdapter = renderer.createStorageAdapter({ catalog: assetCatalog, viewport, fps });\n const renderContext = createNativeExportContext(storageAdapter, {\n viewport,\n effects: transport.effects,\n size: { width: output.width * oversample, height: output.height * oversample },\n });\n const codec = video?.codec === \"hevc\" || video?.codec === \"av1\" ? CODEC_INDEX[video.codec] : CODEC_INDEX.avc;\n const bitrate = typeof video?.bitrate === \"number\" ? video.bitrate : undefined;\n try {\n return await renderTimeline<AudioBuffer>({\n project, registry, theme, scale: renderScale, includeAudio, frames,\n renderContext: renderContext as never, storageAdapter, assetCatalog,\n sink: new NativeSink(renderContext, transport, output, { codec, bitrate }),\n mixer: new WebAudioMixer(audio.sampleRate, assetCatalog),\n onProgress, onIssue: params.onIssue, signal,\n });\n } catch (error) {\n transport.abort?.(error);\n throw error;\n } finally {\n renderContext.dispose();\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motionscript/browser",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Motion Script in the browser: WebGPU rendering through @motionscript/renderer, video and still export, audio playback.",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@motionscript/core": "^0.1.1-alpha.
|
|
41
|
+
"@motionscript/core": "^0.1.1-alpha.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@vitest/browser": "4.1.7",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
"typescript": "^6.0.3",
|
|
54
54
|
"typescript-eslint": "^8.48.0",
|
|
55
55
|
"vitest": "^4.1.5",
|
|
56
|
-
"@motionscript/core": "0.1.1-alpha.
|
|
56
|
+
"@motionscript/core": "0.1.1-alpha.2"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@mediabunny/mp3-encoder": "^1.49.0",
|
|
60
60
|
"esbuild-wasm": "^0.28.1",
|
|
61
61
|
"mediabunny": "^1.40.1",
|
|
62
|
-
"@motionscript/renderer": "^0.1.1-alpha.
|
|
62
|
+
"@motionscript/renderer": "^0.1.1-alpha.2"
|
|
63
63
|
},
|
|
64
64
|
"motionscriptBrowser": {
|
|
65
65
|
"assets": {
|