@vivix-labs/media-tools 1.0.0-beta.24 → 1.0.0-beta.25
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/README.md +15 -6
- package/dist/client.bundle.js +54 -5
- package/dist/client.css +62 -3
- package/dist/server.js +531 -88
- package/dist/shared.d.ts +328 -4
- package/dist/shared.js +52 -2
- package/dist/subtitle-track.d.ts +15 -1
- package/dist/subtitle-track.js +9 -2
- package/dist/worker.js +4 -3
- package/docs/operations.md +11 -0
- package/docs/processing.md +59 -2
- package/package.json +1 -1
- package/resources/Subtitle-Bold.woff +0 -0
package/README.md
CHANGED
|
@@ -10,6 +10,10 @@ Moving the start earlier or the end later refreshes the displayed source frame e
|
|
|
10
10
|
when the old playhead remains within the expanded range. The end preview stays one
|
|
11
11
|
millisecond inside the exclusive out-point; source files remain unchanged until processing.
|
|
12
12
|
|
|
13
|
+
To render an independent film variation, pass a request-level `mix` and an optional
|
|
14
|
+
whole-film `window` to `sequence.process`. Read back its editable sources and
|
|
15
|
+
frozen mix through `sequence.recipe`. See [processing](docs/processing.md).
|
|
16
|
+
|
|
13
17
|
## Save, process and choose
|
|
14
18
|
|
|
15
19
|
Apply saves an immutable editing recipe and returns `SavedEdit`. It does not encode a
|
|
@@ -100,7 +104,7 @@ the UI does not retry automatically.
|
|
|
100
104
|
audio pitch. Accelerated output is capped at 60 fps when necessary. Legacy recipes
|
|
101
105
|
without these fields retain their original colors and 1× speed. Each editor resets
|
|
102
106
|
only its own adjustment and preserves the others.
|
|
103
|
-
-
|
|
107
|
+
- For frame edits, no audio or one mono/stereo AAC stream with a positive integer sample rate. Whole-master music changes also support multiple AAC tracks and MP4 text subtitles. Unsupported color, streams,
|
|
104
108
|
dimensions and codecs fail explicitly.
|
|
105
109
|
- Source display dimensions must be even, with long edge at most 3840 and short edge
|
|
106
110
|
at most 2160. Each source is at most 600 seconds and 2 GiB.
|
|
@@ -118,7 +122,7 @@ original snapshot. Processing sets interpretation before scaling and checks that
|
|
|
118
122
|
output primaries, transfer and matrix are all BT.709 before publication. Input range
|
|
119
123
|
interpretation remains respected; output labels alone do not prove color correctness.
|
|
120
124
|
|
|
121
|
-
Sequence input is `{ inputs, outputName, canvas, settings?, retryOfJobId? }`: 1–64
|
|
125
|
+
Sequence input is `{ inputs, outputName, canvas, settings?, mix?, subtitle?, window?, retryOfJobId? }`: 1–64
|
|
122
126
|
ordered fixed inputs, at most 600 seconds selected duration and 2 GiB of distinct sources.
|
|
123
127
|
A source input may supply `trimEndMs` to stop at a saved shot duration, with one source
|
|
124
128
|
frame of tolerance at the end. Without `settings`, every effective crop must still have
|
|
@@ -134,9 +138,14 @@ reports supported encoder and container pairs for sequence export. The dialog al
|
|
|
134
138
|
checks browser playback before offering H.265 MP4 or VP9 WebM. These additional
|
|
135
139
|
output formats do not expand the accepted inputs for editing and processing.
|
|
136
140
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
For an imported H.264 MP4 with multiple AAC streams or switchable MP4 text captions,
|
|
142
|
+
`video.resolve` reports the embedded tracks and the default audio index. Submit the
|
|
143
|
+
whole master and its original dimensions to `sequence.process` with a request-level
|
|
144
|
+
`mix` to add or replace music on the primary track. The exported candidate keeps the
|
|
145
|
+
original encoded picture, alternate audio streams and selectable captions. Use the
|
|
146
|
+
fixed master and mix returned by `sequence.recipe` for the next revision.
|
|
147
|
+
|
|
148
|
+
With original clip audio only, short audio is padded to its section and all-silent sequences have no audio stream. A sequence mix can add a continuous music bed, narration and effects across cuts. The workbench owns candidate selection and adoption.
|
|
140
149
|
|
|
141
150
|
One media process runs per instance, supervised by a short-lived Node worker. Probes and
|
|
142
151
|
decode checks use that same channel. Uncached preview requests can return `MEDIA_BUSY`
|
|
@@ -162,4 +171,4 @@ column menu. `renderSlotActions` remains supported for existing consumers.
|
|
|
162
171
|
|
|
163
172
|
`sequence.process` accepts an optional `subtitle` with a fixed project asset file and whole-film style. `subtitles.preview` takes the same track and output canvas and returns timed transparent images. Preview and export use the same glyphs, wrapping and positions. UTF-8 SRT and ASS dialogue text are supported. ASS style overrides are discarded. Use a subtitle attachment or import a primary file with purpose `subtitle`.
|
|
164
173
|
|
|
165
|
-
The renderer bundles Noto Sans SC from `@fontsource/noto-sans-sc@5.3.1` under the SIL Open Font License, opentype.js under MIT and resvg-js WASM under MPL-2.0. See `resources/` for notices.
|
|
174
|
+
The renderer bundles Noto Sans SC Regular (`Subtitle.woff`) and Bold (`Subtitle-Bold.woff`, used for `weight: "bold"`, the default) from `@fontsource/noto-sans-sc@5.3.1` under the SIL Open Font License, opentype.js under MIT and resvg-js WASM under MPL-2.0. See `resources/` for notices.
|
package/dist/client.bundle.js
CHANGED
|
@@ -62,9 +62,16 @@ var subtitleStyle = z2.object({
|
|
|
62
62
|
size: z2.number().int().min(32).max(80).default(52),
|
|
63
63
|
position: z2.enum(["top", "middle", "bottom"]).default("bottom"),
|
|
64
64
|
color: z2.string().regex(/^#[0-9a-f]{6}$/i).default("#ffffff"),
|
|
65
|
-
background: z2.boolean().default(false)
|
|
65
|
+
background: z2.boolean().default(false),
|
|
66
|
+
weight: z2.enum(["regular", "bold"]).default("bold"),
|
|
67
|
+
outline: z2.number().int().min(0).max(12).default(4),
|
|
68
|
+
margin: z2.number().int().min(0).max(900).optional()
|
|
69
|
+
}).strict();
|
|
70
|
+
var subtitleTrack = z2.object({
|
|
71
|
+
file: videoFileRef,
|
|
72
|
+
atMs: z2.number().int().min(0).max(6e5).optional(),
|
|
73
|
+
style: subtitleStyle.default(() => subtitleStyle.parse({}))
|
|
66
74
|
}).strict();
|
|
67
|
-
var subtitleTrack = z2.object({ file: videoFileRef, style: subtitleStyle.default(() => subtitleStyle.parse({})) }).strict();
|
|
68
75
|
|
|
69
76
|
// packages/media-tools/src/shared.ts
|
|
70
77
|
var Config = z3.object({
|
|
@@ -125,6 +132,16 @@ var geometry = z3.object({
|
|
|
125
132
|
displayHeight: z3.number().int().positive(),
|
|
126
133
|
pixelRect
|
|
127
134
|
}).strict();
|
|
135
|
+
var containerTrack = z3.object({
|
|
136
|
+
language: z3.string().optional(),
|
|
137
|
+
title: z3.string().optional(),
|
|
138
|
+
disposition: z3.array(z3.string())
|
|
139
|
+
});
|
|
140
|
+
var embeddedTracks = z3.object({
|
|
141
|
+
primaryAudioIndex: z3.number().int().nonnegative().nullable(),
|
|
142
|
+
audio: z3.array(containerTrack),
|
|
143
|
+
subtitles: z3.array(containerTrack)
|
|
144
|
+
});
|
|
128
145
|
var metadata = z3.object({
|
|
129
146
|
durationMs: z3.number().int().positive(),
|
|
130
147
|
width: z3.number().int().positive(),
|
|
@@ -135,6 +152,7 @@ var metadata = z3.object({
|
|
|
135
152
|
frameRate: z3.number().positive().max(60),
|
|
136
153
|
startTime: z3.number().finite(),
|
|
137
154
|
hasAudio: z3.boolean(),
|
|
155
|
+
embeddedTracks: embeddedTracks.optional(),
|
|
138
156
|
audioSampleRate: z3.number().int().nullable(),
|
|
139
157
|
audioChannels: z3.number().int().nullable(),
|
|
140
158
|
audioStartTime: z3.number().finite().nullable(),
|
|
@@ -244,10 +262,17 @@ var processSequence = z3.object({
|
|
|
244
262
|
inputs: sequenceInputs,
|
|
245
263
|
outputName,
|
|
246
264
|
canvas,
|
|
265
|
+
mix: audioMix.nullable().optional(),
|
|
266
|
+
window: z3.object({ inMs: milliseconds, outMs: milliseconds }).strict().refine((value) => value.inMs < value.outMs, "The film window must have positive duration.").optional(),
|
|
247
267
|
subtitle: subtitleTrack.optional(),
|
|
248
268
|
settings: exportSettings.optional(),
|
|
249
269
|
retryOfJobId: z3.uuid().optional()
|
|
250
270
|
}).strict();
|
|
271
|
+
var sequenceRecipe = z3.object({
|
|
272
|
+
jobId: z3.uuid(),
|
|
273
|
+
windowStartMs: milliseconds.optional(),
|
|
274
|
+
input: processSequence.extend({ mix: audioMix.nullable() }).omit({ retryOfJobId: true })
|
|
275
|
+
});
|
|
251
276
|
var mediaRequest = z3.discriminatedUnion("operation", [
|
|
252
277
|
z3.object({ operation: z3.literal("video.process"), input: processVideo }).strict(),
|
|
253
278
|
z3.object({ operation: z3.literal("sequence.process"), input: processSequence }).strict()
|
|
@@ -1333,7 +1358,7 @@ function PlaybackControls({ playing, muted, time, duration, size = "medium", var
|
|
|
1333
1358
|
function VideoPlayer(props) {
|
|
1334
1359
|
return _jsx12(Playback, { ...props }, JSON.stringify([props.src, props.poster, props.posterDuration]));
|
|
1335
1360
|
}
|
|
1336
|
-
function Playback({ src, poster, aspectRatio, stageAspectRatio, posterDuration = 0, title, version, durationLabel, sceneLabel, defaultMuted = false, controlsPlacement = "overlay", fitContent = false, fillContainer = false, compactCover = false, showCoverInfo = true, showCoverPlay = true, fitExpandedContent = false, fillExpandedFrame = false, controlsSize, controlsVariant, iconSet, controlsAppearance, timeDisplay, controlsActions, showFullscreen = true, fullscreenMode = "native", overlay, deferred = false, onActivate, containerRef, onBeforePlay, onStateChange, onTimeChange, onAspectRatio, onEnded, onError }) {
|
|
1361
|
+
function Playback({ src, poster, aspectRatio, stageAspectRatio, posterDuration = 0, initialTime = 0, title, version, durationLabel, sceneLabel, defaultMuted = false, controlsPlacement = "overlay", fitContent = false, fillContainer = false, compactCover = false, showCoverInfo = true, showCoverPlay = true, fitExpandedContent = false, fillExpandedFrame = false, controlsSize, controlsVariant, iconSet, controlsAppearance, timeDisplay, controlsActions, subtitleTrack: subtitleTrack2, showFullscreen = true, fullscreenMode = "native", overlay, deferred = false, onActivate, containerRef, onBeforePlay, onStateChange, onTimeChange, onAspectRatio, onEnded, onError }) {
|
|
1337
1362
|
const root = useRef5(null);
|
|
1338
1363
|
const expandedPlaceholder = useRef5(null);
|
|
1339
1364
|
const video = useRef5(null);
|
|
@@ -1358,7 +1383,7 @@ function Playback({ src, poster, aspectRatio, stageAspectRatio, posterDuration =
|
|
|
1358
1383
|
root.current?.querySelector('button[aria-label="Expand video"]')?.focus();
|
|
1359
1384
|
}
|
|
1360
1385
|
}, [expanded]);
|
|
1361
|
-
const restore = useRef5(void 0);
|
|
1386
|
+
const restore = useRef5(Number.isFinite(initialTime) && initialTime > 0 ? { time: initialTime, playing: false, state: "paused" } : void 0);
|
|
1362
1387
|
const wasDeferred = useRef5(deferred);
|
|
1363
1388
|
if (deferred)
|
|
1364
1389
|
wasDeferred.current = true;
|
|
@@ -1390,6 +1415,27 @@ function Playback({ src, poster, aspectRatio, stageAspectRatio, posterDuration =
|
|
|
1390
1415
|
element.load();
|
|
1391
1416
|
};
|
|
1392
1417
|
}, [inlineDialog ? false : expanded, src, inlineDialog, mountVideo]);
|
|
1418
|
+
useEffect6(() => {
|
|
1419
|
+
const element = video.current;
|
|
1420
|
+
if (!element || subtitleTrack2 === void 0)
|
|
1421
|
+
return;
|
|
1422
|
+
function selectTrack() {
|
|
1423
|
+
if (!element)
|
|
1424
|
+
return;
|
|
1425
|
+
const selected = element.querySelector("track")?.track;
|
|
1426
|
+
for (const track of Array.from(element.textTracks)) {
|
|
1427
|
+
if (track.kind === "captions" || track.kind === "subtitles")
|
|
1428
|
+
track.mode = track === selected ? "showing" : "disabled";
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
selectTrack();
|
|
1432
|
+
element.textTracks.addEventListener("addtrack", selectTrack);
|
|
1433
|
+
element.addEventListener("loadedmetadata", selectTrack);
|
|
1434
|
+
return () => {
|
|
1435
|
+
element.textTracks.removeEventListener("addtrack", selectTrack);
|
|
1436
|
+
element.removeEventListener("loadedmetadata", selectTrack);
|
|
1437
|
+
};
|
|
1438
|
+
}, [subtitleTrack2, mountVideo, expanded]);
|
|
1393
1439
|
function updateTime(next) {
|
|
1394
1440
|
position.current = next;
|
|
1395
1441
|
setTime(next);
|
|
@@ -1564,7 +1610,7 @@ function Playback({ src, poster, aspectRatio, stageAspectRatio, posterDuration =
|
|
|
1564
1610
|
changeState("paused");
|
|
1565
1611
|
if (event.currentTarget.error)
|
|
1566
1612
|
onError?.(event.currentTarget.error);
|
|
1567
|
-
} }) : poster && _jsx12("img", { src: poster, alt: "" }), overlay, state === "cover" && !fitted && _jsxs11("div", { className: "vx-video-cover", "data-plain": !showCoverInfo || void 0, children: [showCoverInfo && _jsxs11("div", { className: "vx-video-info", children: [_jsxs11("div", { className: "vx-video-title", children: [_jsx12("strong", { title, children: title }), version && _jsx12(Tag, { children: version })] }), (durationLabel || sceneLabel) && _jsxs11("div", { className: "vx-video-meta", children: [durationLabel && _jsx12("span", { children: durationLabel }), durationLabel && sceneLabel && _jsx12("span", { "aria-hidden": "true", children: "\xB7" }), sceneLabel && _jsx12("span", { children: sceneLabel })] })] }), showCoverPlay && (src || duration > 0) && _jsx12(IconButton, { icon: "play-cover", className: "vx-video-start", label: `Play ${title}`, variant: "icon-circle-lg", onClick: togglePlay })] })] }), _jsx12(PlaybackControls, { fullscreen: fullscreenMode === "dialog" ? expanded : nativeFullscreen.fullscreen, playing: state === "playing", muted, time: Math.min(time, duration), duration, disabled: !src && !duration, size: controlsSize, variant: controlsVariant, iconSet, appearance: controlsAppearance, timeDisplay, actions: controlsActions, onTogglePlay: togglePlay, onToggleMute: () => setMuted(!muted), onSeek: seek, onFullscreen: showFullscreen && !(expanded && (fitExpandedContent || frameExpansion)) ? () => void toggleFullscreen() : void 0, fullscreenLabel: fullscreenMode === "dialog" ? expanded ? "Close expanded video" : "Expand video" : void 0 })] });
|
|
1613
|
+
}, children: subtitleTrack2 && _jsx12("track", { kind: "subtitles", src: subtitleTrack2.src, srcLang: subtitleTrack2.language, label: subtitleTrack2.label, default: true }, subtitleTrack2.src) }) : poster && _jsx12("img", { src: poster, alt: "" }), overlay, state === "cover" && !fitted && _jsxs11("div", { className: "vx-video-cover", "data-plain": !showCoverInfo || void 0, children: [showCoverInfo && _jsxs11("div", { className: "vx-video-info", children: [_jsxs11("div", { className: "vx-video-title", children: [_jsx12("strong", { title, children: title }), version && _jsx12(Tag, { children: version })] }), (durationLabel || sceneLabel) && _jsxs11("div", { className: "vx-video-meta", children: [durationLabel && _jsx12("span", { children: durationLabel }), durationLabel && sceneLabel && _jsx12("span", { "aria-hidden": "true", children: "\xB7" }), sceneLabel && _jsx12("span", { children: sceneLabel })] })] }), showCoverPlay && (src || duration > 0) && _jsx12(IconButton, { icon: "play-cover", className: "vx-video-start", label: `Play ${title}`, variant: "icon-circle-lg", onClick: togglePlay })] })] }), _jsx12(PlaybackControls, { fullscreen: fullscreenMode === "dialog" ? expanded : nativeFullscreen.fullscreen, playing: state === "playing", muted, time: Math.min(time, duration), duration, disabled: !src && !duration, size: controlsSize, variant: controlsVariant, iconSet, appearance: controlsAppearance, timeDisplay, actions: controlsActions, onTogglePlay: togglePlay, onToggleMute: () => setMuted(!muted), onSeek: seek, onFullscreen: showFullscreen && !(expanded && (fitExpandedContent || frameExpansion)) ? () => void toggleFullscreen() : void 0, fullscreenLabel: fullscreenMode === "dialog" ? expanded ? "Close expanded video" : "Expand video" : void 0 })] });
|
|
1568
1614
|
return _jsxs11(_Fragment5, { children: [expanded ? _jsx12("div", { ref: expandedPlaceholder, "aria-hidden": "true", style: { height: inlineHeight } }) : !inlineDialog && player, _jsx12(Dialog, { title, open: expanded, onOpenChange: changeExpanded, className: `vx-video-dialog${dialogLayout}`, inlineWhenClosed: inlineDialog, children: (expanded || inlineDialog) && player })] });
|
|
1569
1615
|
}
|
|
1570
1616
|
|
|
@@ -3085,6 +3131,9 @@ async function activate(client) {
|
|
|
3085
3131
|
};
|
|
3086
3132
|
client.provide({
|
|
3087
3133
|
capabilityVersion: "media-tools/client/1",
|
|
3134
|
+
supportsSequenceMixOverride: true,
|
|
3135
|
+
supportsEmbeddedMasterTracks: true,
|
|
3136
|
+
readSubtitleTrack: (file, index) => client.invoke({ instanceId, operationId: "video.subtitleTrack" }, { file, index }),
|
|
3088
3137
|
resolve,
|
|
3089
3138
|
previewSubtitle: (subtitle, canvas2) => client.invoke({ instanceId, operationId: "subtitles.preview" }, { subtitle, canvas: canvas2 }),
|
|
3090
3139
|
submit: (request, requestKey) => submitOrFind(client, instanceId, request, requestKey)
|
package/dist/client.css
CHANGED
|
@@ -367,7 +367,8 @@
|
|
|
367
367
|
--vx-button-font-size: var(--vx-button-32-font-size);
|
|
368
368
|
--vx-button-line-height: var(--vx-button-32-line-height);
|
|
369
369
|
}
|
|
370
|
-
.vx-button[data-size="40"]
|
|
370
|
+
.vx-button[data-size="40"],
|
|
371
|
+
.vx-dialog[open] > footer .vx-button[data-shape=text] {
|
|
371
372
|
--vx-button-height: var(--vx-button-40-height);
|
|
372
373
|
--vx-button-icon-size: var(--vx-button-40-icon-size);
|
|
373
374
|
--vx-button-radius: var(--vx-button-40-radius);
|
|
@@ -376,8 +377,7 @@
|
|
|
376
377
|
--vx-button-font-size: var(--vx-button-40-font-size);
|
|
377
378
|
--vx-button-line-height: var(--vx-button-40-line-height);
|
|
378
379
|
}
|
|
379
|
-
.vx-button[data-size="44"]
|
|
380
|
-
.vx-dialog > footer .vx-button[data-shape=text] {
|
|
380
|
+
.vx-button[data-size="44"] {
|
|
381
381
|
--vx-button-height: var(--vx-button-44-height);
|
|
382
382
|
--vx-button-icon-size: var(--vx-button-44-icon-size);
|
|
383
383
|
--vx-button-radius: var(--vx-button-44-radius);
|
|
@@ -1382,6 +1382,65 @@
|
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
1384
|
|
|
1385
|
+
/* packages/ui-system/dist/workbench-page.css */
|
|
1386
|
+
.vx-workbench-page-header {
|
|
1387
|
+
display: flex;
|
|
1388
|
+
align-items: center;
|
|
1389
|
+
gap: 10px;
|
|
1390
|
+
height: 40px;
|
|
1391
|
+
min-height: 40px;
|
|
1392
|
+
padding: 4px 4px 4px 16px;
|
|
1393
|
+
}
|
|
1394
|
+
.vx-workbench-page-header h1 {
|
|
1395
|
+
margin: 0;
|
|
1396
|
+
flex: 1;
|
|
1397
|
+
min-width: 0;
|
|
1398
|
+
overflow: hidden;
|
|
1399
|
+
white-space: nowrap;
|
|
1400
|
+
text-overflow: ellipsis;
|
|
1401
|
+
font: var(--vx-typography-inter-18-semi-bold);
|
|
1402
|
+
}
|
|
1403
|
+
.vx-workbench-page-panel {
|
|
1404
|
+
display: flex;
|
|
1405
|
+
flex-direction: column;
|
|
1406
|
+
flex: 1;
|
|
1407
|
+
min-height: 0;
|
|
1408
|
+
min-width: 0;
|
|
1409
|
+
border-radius: 16px;
|
|
1410
|
+
overflow: hidden;
|
|
1411
|
+
background: var(--vx-background-dialog);
|
|
1412
|
+
}
|
|
1413
|
+
.vx-workbench-page-toolbar,
|
|
1414
|
+
.vx-workbench-tabbed-panel > div > .vx-tabs {
|
|
1415
|
+
display: flex;
|
|
1416
|
+
align-items: center;
|
|
1417
|
+
gap: 8px;
|
|
1418
|
+
min-height: var(--vx-tabs-primary-height);
|
|
1419
|
+
padding: 0 var(--vx-space-12) 0 var(--vx-space-16);
|
|
1420
|
+
border-bottom: var(--vx-divider-width) solid var(--vx-border-secondary);
|
|
1421
|
+
flex: none;
|
|
1422
|
+
}
|
|
1423
|
+
.vx-workbench-tabbed-panel > div > .vx-tabs .vx-tab-list {
|
|
1424
|
+
align-self: stretch;
|
|
1425
|
+
--vx-tab-list-gap: var(--vx-space-16);
|
|
1426
|
+
}
|
|
1427
|
+
@media (max-width: 500px) {
|
|
1428
|
+
.vx-workbench-page-header {
|
|
1429
|
+
padding-left: 4px;
|
|
1430
|
+
flex-wrap: wrap;
|
|
1431
|
+
height: auto;
|
|
1432
|
+
min-height: 40px;
|
|
1433
|
+
}
|
|
1434
|
+
.vx-workbench-page-header h1 {
|
|
1435
|
+
flex: 1 1 120px;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
@media (max-width: 1100px) {
|
|
1439
|
+
.vx-workbench-page-header h1 {
|
|
1440
|
+
font: var(--vx-typography-inter-14-semi-bold);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1385
1444
|
/* packages/ui-system/dist/field.css */
|
|
1386
1445
|
@scope ([data-vx-theme]) {
|
|
1387
1446
|
.vx-slider[data-appearance=neutral] {
|