@aelionsdk/export 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/audio-export.d.ts +23 -0
- package/dist/audio-export.d.ts.map +1 -0
- package/dist/audio-export.js +120 -0
- package/dist/checkpoint.d.ts +58 -0
- package/dist/checkpoint.d.ts.map +1 -0
- package/dist/checkpoint.js +119 -0
- package/dist/image-export.d.ts +40 -0
- package/dist/image-export.d.ts.map +1 -0
- package/dist/image-export.js +235 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/memory-sink.d.ts +17 -0
- package/dist/memory-sink.d.ts.map +1 -0
- package/dist/memory-sink.js +60 -0
- package/dist/mux-export-worker.d.ts +2 -0
- package/dist/mux-export-worker.d.ts.map +1 -0
- package/dist/mux-export-worker.js +120 -0
- package/dist/opfs-sink.d.ts +20 -0
- package/dist/opfs-sink.d.ts.map +1 -0
- package/dist/opfs-sink.js +113 -0
- package/dist/profiles.d.ts +66 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +284 -0
- package/dist/remote-export.d.ts +56 -0
- package/dist/remote-export.d.ts.map +1 -0
- package/dist/remote-export.js +83 -0
- package/dist/resumable-muxed-export.d.ts +84 -0
- package/dist/resumable-muxed-export.d.ts.map +1 -0
- package/dist/resumable-muxed-export.js +533 -0
- package/dist/session.d.ts +47 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +483 -0
- package/dist/sink-completion.d.ts +8 -0
- package/dist/sink-completion.d.ts.map +1 -0
- package/dist/sink-completion.js +13 -0
- package/dist/webm-export.d.ts +97 -0
- package/dist/webm-export.d.ts.map +1 -0
- package/dist/webm-export.js +408 -0
- package/dist/worker-export.d.ts +25 -0
- package/dist/worker-export.d.ts.map +1 -0
- package/dist/worker-export.js +202 -0
- package/dist/worker-protocol.d.ts +66 -0
- package/dist/worker-protocol.d.ts.map +1 -0
- package/dist/worker-protocol.js +1 -0
- package/package.json +46 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './audio-export.js';
|
|
2
|
+
export * from './checkpoint.js';
|
|
3
|
+
export * from './image-export.js';
|
|
4
|
+
export * from './memory-sink.js';
|
|
5
|
+
export * from './opfs-sink.js';
|
|
6
|
+
export * from './profiles.js';
|
|
7
|
+
export * from './remote-export.js';
|
|
8
|
+
export * from './resumable-muxed-export.js';
|
|
9
|
+
export * from './session.js';
|
|
10
|
+
export * from './webm-export.js';
|
|
11
|
+
export * from './worker-export.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StreamTargetChunk } from 'mediabunny';
|
|
2
|
+
export interface MemorySinkSnapshot {
|
|
3
|
+
readonly writes: number;
|
|
4
|
+
readonly bytesWritten: number;
|
|
5
|
+
readonly finalSize: number;
|
|
6
|
+
readonly maxInFlightWrites: number;
|
|
7
|
+
readonly closed: boolean;
|
|
8
|
+
readonly aborted: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class SeekableMemorySink {
|
|
11
|
+
#private;
|
|
12
|
+
readonly writable: WritableStream<StreamTargetChunk>;
|
|
13
|
+
finalize(): Uint8Array;
|
|
14
|
+
cleanup(): void;
|
|
15
|
+
snapshot(): MemorySinkSnapshot;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=memory-sink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-sink.d.ts","sourceRoot":"","sources":["../src/memory-sink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,qBAAa,kBAAkB;;IAS7B,SAAgB,QAAQ,oCAuBrB;IAEI,QAAQ,IAAI,UAAU;IAWtB,OAAO,IAAI,IAAI;IAMf,QAAQ,IAAI,kBAAkB;CActC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export class SeekableMemorySink {
|
|
2
|
+
#chunks = [];
|
|
3
|
+
#writes = 0;
|
|
4
|
+
#bytesWritten = 0;
|
|
5
|
+
#inFlightWrites = 0;
|
|
6
|
+
#maxInFlightWrites = 0;
|
|
7
|
+
#closed = false;
|
|
8
|
+
#aborted = false;
|
|
9
|
+
writable = new WritableStream({
|
|
10
|
+
write: chunk => {
|
|
11
|
+
if (this.#closed)
|
|
12
|
+
throw new Error('SeekableMemorySink is closed');
|
|
13
|
+
this.#inFlightWrites += 1;
|
|
14
|
+
this.#maxInFlightWrites = Math.max(this.#maxInFlightWrites, this.#inFlightWrites);
|
|
15
|
+
try {
|
|
16
|
+
this.#chunks.push({
|
|
17
|
+
type: 'write',
|
|
18
|
+
data: chunk.data.slice(),
|
|
19
|
+
position: chunk.position,
|
|
20
|
+
});
|
|
21
|
+
this.#writes += 1;
|
|
22
|
+
this.#bytesWritten += chunk.data.byteLength;
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
this.#inFlightWrites -= 1;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
close: () => {
|
|
29
|
+
this.#closed = true;
|
|
30
|
+
},
|
|
31
|
+
abort: () => {
|
|
32
|
+
this.cleanup();
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
finalize() {
|
|
36
|
+
if (!this.#closed)
|
|
37
|
+
throw new Error('SeekableMemorySink is not finalized');
|
|
38
|
+
const finalSize = this.#chunks.reduce((size, chunk) => Math.max(size, chunk.position + chunk.data.byteLength), 0);
|
|
39
|
+
const result = new Uint8Array(finalSize);
|
|
40
|
+
for (const chunk of this.#chunks)
|
|
41
|
+
result.set(chunk.data, chunk.position);
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
cleanup() {
|
|
45
|
+
this.#closed = true;
|
|
46
|
+
this.#aborted = true;
|
|
47
|
+
this.#chunks.length = 0;
|
|
48
|
+
}
|
|
49
|
+
snapshot() {
|
|
50
|
+
const finalSize = this.#chunks.reduce((size, chunk) => Math.max(size, chunk.position + chunk.data.byteLength), 0);
|
|
51
|
+
return {
|
|
52
|
+
writes: this.#writes,
|
|
53
|
+
bytesWritten: this.#bytesWritten,
|
|
54
|
+
finalSize,
|
|
55
|
+
maxInFlightWrites: this.#maxInFlightWrites,
|
|
56
|
+
closed: this.#closed,
|
|
57
|
+
aborted: this.#aborted,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mux-export-worker.d.ts","sourceRoot":"","sources":["../src/mux-export-worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/// <reference lib="webworker" />
|
|
2
|
+
import { exportAv1Mp4, exportHevcMp4, exportMp4, exportWebM } from './webm-export.js';
|
|
3
|
+
const scope = self;
|
|
4
|
+
let controller;
|
|
5
|
+
let nextRequestId = 1;
|
|
6
|
+
const frames = new Map();
|
|
7
|
+
const audio = new Map();
|
|
8
|
+
function post(response, transfer = []) {
|
|
9
|
+
scope.postMessage(response, transfer);
|
|
10
|
+
}
|
|
11
|
+
function errorIdentity(error) {
|
|
12
|
+
const aborted = error instanceof DOMException && error.name === 'AbortError';
|
|
13
|
+
if (error !== null && typeof error === 'object') {
|
|
14
|
+
const diagnostics = Reflect.get(error, 'diagnostics');
|
|
15
|
+
if (Array.isArray(diagnostics)) {
|
|
16
|
+
const first = diagnostics[0];
|
|
17
|
+
if (first !== null && typeof first === 'object') {
|
|
18
|
+
const code = Reflect.get(first, 'code');
|
|
19
|
+
const message = Reflect.get(first, 'message');
|
|
20
|
+
if (typeof code === 'string' && typeof message === 'string')
|
|
21
|
+
return { code, message, aborted };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
code: aborted ? 'OPERATION_ABORTED' : 'EXPORT_WORKER_FAILED',
|
|
27
|
+
message: error instanceof Error ? error.message : 'Export Worker failed',
|
|
28
|
+
aborted,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function requestFrame(request) {
|
|
32
|
+
const id = nextRequestId++;
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
frames.set(id, { resolve, reject });
|
|
35
|
+
post({ type: 'render-frame', id, request });
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function requestAudio(request) {
|
|
39
|
+
const id = nextRequestId++;
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
audio.set(id, { resolve, reject });
|
|
42
|
+
post({ type: 'render-audio', id, request });
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function frameResponse(response) {
|
|
46
|
+
const pending = frames.get(response.id);
|
|
47
|
+
if (pending === undefined) {
|
|
48
|
+
response.frame?.close();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
frames.delete(response.id);
|
|
52
|
+
if (response.frame !== undefined)
|
|
53
|
+
pending.resolve(response.frame);
|
|
54
|
+
else
|
|
55
|
+
pending.reject(new Error(response.error ?? 'Frame rendering failed'));
|
|
56
|
+
}
|
|
57
|
+
function audioResponse(response) {
|
|
58
|
+
const pending = audio.get(response.id);
|
|
59
|
+
if (pending === undefined)
|
|
60
|
+
return;
|
|
61
|
+
audio.delete(response.id);
|
|
62
|
+
if (response.pcm !== undefined)
|
|
63
|
+
pending.resolve(response.pcm);
|
|
64
|
+
else
|
|
65
|
+
pending.reject(new Error(response.error ?? 'Audio rendering failed'));
|
|
66
|
+
}
|
|
67
|
+
async function start(request) {
|
|
68
|
+
if (controller !== undefined) {
|
|
69
|
+
post({
|
|
70
|
+
type: 'failed',
|
|
71
|
+
code: 'EXPORT_WORKER_BUSY',
|
|
72
|
+
message: 'Export Worker is busy',
|
|
73
|
+
aborted: false,
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
controller = new AbortController();
|
|
78
|
+
try {
|
|
79
|
+
const run = request.profile === 'mp4'
|
|
80
|
+
? exportMp4
|
|
81
|
+
: request.profile === 'mp4-av1'
|
|
82
|
+
? exportAv1Mp4
|
|
83
|
+
: request.profile === 'mp4-hevc'
|
|
84
|
+
? exportHevcMp4
|
|
85
|
+
: exportWebM;
|
|
86
|
+
const result = await run({
|
|
87
|
+
...request.config,
|
|
88
|
+
sink: request.sink,
|
|
89
|
+
signal: controller.signal,
|
|
90
|
+
renderFrame: requestFrame,
|
|
91
|
+
renderAudio: requestAudio,
|
|
92
|
+
onProgress: value => post({ type: 'progress', value }),
|
|
93
|
+
});
|
|
94
|
+
post({ type: 'completed', result });
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
post({ type: 'failed', ...errorIdentity(error) });
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
controller = undefined;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
scope.addEventListener('message', (event) => {
|
|
104
|
+
const request = event.data;
|
|
105
|
+
if (request.type === 'start')
|
|
106
|
+
void start(request);
|
|
107
|
+
else if (request.type === 'cancel') {
|
|
108
|
+
controller?.abort(new DOMException(request.reason, 'AbortError'));
|
|
109
|
+
for (const pending of frames.values())
|
|
110
|
+
pending.reject(new DOMException(request.reason, 'AbortError'));
|
|
111
|
+
for (const pending of audio.values())
|
|
112
|
+
pending.reject(new DOMException(request.reason, 'AbortError'));
|
|
113
|
+
frames.clear();
|
|
114
|
+
audio.clear();
|
|
115
|
+
}
|
|
116
|
+
else if (request.type === 'frame-response')
|
|
117
|
+
frameResponse(request);
|
|
118
|
+
else
|
|
119
|
+
audioResponse(request);
|
|
120
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StreamTargetChunk } from 'mediabunny';
|
|
2
|
+
export interface OpfsSinkSnapshot {
|
|
3
|
+
readonly fileName: string;
|
|
4
|
+
readonly writes: number;
|
|
5
|
+
readonly bytesWritten: number;
|
|
6
|
+
readonly maxInFlightWrites: number;
|
|
7
|
+
readonly closed: boolean;
|
|
8
|
+
readonly aborted: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class OpfsSeekableSink {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(fileName: string);
|
|
13
|
+
readonly writable: WritableStream<StreamTargetChunk>;
|
|
14
|
+
getFile(): Promise<File>;
|
|
15
|
+
/** Resolves only after the transferred WritableStream has closed on this host. */
|
|
16
|
+
waitUntilFinalized(): Promise<void>;
|
|
17
|
+
cleanup(): Promise<void>;
|
|
18
|
+
snapshot(): OpfsSinkSnapshot;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=opfs-sink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opfs-sink.d.ts","sourceRoot":"","sources":["../src/opfs-sink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,qBAAa,gBAAgB;;gBAcR,QAAQ,EAAE,MAAM;IAenC,SAAgB,QAAQ,oCAiCrB;IAEU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrC,kFAAkF;IACrE,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAUnC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAa9B,QAAQ,IAAI,gBAAgB;CAepC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export class OpfsSeekableSink {
|
|
2
|
+
#fileName;
|
|
3
|
+
#handlePromise;
|
|
4
|
+
#streamPromise;
|
|
5
|
+
#writes = 0;
|
|
6
|
+
#bytesWritten = 0;
|
|
7
|
+
#inFlightWrites = 0;
|
|
8
|
+
#maxInFlightWrites = 0;
|
|
9
|
+
#closed = false;
|
|
10
|
+
#aborted = false;
|
|
11
|
+
#finalizationError;
|
|
12
|
+
#finalized;
|
|
13
|
+
#resolveFinalized;
|
|
14
|
+
constructor(fileName) {
|
|
15
|
+
if (fileName.length === 0 || fileName.includes('/')) {
|
|
16
|
+
throw new TypeError('OPFS fileName must be a non-empty leaf name');
|
|
17
|
+
}
|
|
18
|
+
this.#fileName = fileName;
|
|
19
|
+
let resolveFinalized = () => undefined;
|
|
20
|
+
this.#finalized = new Promise(resolve => {
|
|
21
|
+
resolveFinalized = resolve;
|
|
22
|
+
});
|
|
23
|
+
this.#resolveFinalized = resolveFinalized;
|
|
24
|
+
this.#handlePromise = navigator.storage
|
|
25
|
+
.getDirectory()
|
|
26
|
+
.then(directory => directory.getFileHandle(fileName, { create: true }));
|
|
27
|
+
}
|
|
28
|
+
writable = new WritableStream({
|
|
29
|
+
write: async (chunk) => {
|
|
30
|
+
if (this.#closed || this.#aborted)
|
|
31
|
+
throw new Error('OPFS sink is not writable');
|
|
32
|
+
this.#inFlightWrites += 1;
|
|
33
|
+
this.#maxInFlightWrites = Math.max(this.#maxInFlightWrites, this.#inFlightWrites);
|
|
34
|
+
try {
|
|
35
|
+
const stream = await this.#stream();
|
|
36
|
+
await stream.write({
|
|
37
|
+
type: 'write',
|
|
38
|
+
position: chunk.position,
|
|
39
|
+
data: chunk.data,
|
|
40
|
+
});
|
|
41
|
+
this.#writes += 1;
|
|
42
|
+
this.#bytesWritten += chunk.data.byteLength;
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
this.#inFlightWrites -= 1;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
close: async () => {
|
|
49
|
+
if (this.#closed || this.#aborted)
|
|
50
|
+
return;
|
|
51
|
+
try {
|
|
52
|
+
await (await this.#stream()).close();
|
|
53
|
+
this.#closed = true;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
this.#finalizationError = error;
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
this.#resolveFinalized();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
abort: async () => {
|
|
64
|
+
await this.cleanup();
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
async getFile() {
|
|
68
|
+
await this.waitUntilFinalized();
|
|
69
|
+
return (await this.#handlePromise).getFile();
|
|
70
|
+
}
|
|
71
|
+
/** Resolves only after the transferred WritableStream has closed on this host. */
|
|
72
|
+
async waitUntilFinalized() {
|
|
73
|
+
await this.#finalized;
|
|
74
|
+
if (this.#finalizationError !== undefined) {
|
|
75
|
+
if (this.#finalizationError instanceof Error)
|
|
76
|
+
throw this.#finalizationError;
|
|
77
|
+
throw new Error('OPFS sink finalization failed', { cause: this.#finalizationError });
|
|
78
|
+
}
|
|
79
|
+
if (this.#aborted)
|
|
80
|
+
throw new DOMException('OPFS sink was aborted', 'AbortError');
|
|
81
|
+
if (!this.#closed)
|
|
82
|
+
throw new Error('OPFS sink did not finalize');
|
|
83
|
+
}
|
|
84
|
+
async cleanup() {
|
|
85
|
+
if (this.#aborted)
|
|
86
|
+
return;
|
|
87
|
+
this.#aborted = true;
|
|
88
|
+
try {
|
|
89
|
+
const stream = await this.#streamPromise;
|
|
90
|
+
if (stream !== undefined)
|
|
91
|
+
await stream.abort().catch(() => undefined);
|
|
92
|
+
const root = await navigator.storage.getDirectory();
|
|
93
|
+
await root.removeEntry(this.#fileName).catch(() => undefined);
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
this.#resolveFinalized();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
snapshot() {
|
|
100
|
+
return {
|
|
101
|
+
fileName: this.#fileName,
|
|
102
|
+
writes: this.#writes,
|
|
103
|
+
bytesWritten: this.#bytesWritten,
|
|
104
|
+
maxInFlightWrites: this.#maxInFlightWrites,
|
|
105
|
+
closed: this.#closed,
|
|
106
|
+
aborted: this.#aborted,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
#stream() {
|
|
110
|
+
this.#streamPromise ??= this.#handlePromise.then(handle => handle.createWritable());
|
|
111
|
+
return this.#streamPromise;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type ExportProfileId = 'webm-vp9-opus' | 'mp4-h264-aac' | 'mp4-av1-aac' | 'mp4-hevc-aac' | 'still-png' | 'still-jpeg' | 'still-webp' | 'animated-gif' | 'audio-wav';
|
|
2
|
+
export interface ExportProfile {
|
|
3
|
+
readonly id: ExportProfileId;
|
|
4
|
+
readonly kind: 'muxed-av' | 'still' | 'animated-image' | 'audio-only';
|
|
5
|
+
readonly mimeType: string;
|
|
6
|
+
readonly extension: string;
|
|
7
|
+
readonly videoCodec?: string;
|
|
8
|
+
readonly audioCodec?: string;
|
|
9
|
+
readonly resumability: 'restart-local' | 'checkpointed-units' | 'provider';
|
|
10
|
+
}
|
|
11
|
+
export declare const EXPORT_PROFILES: Readonly<Record<ExportProfileId, ExportProfile>>;
|
|
12
|
+
export interface ExportProfileSupport {
|
|
13
|
+
readonly profile: ExportProfile;
|
|
14
|
+
readonly supported: boolean;
|
|
15
|
+
readonly reasons: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
export interface ExportCapabilityProbeOptions {
|
|
18
|
+
readonly width?: number;
|
|
19
|
+
readonly height?: number;
|
|
20
|
+
readonly framerate?: number;
|
|
21
|
+
readonly sampleRate?: number;
|
|
22
|
+
readonly numberOfChannels?: number;
|
|
23
|
+
readonly videoBitrate?: number;
|
|
24
|
+
readonly audioBitrate?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns AVC codec strings from the smallest level that can represent the
|
|
28
|
+
* requested macroblock rate through progressively more permissive levels.
|
|
29
|
+
* Each level tries High, Main and Baseline profiles because platform encoders
|
|
30
|
+
* commonly expose only a subset even when they support the same dimensions.
|
|
31
|
+
*/
|
|
32
|
+
export declare function avcCodecCandidates(width: number, height: number, framerate: number): readonly string[];
|
|
33
|
+
export declare function preferredAvcCodecString(width: number, height: number, framerate: number): string;
|
|
34
|
+
export declare function avcEncoderConfig(codec: string, width: number, height: number, framerate: number, bitrate: number): VideoEncoderConfig;
|
|
35
|
+
/** Main-profile AV1 level chosen conservatively for HD or UHD output. */
|
|
36
|
+
export declare function av1CodecString(width: number, height: number, framerate: number): string;
|
|
37
|
+
/** Main-tier HEVC level chosen conservatively for HD or UHD output. */
|
|
38
|
+
export declare function hevcCodecString(width: number, height: number, framerate: number): string;
|
|
39
|
+
export declare function negotiatedVideoCodecString(profile: Pick<ExportProfile, 'id' | 'videoCodec'>, width: number, height: number, framerate: number): string;
|
|
40
|
+
export interface AvcNegotiationResult {
|
|
41
|
+
readonly selected?: string;
|
|
42
|
+
readonly attempts: readonly {
|
|
43
|
+
readonly codec: string;
|
|
44
|
+
readonly supported: boolean;
|
|
45
|
+
readonly error?: string;
|
|
46
|
+
}[];
|
|
47
|
+
}
|
|
48
|
+
export declare function negotiateAvcCodecString(options: {
|
|
49
|
+
readonly width: number;
|
|
50
|
+
readonly height: number;
|
|
51
|
+
readonly framerate: number;
|
|
52
|
+
readonly bitrate: number;
|
|
53
|
+
}): Promise<AvcNegotiationResult>;
|
|
54
|
+
export declare function probeExportProfiles(options?: ExportCapabilityProbeOptions): Promise<readonly ExportProfileSupport[]>;
|
|
55
|
+
export interface SelectExportProfileOptions extends ExportCapabilityProbeOptions {
|
|
56
|
+
readonly preferred: ExportProfileId;
|
|
57
|
+
readonly fallbacks?: readonly ExportProfileId[];
|
|
58
|
+
readonly remoteAvailable?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface ExportProfileSelection {
|
|
61
|
+
readonly selected?: ExportProfile;
|
|
62
|
+
readonly execution: 'local' | 'remote' | 'unsupported';
|
|
63
|
+
readonly attempts: readonly ExportProfileSupport[];
|
|
64
|
+
}
|
|
65
|
+
export declare function selectExportProfile(options: SelectExportProfileOptions): Promise<ExportProfileSelection>;
|
|
66
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GACvB,eAAe,GACf,cAAc,GACd,aAAa,GACb,cAAc,GACd,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,WAAW,CAAC;AAEhB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,eAAe,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,gBAAgB,GAAG,YAAY,CAAC;IACtE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,eAAe,GAAG,oBAAoB,GAAG,UAAU,CAAC;CAC5E;AAED,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,aAAa,CAAC,CAwE3E,CAAC;AAEH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,E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