@omnimedia/omnitool 1.0.0 → 1.1.0-3
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/LICENSE +21 -0
- package/README.md +120 -2
- package/package.json +56 -27
- package/s/_archive/types.ts +107 -0
- package/s/context.ts +7 -0
- package/s/demo/demo.bundle.ts +64 -0
- package/s/demo/demo.css +54 -0
- package/s/demo/routines/filmstrip-test.ts +68 -0
- package/s/demo/routines/load-video.ts +7 -0
- package/s/demo/routines/transcode-test.ts +44 -0
- package/s/demo/routines/waveform-test.ts +12 -0
- package/s/driver/driver.test.ts +15 -0
- package/s/driver/driver.ts +116 -0
- package/s/driver/driver.worker.bundle.ts +7 -0
- package/s/driver/fns/host.ts +12 -0
- package/s/driver/fns/schematic.ts +83 -0
- package/s/driver/fns/work.ts +237 -0
- package/s/driver/parts/constants.ts +17 -0
- package/s/driver/parts/machina.ts +27 -0
- package/s/driver/utils/load-decoder-source.ts +13 -0
- package/s/driver/utils/sleep.ts +3 -0
- package/s/index.html.ts +53 -0
- package/s/index.ts +2 -39
- package/s/tests.test.ts +8 -0
- package/s/timeline/index.ts +14 -0
- package/s/timeline/parts/basics.ts +17 -0
- package/s/timeline/parts/filmstrip.ts +159 -0
- package/s/timeline/parts/item.ts +58 -0
- package/s/timeline/parts/media.ts +14 -0
- package/s/timeline/parts/resource-pool.ts +27 -0
- package/s/timeline/parts/resource.ts +11 -0
- package/s/timeline/parts/waveform.ts +62 -0
- package/s/timeline/sugar/o.ts +60 -0
- package/s/timeline/sugar/omni-test.ts +38 -0
- package/s/timeline/sugar/omni.ts +30 -0
- package/s/timeline/utils/checksum.ts +19 -0
- package/s/timeline/utils/datafile.ts +21 -0
- package/s/timeline/utils/dummy-data.ts +7 -0
- package/x/context.d.ts +4 -0
- package/x/context.js +6 -0
- package/x/context.js.map +1 -0
- package/x/demo/demo.bundle.d.ts +1 -0
- package/x/demo/demo.bundle.js +51 -0
- package/x/demo/demo.bundle.js.map +1 -0
- package/x/demo/demo.bundle.min.js +118 -0
- package/x/demo/demo.bundle.min.js.map +7 -0
- package/x/demo/demo.css +54 -0
- package/x/demo/routines/filmstrip-test.d.ts +1 -0
- package/x/demo/routines/filmstrip-test.js +62 -0
- package/x/demo/routines/filmstrip-test.js.map +1 -0
- package/x/demo/routines/load-video.d.ts +1 -0
- package/x/demo/routines/load-video.js +6 -0
- package/x/demo/routines/load-video.js.map +1 -0
- package/x/demo/routines/transcode-test.d.ts +6 -0
- package/x/demo/routines/transcode-test.js +38 -0
- package/x/demo/routines/transcode-test.js.map +1 -0
- package/x/demo/routines/waveform-test.d.ts +1 -0
- package/x/demo/routines/waveform-test.js +11 -0
- package/x/demo/routines/waveform-test.js.map +1 -0
- package/x/driver/driver.d.ts +22 -0
- package/x/driver/driver.js +97 -0
- package/x/driver/driver.js.map +1 -0
- package/x/driver/driver.test.d.ts +5 -0
- package/x/driver/driver.test.js +12 -0
- package/x/driver/driver.test.js.map +1 -0
- package/x/driver/driver.worker.bundle.d.ts +1 -0
- package/x/driver/driver.worker.bundle.js +4 -0
- package/x/driver/driver.worker.bundle.js.map +1 -0
- package/x/driver/driver.worker.bundle.min.js +1148 -0
- package/x/driver/driver.worker.bundle.min.js.map +7 -0
- package/x/driver/fns/host.d.ts +18 -0
- package/x/driver/fns/host.js +7 -0
- package/x/driver/fns/host.js.map +1 -0
- package/x/driver/fns/schematic.d.ts +66 -0
- package/x/driver/fns/schematic.js +2 -0
- package/x/driver/fns/schematic.js.map +1 -0
- package/x/driver/fns/work.d.ts +19 -0
- package/x/driver/fns/work.js +192 -0
- package/x/driver/fns/work.js.map +1 -0
- package/x/driver/parts/constants.d.ts +2 -0
- package/x/driver/parts/constants.js +17 -0
- package/x/driver/parts/constants.js.map +1 -0
- package/x/driver/parts/machina.d.ts +23 -0
- package/x/driver/parts/machina.js +14 -0
- package/x/driver/parts/machina.js.map +1 -0
- package/x/driver/utils/load-decoder-source.d.ts +2 -0
- package/x/driver/utils/load-decoder-source.js +12 -0
- package/x/driver/utils/load-decoder-source.js.map +1 -0
- package/x/driver/utils/sleep.d.ts +1 -0
- package/x/driver/utils/sleep.js +4 -0
- package/x/driver/utils/sleep.js.map +1 -0
- package/x/index.d.ts +2 -9
- package/x/index.html +105 -0
- package/x/index.html.d.ts +2 -0
- package/x/index.html.js +47 -0
- package/x/index.html.js.map +1 -0
- package/x/index.js +2 -29
- package/x/index.js.map +1 -1
- package/x/tests.test.d.ts +1 -0
- package/x/tests.test.js +6 -0
- package/x/tests.test.js.map +1 -0
- package/x/timeline/index.d.ts +10 -0
- package/x/timeline/index.js +11 -0
- package/x/timeline/index.js.map +1 -0
- package/x/timeline/parts/basics.d.ts +12 -0
- package/x/timeline/parts/basics.js +2 -0
- package/x/timeline/parts/basics.js.map +1 -0
- package/x/timeline/parts/filmstrip.d.ts +39 -0
- package/x/timeline/parts/filmstrip.js +117 -0
- package/x/timeline/parts/filmstrip.js.map +1 -0
- package/x/timeline/parts/item.d.ts +42 -0
- package/x/timeline/parts/item.js +13 -0
- package/x/timeline/parts/item.js.map +1 -0
- package/x/timeline/parts/media.d.ts +7 -0
- package/x/timeline/parts/media.js +13 -0
- package/x/timeline/parts/media.js.map +1 -0
- package/x/timeline/parts/resource-pool.d.ts +7 -0
- package/x/timeline/parts/resource-pool.js +19 -0
- package/x/timeline/parts/resource-pool.js.map +1 -0
- package/x/timeline/parts/resource.d.ts +8 -0
- package/x/timeline/parts/resource.js +2 -0
- package/x/timeline/parts/resource.js.map +1 -0
- package/x/timeline/parts/waveform.d.ts +8 -0
- package/x/timeline/parts/waveform.js +51 -0
- package/x/timeline/parts/waveform.js.map +1 -0
- package/x/timeline/sugar/o.d.ts +14 -0
- package/x/timeline/sugar/o.js +48 -0
- package/x/timeline/sugar/o.js.map +1 -0
- package/x/timeline/sugar/omni-test.d.ts +1 -0
- package/x/timeline/sugar/omni-test.js +22 -0
- package/x/timeline/sugar/omni-test.js.map +1 -0
- package/x/timeline/sugar/omni.d.ts +11 -0
- package/x/timeline/sugar/omni.js +20 -0
- package/x/timeline/sugar/omni.js.map +1 -0
- package/x/timeline/utils/checksum.d.ts +8 -0
- package/x/timeline/utils/checksum.js +20 -0
- package/x/timeline/utils/checksum.js.map +1 -0
- package/x/timeline/utils/datafile.d.ts +9 -0
- package/x/timeline/utils/datafile.js +20 -0
- package/x/timeline/utils/datafile.js.map +1 -0
- package/x/timeline/utils/dummy-data.d.ts +2 -0
- package/x/timeline/utils/dummy-data.js +3 -0
- package/x/timeline/utils/dummy-data.js.map +1 -0
- package/s/parts/compositor.ts +0 -5
- package/s/parts/export.ts +0 -5
- package/s/parts/video-decoder.ts +0 -27
- package/s/parts/video-encoder.ts +0 -15
- package/s/tools/generate-id.ts +0 -7
- package/s/tools/mp4boxjs/LICENSE.md +0 -24
- package/s/tools/mp4boxjs/demuxer.ts +0 -106
- package/s/tools/mp4boxjs/mp4box.adapter.ts +0 -148
- package/s/tools/mp4boxjs/mp4box.js +0 -8206
- package/s/types.ts +0 -10
- package/x/parts/compositor.d.ts +0 -4
- package/x/parts/compositor.js +0 -5
- package/x/parts/compositor.js.map +0 -1
- package/x/parts/export.d.ts +0 -7
- package/x/parts/export.js +0 -5
- package/x/parts/export.js.map +0 -1
- package/x/parts/video-decoder.d.ts +0 -8
- package/x/parts/video-decoder.js +0 -20
- package/x/parts/video-decoder.js.map +0 -1
- package/x/parts/video-encoder.d.ts +0 -6
- package/x/parts/video-encoder.js +0 -12
- package/x/parts/video-encoder.js.map +0 -1
- package/x/tools/generate-id.d.ts +0 -1
- package/x/tools/generate-id.js +0 -8
- package/x/tools/generate-id.js.map +0 -1
- package/x/tools/mp4boxjs/demuxer.d.ts +0 -24
- package/x/tools/mp4boxjs/demuxer.js +0 -88
- package/x/tools/mp4boxjs/demuxer.js.map +0 -1
- package/x/tools/mp4boxjs/mp4box.adapter.d.ts +0 -128
- package/x/tools/mp4boxjs/mp4box.adapter.js +0 -11
- package/x/tools/mp4boxjs/mp4box.adapter.js.map +0 -1
- package/x/types.d.ts +0 -7
- package/x/types.js +0 -2
- package/x/types.js.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Machina } from "../parts/machina.js";
|
|
2
|
+
export declare const setupDriverHost: (machina: Machina) => import("@e280/comrade").SetupHost<{
|
|
3
|
+
work: {
|
|
4
|
+
hello(): Promise<void>;
|
|
5
|
+
decode(input: {
|
|
6
|
+
source: import("./schematic.js").DecoderSource;
|
|
7
|
+
video: WritableStream<VideoFrame>;
|
|
8
|
+
audio: WritableStream<AudioData>;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
encode(input: import("./schematic.js").EncoderInput & {
|
|
11
|
+
bridge: WritableStream<StreamTargetChunk>;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
composite(input: import("./schematic.js").Composition): Promise<VideoFrame>;
|
|
14
|
+
};
|
|
15
|
+
host: {
|
|
16
|
+
world(): Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../../s/driver/fns/host.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AAIrC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAkB,CAAC,EAAC,IAAI,EAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAEpG,KAAK,CAAC,KAAK;QACV,OAAO,CAAC,KAAK,EAAE,CAAA;IAChB,CAAC;CACD,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AsSchematic } from "@e280/comrade";
|
|
2
|
+
import type { AudioEncodingConfig, StreamTargetChunk, VideoEncodingConfig } from "mediabunny";
|
|
3
|
+
export type DriverSchematic = AsSchematic<{
|
|
4
|
+
work: {
|
|
5
|
+
hello(): Promise<void>;
|
|
6
|
+
decode(input: {
|
|
7
|
+
source: DecoderSource;
|
|
8
|
+
video: WritableStream<VideoFrame>;
|
|
9
|
+
audio: WritableStream<AudioData>;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
encode(input: EncoderInput & {
|
|
12
|
+
bridge: WritableStream<StreamTargetChunk>;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
composite(input: Composition): Promise<VideoFrame>;
|
|
15
|
+
};
|
|
16
|
+
host: {
|
|
17
|
+
world(): Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
export interface EncoderInput {
|
|
21
|
+
readables: {
|
|
22
|
+
video: ReadableStream<VideoFrame>;
|
|
23
|
+
audio: ReadableStream<AudioData>;
|
|
24
|
+
};
|
|
25
|
+
config: {
|
|
26
|
+
video: VideoEncodingConfig;
|
|
27
|
+
audio: AudioEncodingConfig;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export type DecoderSource = FileSystemFileHandle | string;
|
|
31
|
+
export interface DecoderInput {
|
|
32
|
+
source: DecoderSource;
|
|
33
|
+
onFrame?: (frame: VideoFrame) => Promise<VideoFrame>;
|
|
34
|
+
}
|
|
35
|
+
export interface MuxOpts {
|
|
36
|
+
config: {
|
|
37
|
+
video: {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
};
|
|
41
|
+
audio?: {
|
|
42
|
+
codec: "opus" | "aac";
|
|
43
|
+
numberOfChannels: number;
|
|
44
|
+
sampleRate: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export type Composition = Layer | (Layer | Composition)[];
|
|
49
|
+
export type Transform = {
|
|
50
|
+
x?: number;
|
|
51
|
+
y?: number;
|
|
52
|
+
scale?: number;
|
|
53
|
+
opacity?: number;
|
|
54
|
+
anchor?: number;
|
|
55
|
+
};
|
|
56
|
+
export type TextLayer = {
|
|
57
|
+
kind: 'text';
|
|
58
|
+
content: string;
|
|
59
|
+
fontSize?: number;
|
|
60
|
+
color?: string;
|
|
61
|
+
} & Transform;
|
|
62
|
+
export type ImageLayer = {
|
|
63
|
+
kind: 'image';
|
|
64
|
+
frame: VideoFrame;
|
|
65
|
+
} & Transform;
|
|
66
|
+
export type Layer = TextLayer | ImageLayer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schematic.js","sourceRoot":"","sources":["../../../s/driver/fns/schematic.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Input } from "mediabunny";
|
|
2
|
+
import { Composition } from "./schematic.js";
|
|
3
|
+
export declare const setupDriverWork: import("@e280/comrade").SetupWork<{
|
|
4
|
+
work: {
|
|
5
|
+
hello(): Promise<void>;
|
|
6
|
+
decode(input: {
|
|
7
|
+
source: import("./schematic.js").DecoderSource;
|
|
8
|
+
video: WritableStream<VideoFrame>;
|
|
9
|
+
audio: WritableStream<AudioData>;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
encode(input: import("./schematic.js").EncoderInput & {
|
|
12
|
+
bridge: WritableStream<Input>;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
composite(input: Composition): Promise<VideoFrame>;
|
|
15
|
+
};
|
|
16
|
+
host: {
|
|
17
|
+
world(): Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { Comrade } from "@e280/comrade";
|
|
2
|
+
import { Input, ALL_FORMATS, VideoSampleSink, Output, Mp4OutputFormat, VideoSampleSource, VideoSample, AudioSampleSink, AudioSampleSource, AudioSample, StreamTarget, BlobSource, UrlSource } from "mediabunny";
|
|
3
|
+
import { autoDetectRenderer, Container, Sprite, Text, Texture, DOMAdapter, WebWorkerAdapter } from "pixi.js";
|
|
4
|
+
DOMAdapter.set(WebWorkerAdapter);
|
|
5
|
+
export const setupDriverWork = Comrade.work(({ host }, rig) => ({
|
|
6
|
+
async hello() {
|
|
7
|
+
await host.world();
|
|
8
|
+
},
|
|
9
|
+
async decode({ source, video, audio }) {
|
|
10
|
+
const loadSource = async () => {
|
|
11
|
+
if (source instanceof FileSystemFileHandle) {
|
|
12
|
+
const file = await source.getFile();
|
|
13
|
+
return new BlobSource(file);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return new UrlSource(source);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const input = new Input({
|
|
20
|
+
source: await loadSource(),
|
|
21
|
+
formats: ALL_FORMATS
|
|
22
|
+
});
|
|
23
|
+
const [videoTrack, audioTrack] = await Promise.all([
|
|
24
|
+
input.getPrimaryVideoTrack(),
|
|
25
|
+
input.getPrimaryAudioTrack()
|
|
26
|
+
]);
|
|
27
|
+
const videoDecodable = await videoTrack?.canDecode();
|
|
28
|
+
const audioDecodable = await audioTrack?.canDecode();
|
|
29
|
+
const videoWriter = video.getWriter();
|
|
30
|
+
const audioWriter = audio.getWriter();
|
|
31
|
+
await Promise.all([
|
|
32
|
+
(async () => {
|
|
33
|
+
if (videoDecodable && videoTrack) {
|
|
34
|
+
const sink = new VideoSampleSink(videoTrack);
|
|
35
|
+
for await (const sample of sink.samples()) {
|
|
36
|
+
const frame = sample.toVideoFrame();
|
|
37
|
+
await videoWriter.write(frame);
|
|
38
|
+
sample.close();
|
|
39
|
+
frame.close();
|
|
40
|
+
}
|
|
41
|
+
await videoWriter.close();
|
|
42
|
+
}
|
|
43
|
+
})(),
|
|
44
|
+
(async () => {
|
|
45
|
+
if (audioDecodable && audioTrack) {
|
|
46
|
+
const sink = new AudioSampleSink(audioTrack);
|
|
47
|
+
for await (const sample of sink.samples()) {
|
|
48
|
+
const frame = sample.toAudioData();
|
|
49
|
+
await audioWriter.write(frame);
|
|
50
|
+
sample.close();
|
|
51
|
+
frame.close();
|
|
52
|
+
}
|
|
53
|
+
await audioWriter.close();
|
|
54
|
+
}
|
|
55
|
+
})()
|
|
56
|
+
]);
|
|
57
|
+
},
|
|
58
|
+
async encode({ readables, config, bridge }) {
|
|
59
|
+
const output = new Output({
|
|
60
|
+
format: new Mp4OutputFormat(),
|
|
61
|
+
target: new StreamTarget(bridge, { chunked: true })
|
|
62
|
+
});
|
|
63
|
+
const videoSource = new VideoSampleSource(config.video);
|
|
64
|
+
output.addVideoTrack(videoSource);
|
|
65
|
+
// since AudioSample is not transferable it fails to transfer encoder bitrate config
|
|
66
|
+
// so it needs to be hardcoded not set through constants eg QUALITY_LOW
|
|
67
|
+
const audioSource = new AudioSampleSource(config.audio);
|
|
68
|
+
output.addAudioTrack(audioSource);
|
|
69
|
+
await output.start();
|
|
70
|
+
const videoReader = readables.video.getReader();
|
|
71
|
+
const audioReader = readables.audio.getReader();
|
|
72
|
+
await Promise.all([
|
|
73
|
+
(async () => {
|
|
74
|
+
while (true) {
|
|
75
|
+
const { done, value } = await videoReader.read();
|
|
76
|
+
if (done)
|
|
77
|
+
break;
|
|
78
|
+
const sample = new VideoSample(value);
|
|
79
|
+
await videoSource.add(sample);
|
|
80
|
+
sample.close();
|
|
81
|
+
}
|
|
82
|
+
})(),
|
|
83
|
+
(async () => {
|
|
84
|
+
while (true) {
|
|
85
|
+
const { done, value } = await audioReader.read();
|
|
86
|
+
if (done)
|
|
87
|
+
break;
|
|
88
|
+
const sample = new AudioSample(value);
|
|
89
|
+
await audioSource.add(sample);
|
|
90
|
+
sample.close();
|
|
91
|
+
value.close();
|
|
92
|
+
}
|
|
93
|
+
})()
|
|
94
|
+
]);
|
|
95
|
+
await output.finalize();
|
|
96
|
+
},
|
|
97
|
+
async composite(composition) {
|
|
98
|
+
const { stage, renderer } = await renderPIXI(1920, 1080);
|
|
99
|
+
stage.removeChildren();
|
|
100
|
+
const { baseFrame, disposables } = await renderLayer(composition, stage);
|
|
101
|
+
renderer.render(stage);
|
|
102
|
+
// make sure browser support webgl/webgpu otherwise it might take much longer to construct frame
|
|
103
|
+
// if its very slow on eg edge try chrome
|
|
104
|
+
const frame = new VideoFrame(renderer.canvas, {
|
|
105
|
+
timestamp: baseFrame?.timestamp,
|
|
106
|
+
duration: baseFrame?.duration ?? undefined,
|
|
107
|
+
});
|
|
108
|
+
baseFrame?.close();
|
|
109
|
+
renderer.clear();
|
|
110
|
+
for (const disposable of disposables) {
|
|
111
|
+
disposable.destroy(true);
|
|
112
|
+
}
|
|
113
|
+
rig.transfer = [frame];
|
|
114
|
+
return frame;
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
let pixi = null;
|
|
118
|
+
async function renderPIXI(width, height) {
|
|
119
|
+
if (pixi)
|
|
120
|
+
return pixi;
|
|
121
|
+
const renderer = await autoDetectRenderer({
|
|
122
|
+
width,
|
|
123
|
+
height,
|
|
124
|
+
preference: "webgl", // webgl and webgl2 causes memory leaks on chrome
|
|
125
|
+
background: "black",
|
|
126
|
+
preferWebGLVersion: 2
|
|
127
|
+
});
|
|
128
|
+
const stage = new Container();
|
|
129
|
+
pixi = { renderer, stage };
|
|
130
|
+
return pixi;
|
|
131
|
+
}
|
|
132
|
+
async function renderLayer(layer, parent, disposables = []) {
|
|
133
|
+
if (Array.isArray(layer)) {
|
|
134
|
+
let baseFrame;
|
|
135
|
+
for (const child of layer) {
|
|
136
|
+
const result = await renderLayer(child, parent, disposables);
|
|
137
|
+
baseFrame ??= result.baseFrame;
|
|
138
|
+
}
|
|
139
|
+
return { baseFrame, disposables };
|
|
140
|
+
}
|
|
141
|
+
if (!isRenderableLayer(layer)) {
|
|
142
|
+
console.warn('Invalid layer', layer);
|
|
143
|
+
return { disposables };
|
|
144
|
+
}
|
|
145
|
+
switch (layer.kind) {
|
|
146
|
+
case 'text':
|
|
147
|
+
return renderTextLayer(layer, parent, disposables);
|
|
148
|
+
case 'image':
|
|
149
|
+
return renderImageLayer(layer, parent, disposables);
|
|
150
|
+
default:
|
|
151
|
+
console.warn('Unknown layer kind', layer.kind);
|
|
152
|
+
return { disposables };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function isRenderableLayer(layer) {
|
|
156
|
+
return !!layer && typeof layer === 'object' && typeof layer.kind === 'string';
|
|
157
|
+
}
|
|
158
|
+
function renderTextLayer(layer, parent, disposables) {
|
|
159
|
+
const text = new Text({
|
|
160
|
+
text: layer.content,
|
|
161
|
+
style: {
|
|
162
|
+
fontFamily: 'sans-serif',
|
|
163
|
+
fontSize: layer.fontSize ?? 48,
|
|
164
|
+
fill: layer.color ?? 'white'
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
applyTransform(text, layer);
|
|
168
|
+
parent.addChild(text);
|
|
169
|
+
disposables.push(text);
|
|
170
|
+
return { disposables };
|
|
171
|
+
}
|
|
172
|
+
function renderImageLayer(layer, parent, disposables) {
|
|
173
|
+
const texture = Texture.from(layer.frame);
|
|
174
|
+
const sprite = new Sprite(texture);
|
|
175
|
+
applyTransform(sprite, layer);
|
|
176
|
+
parent.addChild(sprite);
|
|
177
|
+
disposables.push(sprite, texture);
|
|
178
|
+
return { baseFrame: layer.frame, disposables };
|
|
179
|
+
}
|
|
180
|
+
function applyTransform(target, t = {}) {
|
|
181
|
+
if (t.x)
|
|
182
|
+
target.x = t.x;
|
|
183
|
+
if (t.y)
|
|
184
|
+
target.y = t.y;
|
|
185
|
+
if (t.scale)
|
|
186
|
+
target.scale.set(t.scale);
|
|
187
|
+
if (t.opacity)
|
|
188
|
+
target.alpha = t.opacity;
|
|
189
|
+
if (t.anchor && 'anchor' in target)
|
|
190
|
+
target.anchor.set(t.anchor);
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=work.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work.js","sourceRoot":"","sources":["../../../s/driver/fns/work.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AACrC,OAAO,EACN,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAC5F,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EA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,GAAG,CAAC,CAAC,CAAC,CAAA;IACtB,IAAG,CAAC,CAAC,KAAK;QAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACrC,IAAG,CAAC,CAAC,OAAO;QAAE,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,OAAO,CAAA;IACtC,IAAG,CAAC,CAAC,MAAM,IAAI,QAAQ,IAAI,MAAM;QAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// for later: https://github.com/gpac/mp4box.js/issues/243
|
|
2
|
+
export const encoderDefaultConfig = {
|
|
3
|
+
codec: "avc1.640034",
|
|
4
|
+
avc: { format: "annexb" },
|
|
5
|
+
width: 1280,
|
|
6
|
+
height: 720,
|
|
7
|
+
bitrate: 9_000_000, // 9 Mbps
|
|
8
|
+
framerate: 60,
|
|
9
|
+
bitrateMode: "variable",
|
|
10
|
+
hardwareAcceleration: "no-preference" // prefer-hardware seems like 2x slower from what i been testing
|
|
11
|
+
};
|
|
12
|
+
export const audioEncoderDefaultConfig = {
|
|
13
|
+
codec: "opus",
|
|
14
|
+
numberOfChannels: 2,
|
|
15
|
+
sampleRate: 44100
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../s/driver/parts/constants.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAuB;IACvD,KAAK,EAAE,aAAa;IACpB,GAAG,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC;IACvB,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,SAAS,EAAE,SAAS;IAC7B,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,UAAU;IACvB,oBAAoB,EAAE,eAAe,CAAC,gEAAgE;CACtG,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAuB;IAC5D,KAAK,EAAE,MAAM;IACb,gBAAgB,EAAE,CAAC;IACnB,UAAU,EAAE,KAAK;CACjB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WebMediaInfo } from "web-demuxer";
|
|
2
|
+
type Events = {
|
|
3
|
+
type: "config";
|
|
4
|
+
config: {
|
|
5
|
+
audio: AudioDecoderConfig;
|
|
6
|
+
video: VideoDecoderConfig;
|
|
7
|
+
};
|
|
8
|
+
} | {
|
|
9
|
+
type: "info";
|
|
10
|
+
data: WebMediaInfo;
|
|
11
|
+
} | {
|
|
12
|
+
type: "encoderQueueSize";
|
|
13
|
+
size: number;
|
|
14
|
+
};
|
|
15
|
+
type Handler = (event: Events) => void;
|
|
16
|
+
export declare class Machina {
|
|
17
|
+
#private;
|
|
18
|
+
count: number;
|
|
19
|
+
register(id: number, handler: Handler): void;
|
|
20
|
+
unregister(id: number): void;
|
|
21
|
+
dispatch(id: number, event: Events): void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class Machina {
|
|
2
|
+
count = 0;
|
|
3
|
+
#handlers = new Map();
|
|
4
|
+
register(id, handler) {
|
|
5
|
+
this.#handlers.set(id, handler);
|
|
6
|
+
}
|
|
7
|
+
unregister(id) {
|
|
8
|
+
this.#handlers.delete(id);
|
|
9
|
+
}
|
|
10
|
+
dispatch(id, event) {
|
|
11
|
+
this.#handlers.get(id)?.(event);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=machina.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machina.js","sourceRoot":"","sources":["../../../s/driver/parts/machina.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,OAAO;IACnB,KAAK,GAAG,CAAC,CAAA;IAET,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAA;IAEtC,QAAQ,CAAC,EAAU,EAAE,OAAgB;QACpC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC;IAED,UAAU,CAAC,EAAU;QACpB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED,QAAQ,CAAC,EAAU,EAAE,KAAa;QACjC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;CACD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BlobSource, UrlSource } from "mediabunny";
|
|
2
|
+
// only streamable sources
|
|
3
|
+
export async function loadDecoderSource(source) {
|
|
4
|
+
if (source instanceof FileSystemFileHandle) {
|
|
5
|
+
const file = await source.getFile();
|
|
6
|
+
return new BlobSource(file);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
return new UrlSource(source);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=load-decoder-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-decoder-source.js","sourceRoot":"","sources":["../../../s/driver/utils/load-decoder-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,YAAY,CAAA;AAGhD,0BAA0B;AAC1B,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAqB;IAC5D,IAAG,MAAM,YAAY,oBAAoB,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,CAAA;QACnC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;SAAM,CAAC;QACP,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sleep.js","sourceRoot":"","sources":["../../../s/driver/utils/sleep.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAC,EAAU;IAC/B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
package/x/index.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare class OmniTool {
|
|
4
|
-
#private;
|
|
5
|
-
videoDecoder: OmniVideoDecoder;
|
|
6
|
-
constructor(ffmpeg: any);
|
|
7
|
-
load(file: File): Promise<Clip>;
|
|
8
|
-
getFramesCount(): Promise<void>;
|
|
9
|
-
}
|
|
1
|
+
export * from "./driver/driver.js";
|
|
2
|
+
export * from "./timeline/index.js";
|
package/x/index.html
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
6
|
+
<meta name="darkreader-lock"/>
|
|
7
|
+
<title>omnitool</title>
|
|
8
|
+
<style>
|
|
9
|
+
@layer vars, basics, page;
|
|
10
|
+
|
|
11
|
+
@layer vars {
|
|
12
|
+
:root {
|
|
13
|
+
--link: cyan;
|
|
14
|
+
--color: #fffa;
|
|
15
|
+
--background: #111;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@layer basics {
|
|
20
|
+
* {
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@layer page {
|
|
28
|
+
html {
|
|
29
|
+
font-size: 10px;
|
|
30
|
+
color: var(--color);
|
|
31
|
+
background: var(--background);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
body {
|
|
35
|
+
padding: 2em;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.results {
|
|
39
|
+
margin-top: 1em;
|
|
40
|
+
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: 1em;
|
|
44
|
+
|
|
45
|
+
> div {
|
|
46
|
+
font-size: 1.5em;
|
|
47
|
+
border: 1px solid color-mix(in lch, transparent, var(--color) 20%);
|
|
48
|
+
padding: 1em;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
canvas {
|
|
52
|
+
width: 20em;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#filmstrip {
|
|
57
|
+
display: flex;
|
|
58
|
+
overflow-x: scroll;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
</style>
|
|
63
|
+
<script type=module src="demo/demo.bundle.min.js?v=c614bb3d17cc"></script>
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
<meta name="theme-color" content="#3cff9c">
|
|
67
|
+
<meta property="og:type" content="website">
|
|
68
|
+
<meta property="og:site_name" content="omnitool.omniclip.app">
|
|
69
|
+
<meta property="og:title" content="omnitool">
|
|
70
|
+
<meta property="og:description" content="video processing toolkit">
|
|
71
|
+
<meta property="og:image" content="https://omnitool.omniclip.app/assets/favicon.png">
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
76
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
77
|
+
<link href="https://fonts.googleapis.com/css2?family=Share+Tech&display=swap" rel="stylesheet">
|
|
78
|
+
|
|
79
|
+
</head>
|
|
80
|
+
<body>
|
|
81
|
+
|
|
82
|
+
<section>
|
|
83
|
+
<h1>Omnitool <small>v1.1.0-3</small></h1>
|
|
84
|
+
<button class=fetch>fetch</button>
|
|
85
|
+
<button class="import">import</button>
|
|
86
|
+
<div class=results></div>
|
|
87
|
+
<div class=filmstrip-demo>
|
|
88
|
+
<label for="viewable-range">viewable range:</label>
|
|
89
|
+
<input type="range" min="0" max="100" step="1" value="10" class="range" id="viewable-range" name="viewable-range">
|
|
90
|
+
<div class="range-view"></div>
|
|
91
|
+
<label for="range-size">viewable range size:</label>
|
|
92
|
+
<input type="range" class="range-size" min="0.1" max="10" step="0.1" value="0.5" id="range-size" name="range-size">
|
|
93
|
+
<label for="frequency">frequency:</label>
|
|
94
|
+
<input type="range" class="frequency" min="0.1" max="120" step="0.1" value="10" id="frequency" name="frequency">
|
|
95
|
+
<div class="frequency-view">10 (fps)</div>
|
|
96
|
+
<div id=filmstrip></div>
|
|
97
|
+
</div>
|
|
98
|
+
<div class=waveform-demo>
|
|
99
|
+
<label for="width">width:</label>
|
|
100
|
+
<input class="width" id="width" name="width" type="range" min="100" max="1000000" value="1000" />
|
|
101
|
+
</div>
|
|
102
|
+
</section>
|
|
103
|
+
|
|
104
|
+
</body>
|
|
105
|
+
</html>
|
package/x/index.html.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ssg, html } from "@e280/scute";
|
|
2
|
+
const title = "omnitool";
|
|
3
|
+
const domain = "omnitool.omniclip.app";
|
|
4
|
+
const favicon = "/assets/favicon.png";
|
|
5
|
+
export default ssg.page(import.meta.url, async (orb) => ({
|
|
6
|
+
title,
|
|
7
|
+
// favicon,
|
|
8
|
+
dark: true,
|
|
9
|
+
css: "demo/demo.css",
|
|
10
|
+
js: "demo/demo.bundle.min.js",
|
|
11
|
+
head: html `
|
|
12
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
13
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
14
|
+
<link href="https://fonts.googleapis.com/css2?family=Share+Tech&display=swap" rel="stylesheet">
|
|
15
|
+
`,
|
|
16
|
+
socialCard: {
|
|
17
|
+
title,
|
|
18
|
+
description: "video processing toolkit",
|
|
19
|
+
themeColor: "#3cff9c",
|
|
20
|
+
siteName: domain,
|
|
21
|
+
image: `https://${domain}${favicon}`,
|
|
22
|
+
},
|
|
23
|
+
body: html `
|
|
24
|
+
<section>
|
|
25
|
+
<h1>Omnitool <small>v${orb.packageVersion()}</small></h1>
|
|
26
|
+
<button class=fetch>fetch</button>
|
|
27
|
+
<button class="import">import</button>
|
|
28
|
+
<div class=results></div>
|
|
29
|
+
<div class=filmstrip-demo>
|
|
30
|
+
<label for="viewable-range">viewable range:</label>
|
|
31
|
+
<input type="range" min="0" max="100" step="1" value="10" class="range" id="viewable-range" name="viewable-range">
|
|
32
|
+
<div class="range-view"></div>
|
|
33
|
+
<label for="range-size">viewable range size:</label>
|
|
34
|
+
<input type="range" class="range-size" min="0.1" max="10" step="0.1" value="0.5" id="range-size" name="range-size">
|
|
35
|
+
<label for="frequency">frequency:</label>
|
|
36
|
+
<input type="range" class="frequency" min="0.1" max="120" step="0.1" value="10" id="frequency" name="frequency">
|
|
37
|
+
<div class="frequency-view">10 (fps)</div>
|
|
38
|
+
<div id=filmstrip></div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class=waveform-demo>
|
|
41
|
+
<label for="width">width:</label>
|
|
42
|
+
<input class="width" id="width" name="width" type="range" min="100" max="1000000" value="1000" />
|
|
43
|
+
</div>
|
|
44
|
+
</section>
|
|
45
|
+
`,
|
|
46
|
+
}));
|
|
47
|
+
//# sourceMappingURL=index.html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.html.js","sourceRoot":"","sources":["../s/index.html.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,aAAa,CAAA;AAErC,MAAM,KAAK,GAAG,UAAU,CAAA;AACxB,MAAM,MAAM,GAAG,uBAAuB,CAAA;AACtC,MAAM,OAAO,GAAG,qBAAqB,CAAA;AAErC,eAAe,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE,CAAC,CAAC;IACtD,KAAK;IACL,WAAW;IACX,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,eAAe;IACpB,EAAE,EAAE,yBAAyB;IAE7B,IAAI,EAAE,IAAI,CAAA;;;;EAIT;IAED,UAAU,EAAE;QACX,KAAK;QACL,WAAW,EAAE,0BAA0B;QACvC,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,WAAW,MAAM,GAAG,OAAO,EAAE;KACpC;IAED,IAAI,EAAE,IAAI,CAAA;;0BAEe,GAAG,CAAC,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;EAoB5C;CACD,CAAC,CAAC,CAAA"}
|
package/x/index.js
CHANGED
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { OmniVideoDecoder } from "./parts/video-decoder.js";
|
|
4
|
-
export class OmniTool {
|
|
5
|
-
#clips = new Map();
|
|
6
|
-
#getLoadedClip = (clip) => this.#clips.get(clip);
|
|
7
|
-
videoDecoder = new OmniVideoDecoder(this.#getLoadedClip);
|
|
8
|
-
// ffmpeg node or web version
|
|
9
|
-
constructor(ffmpeg) { }
|
|
10
|
-
load(file) {
|
|
11
|
-
return new Promise((resolve) => {
|
|
12
|
-
const demuxer = new MP4Demuxer(file, {
|
|
13
|
-
onChunk: () => { },
|
|
14
|
-
onConfig: () => { },
|
|
15
|
-
framesCount: () => { },
|
|
16
|
-
setStatus: () => { },
|
|
17
|
-
OnReady: () => {
|
|
18
|
-
const demuxed = { id: generateId(), demuxer };
|
|
19
|
-
this.#clips.set(demuxed, demuxed);
|
|
20
|
-
resolve(demuxed);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
async getFramesCount() { }
|
|
26
|
-
}
|
|
27
|
-
const tool = new OmniTool('ffmpeg');
|
|
28
|
-
// const file = tool.load()
|
|
29
|
-
// tool.videoDecoder.decode(file)
|
|
1
|
+
export * from "./driver/driver.js";
|
|
2
|
+
export * from "./timeline/index.js";
|
|
30
3
|
//# sourceMappingURL=index.js.map
|
package/x/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../s/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../s/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|