@kenzuya/mediabunny 1.26.0 → 1.28.6
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 +1 -1
- package/dist/bundles/{mediabunny.mjs → mediabunny.js} +21963 -21390
- package/dist/bundles/mediabunny.min.js +490 -0
- package/dist/modules/shared/mp3-misc.d.ts.map +1 -1
- package/dist/modules/src/adts/adts-demuxer.d.ts +6 -6
- package/dist/modules/src/adts/adts-demuxer.d.ts.map +1 -1
- package/dist/modules/src/adts/adts-muxer.d.ts +4 -4
- package/dist/modules/src/adts/adts-muxer.d.ts.map +1 -1
- package/dist/modules/src/adts/adts-reader.d.ts +1 -1
- package/dist/modules/src/adts/adts-reader.d.ts.map +1 -1
- package/dist/modules/src/avi/avi-demuxer.d.ts +44 -0
- package/dist/modules/src/avi/avi-demuxer.d.ts.map +1 -0
- package/dist/modules/src/avi/avi-misc.d.ts +88 -0
- package/dist/modules/src/avi/avi-misc.d.ts.map +1 -0
- package/dist/modules/src/avi/avi-muxer.d.ts +45 -0
- package/dist/modules/src/avi/avi-muxer.d.ts.map +1 -0
- package/dist/modules/src/avi/riff-writer.d.ts +26 -0
- package/dist/modules/src/avi/riff-writer.d.ts.map +1 -0
- package/dist/modules/src/codec-data.d.ts +8 -3
- package/dist/modules/src/codec-data.d.ts.map +1 -1
- package/dist/modules/src/codec.d.ts +10 -10
- package/dist/modules/src/codec.d.ts.map +1 -1
- package/dist/modules/src/conversion.d.ts +33 -16
- package/dist/modules/src/conversion.d.ts.map +1 -1
- package/dist/modules/src/custom-coder.d.ts +8 -8
- package/dist/modules/src/custom-coder.d.ts.map +1 -1
- package/dist/modules/src/demuxer.d.ts +3 -3
- package/dist/modules/src/demuxer.d.ts.map +1 -1
- package/dist/modules/src/encode.d.ts +8 -8
- package/dist/modules/src/encode.d.ts.map +1 -1
- package/dist/modules/src/flac/flac-demuxer.d.ts +7 -7
- package/dist/modules/src/flac/flac-demuxer.d.ts.map +1 -1
- package/dist/modules/src/flac/flac-misc.d.ts +3 -3
- package/dist/modules/src/flac/flac-misc.d.ts.map +1 -1
- package/dist/modules/src/flac/flac-muxer.d.ts +5 -5
- package/dist/modules/src/flac/flac-muxer.d.ts.map +1 -1
- package/dist/modules/src/id3.d.ts +3 -3
- package/dist/modules/src/id3.d.ts.map +1 -1
- package/dist/modules/src/index.d.ts +20 -20
- package/dist/modules/src/index.d.ts.map +1 -1
- package/dist/modules/src/input-format.d.ts +22 -0
- package/dist/modules/src/input-format.d.ts.map +1 -1
- package/dist/modules/src/input-track.d.ts +8 -8
- package/dist/modules/src/input-track.d.ts.map +1 -1
- package/dist/modules/src/input.d.ts +12 -12
- package/dist/modules/src/isobmff/isobmff-boxes.d.ts +2 -2
- package/dist/modules/src/isobmff/isobmff-boxes.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts +12 -12
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-misc.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-muxer.d.ts +11 -11
- package/dist/modules/src/isobmff/isobmff-muxer.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-reader.d.ts +2 -2
- package/dist/modules/src/isobmff/isobmff-reader.d.ts.map +1 -1
- package/dist/modules/src/matroska/ebml.d.ts +3 -3
- package/dist/modules/src/matroska/ebml.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-demuxer.d.ts +13 -13
- package/dist/modules/src/matroska/matroska-demuxer.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-input.d.ts +33 -0
- package/dist/modules/src/matroska/matroska-input.d.ts.map +1 -0
- package/dist/modules/src/matroska/matroska-misc.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-muxer.d.ts +5 -5
- package/dist/modules/src/matroska/matroska-muxer.d.ts.map +1 -1
- package/dist/modules/src/media-sink.d.ts +5 -5
- package/dist/modules/src/media-sink.d.ts.map +1 -1
- package/dist/modules/src/media-source.d.ts +22 -4
- package/dist/modules/src/media-source.d.ts.map +1 -1
- package/dist/modules/src/metadata.d.ts +2 -2
- package/dist/modules/src/metadata.d.ts.map +1 -1
- package/dist/modules/src/misc.d.ts +5 -4
- package/dist/modules/src/misc.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-demuxer.d.ts +7 -7
- package/dist/modules/src/mp3/mp3-demuxer.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-muxer.d.ts +4 -4
- package/dist/modules/src/mp3/mp3-muxer.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-reader.d.ts +2 -2
- package/dist/modules/src/mp3/mp3-reader.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-writer.d.ts +1 -1
- package/dist/modules/src/mp3/mp3-writer.d.ts.map +1 -1
- package/dist/modules/src/muxer.d.ts +4 -4
- package/dist/modules/src/muxer.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-demuxer.d.ts +7 -7
- package/dist/modules/src/ogg/ogg-demuxer.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-misc.d.ts +1 -1
- package/dist/modules/src/ogg/ogg-misc.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-muxer.d.ts +5 -5
- package/dist/modules/src/ogg/ogg-muxer.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-reader.d.ts +1 -1
- package/dist/modules/src/ogg/ogg-reader.d.ts.map +1 -1
- package/dist/modules/src/output-format.d.ts +51 -6
- package/dist/modules/src/output-format.d.ts.map +1 -1
- package/dist/modules/src/output.d.ts +13 -13
- package/dist/modules/src/output.d.ts.map +1 -1
- package/dist/modules/src/packet.d.ts +1 -1
- package/dist/modules/src/packet.d.ts.map +1 -1
- package/dist/modules/src/pcm.d.ts.map +1 -1
- package/dist/modules/src/reader.d.ts +2 -2
- package/dist/modules/src/reader.d.ts.map +1 -1
- package/dist/modules/src/sample.d.ts +57 -15
- package/dist/modules/src/sample.d.ts.map +1 -1
- package/dist/modules/src/source.d.ts +3 -3
- package/dist/modules/src/source.d.ts.map +1 -1
- package/dist/modules/src/subtitles.d.ts +1 -1
- package/dist/modules/src/subtitles.d.ts.map +1 -1
- package/dist/modules/src/target.d.ts +2 -2
- package/dist/modules/src/target.d.ts.map +1 -1
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/dist/modules/src/wave/riff-writer.d.ts +1 -1
- package/dist/modules/src/wave/riff-writer.d.ts.map +1 -1
- package/dist/modules/src/wave/wave-demuxer.d.ts +6 -6
- package/dist/modules/src/wave/wave-demuxer.d.ts.map +1 -1
- package/dist/modules/src/wave/wave-muxer.d.ts +4 -4
- package/dist/modules/src/wave/wave-muxer.d.ts.map +1 -1
- package/dist/modules/src/writer.d.ts +1 -1
- package/dist/modules/src/writer.d.ts.map +1 -1
- package/dist/packages/eac3/eac3.wasm +0 -0
- package/dist/packages/eac3/mediabunny-eac3.js +1058 -0
- package/dist/packages/eac3/mediabunny-eac3.min.js +44 -0
- package/dist/packages/mp3-encoder/mediabunny-mp3-encoder.js +694 -0
- package/dist/packages/mp3-encoder/mediabunny-mp3-encoder.min.js +58 -0
- package/dist/packages/mpeg4/mediabunny-mpeg4.js +1198 -0
- package/dist/packages/mpeg4/mediabunny-mpeg4.min.js +44 -0
- package/dist/packages/mpeg4/xvid.wasm +0 -0
- package/package.json +18 -57
- package/dist/bundles/mediabunny.cjs +0 -26140
- package/dist/bundles/mediabunny.min.cjs +0 -147
- package/dist/bundles/mediabunny.min.mjs +0 -146
- package/dist/mediabunny.d.ts +0 -3319
- package/dist/modules/shared/mp3-misc.js +0 -147
- package/dist/modules/src/adts/adts-demuxer.js +0 -239
- package/dist/modules/src/adts/adts-muxer.js +0 -80
- package/dist/modules/src/adts/adts-reader.js +0 -63
- package/dist/modules/src/codec-data.js +0 -1730
- package/dist/modules/src/codec.js +0 -869
- package/dist/modules/src/conversion.js +0 -1459
- package/dist/modules/src/custom-coder.js +0 -117
- package/dist/modules/src/demuxer.js +0 -12
- package/dist/modules/src/encode.js +0 -442
- package/dist/modules/src/flac/flac-demuxer.js +0 -504
- package/dist/modules/src/flac/flac-misc.js +0 -135
- package/dist/modules/src/flac/flac-muxer.js +0 -222
- package/dist/modules/src/id3.js +0 -848
- package/dist/modules/src/index.js +0 -28
- package/dist/modules/src/input-format.js +0 -480
- package/dist/modules/src/input-track.js +0 -372
- package/dist/modules/src/input.js +0 -188
- package/dist/modules/src/isobmff/isobmff-boxes.js +0 -1480
- package/dist/modules/src/isobmff/isobmff-demuxer.js +0 -2618
- package/dist/modules/src/isobmff/isobmff-misc.js +0 -20
- package/dist/modules/src/isobmff/isobmff-muxer.js +0 -966
- package/dist/modules/src/isobmff/isobmff-reader.js +0 -72
- package/dist/modules/src/matroska/ebml.js +0 -653
- package/dist/modules/src/matroska/matroska-demuxer.js +0 -2133
- package/dist/modules/src/matroska/matroska-misc.js +0 -20
- package/dist/modules/src/matroska/matroska-muxer.js +0 -1017
- package/dist/modules/src/media-sink.js +0 -1736
- package/dist/modules/src/media-source.js +0 -1825
- package/dist/modules/src/metadata.js +0 -193
- package/dist/modules/src/misc.js +0 -623
- package/dist/modules/src/mp3/mp3-demuxer.js +0 -285
- package/dist/modules/src/mp3/mp3-muxer.js +0 -123
- package/dist/modules/src/mp3/mp3-reader.js +0 -26
- package/dist/modules/src/mp3/mp3-writer.js +0 -78
- package/dist/modules/src/muxer.js +0 -50
- package/dist/modules/src/node.d.ts +0 -9
- package/dist/modules/src/node.d.ts.map +0 -1
- package/dist/modules/src/node.js +0 -9
- package/dist/modules/src/ogg/ogg-demuxer.js +0 -763
- package/dist/modules/src/ogg/ogg-misc.js +0 -78
- package/dist/modules/src/ogg/ogg-muxer.js +0 -353
- package/dist/modules/src/ogg/ogg-reader.js +0 -65
- package/dist/modules/src/output-format.js +0 -527
- package/dist/modules/src/output.js +0 -300
- package/dist/modules/src/packet.js +0 -182
- package/dist/modules/src/pcm.js +0 -85
- package/dist/modules/src/reader.js +0 -236
- package/dist/modules/src/sample.js +0 -1056
- package/dist/modules/src/source.js +0 -1182
- package/dist/modules/src/subtitles.js +0 -575
- package/dist/modules/src/target.js +0 -140
- package/dist/modules/src/wave/riff-writer.js +0 -30
- package/dist/modules/src/wave/wave-demuxer.js +0 -447
- package/dist/modules/src/wave/wave-muxer.js +0 -318
- package/dist/modules/src/writer.js +0 -370
- package/src/adts/adts-demuxer.ts +0 -331
- package/src/adts/adts-muxer.ts +0 -111
- package/src/adts/adts-reader.ts +0 -85
- package/src/codec-data.ts +0 -2078
- package/src/codec.ts +0 -1092
- package/src/conversion.ts +0 -2112
- package/src/custom-coder.ts +0 -197
- package/src/demuxer.ts +0 -24
- package/src/encode.ts +0 -739
- package/src/flac/flac-demuxer.ts +0 -730
- package/src/flac/flac-misc.ts +0 -164
- package/src/flac/flac-muxer.ts +0 -320
- package/src/id3.ts +0 -925
- package/src/index.ts +0 -221
- package/src/input-format.ts +0 -541
- package/src/input-track.ts +0 -529
- package/src/input.ts +0 -235
- package/src/isobmff/isobmff-boxes.ts +0 -1719
- package/src/isobmff/isobmff-demuxer.ts +0 -3190
- package/src/isobmff/isobmff-misc.ts +0 -29
- package/src/isobmff/isobmff-muxer.ts +0 -1348
- package/src/isobmff/isobmff-reader.ts +0 -91
- package/src/matroska/ebml.ts +0 -730
- package/src/matroska/matroska-demuxer.ts +0 -2481
- package/src/matroska/matroska-misc.ts +0 -29
- package/src/matroska/matroska-muxer.ts +0 -1276
- package/src/media-sink.ts +0 -2179
- package/src/media-source.ts +0 -2243
- package/src/metadata.ts +0 -320
- package/src/misc.ts +0 -798
- package/src/mp3/mp3-demuxer.ts +0 -383
- package/src/mp3/mp3-muxer.ts +0 -166
- package/src/mp3/mp3-reader.ts +0 -34
- package/src/mp3/mp3-writer.ts +0 -120
- package/src/muxer.ts +0 -88
- package/src/node.ts +0 -11
- package/src/ogg/ogg-demuxer.ts +0 -1053
- package/src/ogg/ogg-misc.ts +0 -116
- package/src/ogg/ogg-muxer.ts +0 -497
- package/src/ogg/ogg-reader.ts +0 -93
- package/src/output-format.ts +0 -945
- package/src/output.ts +0 -488
- package/src/packet.ts +0 -263
- package/src/pcm.ts +0 -112
- package/src/reader.ts +0 -323
- package/src/sample.ts +0 -1461
- package/src/source.ts +0 -1688
- package/src/subtitles.ts +0 -711
- package/src/target.ts +0 -204
- package/src/tsconfig.json +0 -16
- package/src/wave/riff-writer.ts +0 -36
- package/src/wave/wave-demuxer.ts +0 -529
- package/src/wave/wave-muxer.ts +0 -371
- package/src/writer.ts +0 -490
|
@@ -1,527 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2025-present, Vanilagy and contributors
|
|
3
|
-
*
|
|
4
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
|
-
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
7
|
-
*/
|
|
8
|
-
import { AdtsMuxer } from './adts/adts-muxer.js';
|
|
9
|
-
import { AUDIO_CODECS, NON_PCM_AUDIO_CODECS, PCM_AUDIO_CODECS, SUBTITLE_CODECS, VIDEO_CODECS, } from './codec.js';
|
|
10
|
-
import { FlacMuxer } from './flac/flac-muxer.js';
|
|
11
|
-
import { IsobmffMuxer } from './isobmff/isobmff-muxer.js';
|
|
12
|
-
import { MatroskaMuxer } from './matroska/matroska-muxer.js';
|
|
13
|
-
import { Mp3Muxer } from './mp3/mp3-muxer.js';
|
|
14
|
-
import { OggMuxer } from './ogg/ogg-muxer.js';
|
|
15
|
-
import { WaveMuxer } from './wave/wave-muxer.js';
|
|
16
|
-
/**
|
|
17
|
-
* Base class representing an output media file format.
|
|
18
|
-
* @group Output formats
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export class OutputFormat {
|
|
22
|
-
/** Returns a list of video codecs that this output format can contain. */
|
|
23
|
-
getSupportedVideoCodecs() {
|
|
24
|
-
return this.getSupportedCodecs()
|
|
25
|
-
.filter(codec => VIDEO_CODECS.includes(codec));
|
|
26
|
-
}
|
|
27
|
-
/** Returns a list of audio codecs that this output format can contain. */
|
|
28
|
-
getSupportedAudioCodecs() {
|
|
29
|
-
return this.getSupportedCodecs()
|
|
30
|
-
.filter(codec => AUDIO_CODECS.includes(codec));
|
|
31
|
-
}
|
|
32
|
-
/** Returns a list of subtitle codecs that this output format can contain. */
|
|
33
|
-
getSupportedSubtitleCodecs() {
|
|
34
|
-
return this.getSupportedCodecs()
|
|
35
|
-
.filter(codec => SUBTITLE_CODECS.includes(codec));
|
|
36
|
-
}
|
|
37
|
-
/** @internal */
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39
|
-
_codecUnsupportedHint(codec) {
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Format representing files compatible with the ISO base media file format (ISOBMFF), like MP4 or MOV files.
|
|
45
|
-
* @group Output formats
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
48
|
-
export class IsobmffOutputFormat extends OutputFormat {
|
|
49
|
-
/** Internal constructor. */
|
|
50
|
-
constructor(options = {}) {
|
|
51
|
-
if (!options || typeof options !== 'object') {
|
|
52
|
-
throw new TypeError('options must be an object.');
|
|
53
|
-
}
|
|
54
|
-
if (options.fastStart !== undefined
|
|
55
|
-
&& ![false, 'in-memory', 'reserve', 'fragmented'].includes(options.fastStart)) {
|
|
56
|
-
throw new TypeError('options.fastStart, when provided, must be false, \'in-memory\', \'reserve\', or \'fragmented\'.');
|
|
57
|
-
}
|
|
58
|
-
if (options.minimumFragmentDuration !== undefined
|
|
59
|
-
&& (!Number.isFinite(options.minimumFragmentDuration) || options.minimumFragmentDuration < 0)) {
|
|
60
|
-
throw new TypeError('options.minimumFragmentDuration, when provided, must be a non-negative number.');
|
|
61
|
-
}
|
|
62
|
-
if (options.onFtyp !== undefined && typeof options.onFtyp !== 'function') {
|
|
63
|
-
throw new TypeError('options.onFtyp, when provided, must be a function.');
|
|
64
|
-
}
|
|
65
|
-
if (options.onMoov !== undefined && typeof options.onMoov !== 'function') {
|
|
66
|
-
throw new TypeError('options.onMoov, when provided, must be a function.');
|
|
67
|
-
}
|
|
68
|
-
if (options.onMdat !== undefined && typeof options.onMdat !== 'function') {
|
|
69
|
-
throw new TypeError('options.onMdat, when provided, must be a function.');
|
|
70
|
-
}
|
|
71
|
-
if (options.onMoof !== undefined && typeof options.onMoof !== 'function') {
|
|
72
|
-
throw new TypeError('options.onMoof, when provided, must be a function.');
|
|
73
|
-
}
|
|
74
|
-
if (options.metadataFormat !== undefined
|
|
75
|
-
&& !['mdir', 'mdta', 'udta', 'auto'].includes(options.metadataFormat)) {
|
|
76
|
-
throw new TypeError('options.metadataFormat, when provided, must be either \'auto\', \'mdir\', \'mdta\', or \'udta\'.');
|
|
77
|
-
}
|
|
78
|
-
super();
|
|
79
|
-
this._options = options;
|
|
80
|
-
}
|
|
81
|
-
getSupportedTrackCounts() {
|
|
82
|
-
return {
|
|
83
|
-
video: { min: 0, max: Infinity },
|
|
84
|
-
audio: { min: 0, max: Infinity },
|
|
85
|
-
subtitle: { min: 0, max: Infinity },
|
|
86
|
-
total: { min: 1, max: 2 ** 32 - 1 }, // Have fun reaching this one
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
get supportsVideoRotationMetadata() {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
/** @internal */
|
|
93
|
-
_createMuxer(output) {
|
|
94
|
-
return new IsobmffMuxer(output, this);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* MPEG-4 Part 14 (MP4) file format. Supports most codecs.
|
|
99
|
-
* @group Output formats
|
|
100
|
-
* @public
|
|
101
|
-
*/
|
|
102
|
-
export class Mp4OutputFormat extends IsobmffOutputFormat {
|
|
103
|
-
/** Creates a new {@link Mp4OutputFormat} configured with the specified `options`. */
|
|
104
|
-
constructor(options) {
|
|
105
|
-
super(options);
|
|
106
|
-
}
|
|
107
|
-
/** @internal */
|
|
108
|
-
get _name() {
|
|
109
|
-
return 'MP4';
|
|
110
|
-
}
|
|
111
|
-
get fileExtension() {
|
|
112
|
-
return '.mp4';
|
|
113
|
-
}
|
|
114
|
-
get mimeType() {
|
|
115
|
-
return 'video/mp4';
|
|
116
|
-
}
|
|
117
|
-
getSupportedCodecs() {
|
|
118
|
-
return [
|
|
119
|
-
...VIDEO_CODECS,
|
|
120
|
-
...NON_PCM_AUDIO_CODECS,
|
|
121
|
-
// These are supported via ISO/IEC 23003-5
|
|
122
|
-
'pcm-s16',
|
|
123
|
-
'pcm-s16be',
|
|
124
|
-
'pcm-s24',
|
|
125
|
-
'pcm-s24be',
|
|
126
|
-
'pcm-s32',
|
|
127
|
-
'pcm-s32be',
|
|
128
|
-
'pcm-f32',
|
|
129
|
-
'pcm-f32be',
|
|
130
|
-
'pcm-f64',
|
|
131
|
-
'pcm-f64be',
|
|
132
|
-
// Only WebVTT subtitles are supported in MP4
|
|
133
|
-
'webvtt',
|
|
134
|
-
];
|
|
135
|
-
}
|
|
136
|
-
/** @internal */
|
|
137
|
-
_codecUnsupportedHint(codec) {
|
|
138
|
-
if (new MovOutputFormat().getSupportedCodecs().includes(codec)) {
|
|
139
|
-
return ' Switching to MOV will grant support for this codec.';
|
|
140
|
-
}
|
|
141
|
-
return '';
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* QuickTime File Format (QTFF), often called MOV. Supports all video and audio codecs, but not subtitle codecs.
|
|
146
|
-
* @group Output formats
|
|
147
|
-
* @public
|
|
148
|
-
*/
|
|
149
|
-
export class MovOutputFormat extends IsobmffOutputFormat {
|
|
150
|
-
/** Creates a new {@link MovOutputFormat} configured with the specified `options`. */
|
|
151
|
-
constructor(options) {
|
|
152
|
-
super(options);
|
|
153
|
-
}
|
|
154
|
-
/** @internal */
|
|
155
|
-
get _name() {
|
|
156
|
-
return 'MOV';
|
|
157
|
-
}
|
|
158
|
-
get fileExtension() {
|
|
159
|
-
return '.mov';
|
|
160
|
-
}
|
|
161
|
-
get mimeType() {
|
|
162
|
-
return 'video/quicktime';
|
|
163
|
-
}
|
|
164
|
-
getSupportedCodecs() {
|
|
165
|
-
return [
|
|
166
|
-
...VIDEO_CODECS,
|
|
167
|
-
...AUDIO_CODECS,
|
|
168
|
-
// Only WebVTT subtitles are supported in MOV
|
|
169
|
-
'webvtt',
|
|
170
|
-
];
|
|
171
|
-
}
|
|
172
|
-
/** @internal */
|
|
173
|
-
_codecUnsupportedHint(codec) {
|
|
174
|
-
if (new Mp4OutputFormat().getSupportedCodecs().includes(codec)) {
|
|
175
|
-
return ' Switching to MP4 will grant support for this codec.';
|
|
176
|
-
}
|
|
177
|
-
return '';
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Matroska file format.
|
|
182
|
-
*
|
|
183
|
-
* Supports writing transparent video. For a video track to be marked as transparent, the first packet added must
|
|
184
|
-
* contain alpha side data.
|
|
185
|
-
*
|
|
186
|
-
* @group Output formats
|
|
187
|
-
* @public
|
|
188
|
-
*/
|
|
189
|
-
export class MkvOutputFormat extends OutputFormat {
|
|
190
|
-
/** Creates a new {@link MkvOutputFormat} configured with the specified `options`. */
|
|
191
|
-
constructor(options = {}) {
|
|
192
|
-
if (!options || typeof options !== 'object') {
|
|
193
|
-
throw new TypeError('options must be an object.');
|
|
194
|
-
}
|
|
195
|
-
if (options.appendOnly !== undefined && typeof options.appendOnly !== 'boolean') {
|
|
196
|
-
throw new TypeError('options.appendOnly, when provided, must be a boolean.');
|
|
197
|
-
}
|
|
198
|
-
if (options.minimumClusterDuration !== undefined
|
|
199
|
-
&& (!Number.isFinite(options.minimumClusterDuration) || options.minimumClusterDuration < 0)) {
|
|
200
|
-
throw new TypeError('options.minimumClusterDuration, when provided, must be a non-negative number.');
|
|
201
|
-
}
|
|
202
|
-
if (options.onEbmlHeader !== undefined && typeof options.onEbmlHeader !== 'function') {
|
|
203
|
-
throw new TypeError('options.onEbmlHeader, when provided, must be a function.');
|
|
204
|
-
}
|
|
205
|
-
if (options.onSegmentHeader !== undefined && typeof options.onSegmentHeader !== 'function') {
|
|
206
|
-
throw new TypeError('options.onHeader, when provided, must be a function.');
|
|
207
|
-
}
|
|
208
|
-
if (options.onCluster !== undefined && typeof options.onCluster !== 'function') {
|
|
209
|
-
throw new TypeError('options.onCluster, when provided, must be a function.');
|
|
210
|
-
}
|
|
211
|
-
super();
|
|
212
|
-
this._options = options;
|
|
213
|
-
}
|
|
214
|
-
/** @internal */
|
|
215
|
-
_createMuxer(output) {
|
|
216
|
-
return new MatroskaMuxer(output, this);
|
|
217
|
-
}
|
|
218
|
-
/** @internal */
|
|
219
|
-
get _name() {
|
|
220
|
-
return 'Matroska';
|
|
221
|
-
}
|
|
222
|
-
getSupportedTrackCounts() {
|
|
223
|
-
return {
|
|
224
|
-
video: { min: 0, max: Infinity },
|
|
225
|
-
audio: { min: 0, max: Infinity },
|
|
226
|
-
subtitle: { min: 0, max: Infinity },
|
|
227
|
-
total: { min: 1, max: 127 },
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
get fileExtension() {
|
|
231
|
-
return '.mkv';
|
|
232
|
-
}
|
|
233
|
-
get mimeType() {
|
|
234
|
-
return 'video/x-matroska';
|
|
235
|
-
}
|
|
236
|
-
getSupportedCodecs() {
|
|
237
|
-
return [
|
|
238
|
-
...VIDEO_CODECS,
|
|
239
|
-
...NON_PCM_AUDIO_CODECS,
|
|
240
|
-
...PCM_AUDIO_CODECS.filter(codec => !['pcm-s8', 'pcm-f32be', 'pcm-f64be', 'ulaw', 'alaw'].includes(codec)),
|
|
241
|
-
...SUBTITLE_CODECS,
|
|
242
|
-
];
|
|
243
|
-
}
|
|
244
|
-
get supportsVideoRotationMetadata() {
|
|
245
|
-
// While it technically does support it with ProjectionPoseRoll, many players appear to ignore this value
|
|
246
|
-
return false;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* WebM file format, based on Matroska.
|
|
251
|
-
*
|
|
252
|
-
* Supports writing transparent video. For a video track to be marked as transparent, the first packet added must
|
|
253
|
-
* contain alpha side data.
|
|
254
|
-
*
|
|
255
|
-
* @group Output formats
|
|
256
|
-
* @public
|
|
257
|
-
*/
|
|
258
|
-
export class WebMOutputFormat extends MkvOutputFormat {
|
|
259
|
-
/** Creates a new {@link WebMOutputFormat} configured with the specified `options`. */
|
|
260
|
-
constructor(options) {
|
|
261
|
-
super(options);
|
|
262
|
-
}
|
|
263
|
-
getSupportedCodecs() {
|
|
264
|
-
return [
|
|
265
|
-
...VIDEO_CODECS.filter(codec => ['vp8', 'vp9', 'av1'].includes(codec)),
|
|
266
|
-
...AUDIO_CODECS.filter(codec => ['opus', 'vorbis'].includes(codec)),
|
|
267
|
-
...SUBTITLE_CODECS,
|
|
268
|
-
];
|
|
269
|
-
}
|
|
270
|
-
/** @internal */
|
|
271
|
-
get _name() {
|
|
272
|
-
return 'WebM';
|
|
273
|
-
}
|
|
274
|
-
get fileExtension() {
|
|
275
|
-
return '.webm';
|
|
276
|
-
}
|
|
277
|
-
get mimeType() {
|
|
278
|
-
return 'video/webm';
|
|
279
|
-
}
|
|
280
|
-
/** @internal */
|
|
281
|
-
_codecUnsupportedHint(codec) {
|
|
282
|
-
if (new MkvOutputFormat().getSupportedCodecs().includes(codec)) {
|
|
283
|
-
return ' Switching to MKV will grant support for this codec.';
|
|
284
|
-
}
|
|
285
|
-
return '';
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* MP3 file format.
|
|
290
|
-
* @group Output formats
|
|
291
|
-
* @public
|
|
292
|
-
*/
|
|
293
|
-
export class Mp3OutputFormat extends OutputFormat {
|
|
294
|
-
/** Creates a new {@link Mp3OutputFormat} configured with the specified `options`. */
|
|
295
|
-
constructor(options = {}) {
|
|
296
|
-
if (!options || typeof options !== 'object') {
|
|
297
|
-
throw new TypeError('options must be an object.');
|
|
298
|
-
}
|
|
299
|
-
if (options.xingHeader !== undefined && typeof options.xingHeader !== 'boolean') {
|
|
300
|
-
throw new TypeError('options.xingHeader, when provided, must be a boolean.');
|
|
301
|
-
}
|
|
302
|
-
if (options.onXingFrame !== undefined && typeof options.onXingFrame !== 'function') {
|
|
303
|
-
throw new TypeError('options.onXingFrame, when provided, must be a function.');
|
|
304
|
-
}
|
|
305
|
-
super();
|
|
306
|
-
this._options = options;
|
|
307
|
-
}
|
|
308
|
-
/** @internal */
|
|
309
|
-
_createMuxer(output) {
|
|
310
|
-
return new Mp3Muxer(output, this);
|
|
311
|
-
}
|
|
312
|
-
/** @internal */
|
|
313
|
-
get _name() {
|
|
314
|
-
return 'MP3';
|
|
315
|
-
}
|
|
316
|
-
getSupportedTrackCounts() {
|
|
317
|
-
return {
|
|
318
|
-
video: { min: 0, max: 0 },
|
|
319
|
-
audio: { min: 1, max: 1 },
|
|
320
|
-
subtitle: { min: 0, max: 0 },
|
|
321
|
-
total: { min: 1, max: 1 },
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
get fileExtension() {
|
|
325
|
-
return '.mp3';
|
|
326
|
-
}
|
|
327
|
-
get mimeType() {
|
|
328
|
-
return 'audio/mpeg';
|
|
329
|
-
}
|
|
330
|
-
getSupportedCodecs() {
|
|
331
|
-
return ['mp3'];
|
|
332
|
-
}
|
|
333
|
-
get supportsVideoRotationMetadata() {
|
|
334
|
-
return false;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* WAVE file format, based on RIFF.
|
|
339
|
-
* @group Output formats
|
|
340
|
-
* @public
|
|
341
|
-
*/
|
|
342
|
-
export class WavOutputFormat extends OutputFormat {
|
|
343
|
-
/** Creates a new {@link WavOutputFormat} configured with the specified `options`. */
|
|
344
|
-
constructor(options = {}) {
|
|
345
|
-
if (!options || typeof options !== 'object') {
|
|
346
|
-
throw new TypeError('options must be an object.');
|
|
347
|
-
}
|
|
348
|
-
if (options.large !== undefined && typeof options.large !== 'boolean') {
|
|
349
|
-
throw new TypeError('options.large, when provided, must be a boolean.');
|
|
350
|
-
}
|
|
351
|
-
if (options.metadataFormat !== undefined && !['info', 'id3'].includes(options.metadataFormat)) {
|
|
352
|
-
throw new TypeError('options.metadataFormat, when provided, must be either \'info\' or \'id3\'.');
|
|
353
|
-
}
|
|
354
|
-
if (options.onHeader !== undefined && typeof options.onHeader !== 'function') {
|
|
355
|
-
throw new TypeError('options.onHeader, when provided, must be a function.');
|
|
356
|
-
}
|
|
357
|
-
super();
|
|
358
|
-
this._options = options;
|
|
359
|
-
}
|
|
360
|
-
/** @internal */
|
|
361
|
-
_createMuxer(output) {
|
|
362
|
-
return new WaveMuxer(output, this);
|
|
363
|
-
}
|
|
364
|
-
/** @internal */
|
|
365
|
-
get _name() {
|
|
366
|
-
return 'WAVE';
|
|
367
|
-
}
|
|
368
|
-
getSupportedTrackCounts() {
|
|
369
|
-
return {
|
|
370
|
-
video: { min: 0, max: 0 },
|
|
371
|
-
audio: { min: 1, max: 1 },
|
|
372
|
-
subtitle: { min: 0, max: 0 },
|
|
373
|
-
total: { min: 1, max: 1 },
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
get fileExtension() {
|
|
377
|
-
return '.wav';
|
|
378
|
-
}
|
|
379
|
-
get mimeType() {
|
|
380
|
-
return 'audio/wav';
|
|
381
|
-
}
|
|
382
|
-
getSupportedCodecs() {
|
|
383
|
-
return [
|
|
384
|
-
...PCM_AUDIO_CODECS.filter(codec => ['pcm-s16', 'pcm-s24', 'pcm-s32', 'pcm-f32', 'pcm-u8', 'ulaw', 'alaw'].includes(codec)),
|
|
385
|
-
];
|
|
386
|
-
}
|
|
387
|
-
get supportsVideoRotationMetadata() {
|
|
388
|
-
return false;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Ogg file format.
|
|
393
|
-
* @group Output formats
|
|
394
|
-
* @public
|
|
395
|
-
*/
|
|
396
|
-
export class OggOutputFormat extends OutputFormat {
|
|
397
|
-
/** Creates a new {@link OggOutputFormat} configured with the specified `options`. */
|
|
398
|
-
constructor(options = {}) {
|
|
399
|
-
if (!options || typeof options !== 'object') {
|
|
400
|
-
throw new TypeError('options must be an object.');
|
|
401
|
-
}
|
|
402
|
-
if (options.onPage !== undefined && typeof options.onPage !== 'function') {
|
|
403
|
-
throw new TypeError('options.onPage, when provided, must be a function.');
|
|
404
|
-
}
|
|
405
|
-
super();
|
|
406
|
-
this._options = options;
|
|
407
|
-
}
|
|
408
|
-
/** @internal */
|
|
409
|
-
_createMuxer(output) {
|
|
410
|
-
return new OggMuxer(output, this);
|
|
411
|
-
}
|
|
412
|
-
/** @internal */
|
|
413
|
-
get _name() {
|
|
414
|
-
return 'Ogg';
|
|
415
|
-
}
|
|
416
|
-
getSupportedTrackCounts() {
|
|
417
|
-
return {
|
|
418
|
-
video: { min: 0, max: 0 },
|
|
419
|
-
audio: { min: 0, max: Infinity },
|
|
420
|
-
subtitle: { min: 0, max: 0 },
|
|
421
|
-
total: { min: 1, max: 2 ** 32 },
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
get fileExtension() {
|
|
425
|
-
return '.ogg';
|
|
426
|
-
}
|
|
427
|
-
get mimeType() {
|
|
428
|
-
return 'application/ogg';
|
|
429
|
-
}
|
|
430
|
-
getSupportedCodecs() {
|
|
431
|
-
return [
|
|
432
|
-
...AUDIO_CODECS.filter(codec => ['vorbis', 'opus'].includes(codec)),
|
|
433
|
-
];
|
|
434
|
-
}
|
|
435
|
-
get supportsVideoRotationMetadata() {
|
|
436
|
-
return false;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* ADTS file format.
|
|
441
|
-
* @group Output formats
|
|
442
|
-
* @public
|
|
443
|
-
*/
|
|
444
|
-
export class AdtsOutputFormat extends OutputFormat {
|
|
445
|
-
/** Creates a new {@link AdtsOutputFormat} configured with the specified `options`. */
|
|
446
|
-
constructor(options = {}) {
|
|
447
|
-
if (!options || typeof options !== 'object') {
|
|
448
|
-
throw new TypeError('options must be an object.');
|
|
449
|
-
}
|
|
450
|
-
if (options.onFrame !== undefined && typeof options.onFrame !== 'function') {
|
|
451
|
-
throw new TypeError('options.onFrame, when provided, must be a function.');
|
|
452
|
-
}
|
|
453
|
-
super();
|
|
454
|
-
this._options = options;
|
|
455
|
-
}
|
|
456
|
-
/** @internal */
|
|
457
|
-
_createMuxer(output) {
|
|
458
|
-
return new AdtsMuxer(output, this);
|
|
459
|
-
}
|
|
460
|
-
/** @internal */
|
|
461
|
-
get _name() {
|
|
462
|
-
return 'ADTS';
|
|
463
|
-
}
|
|
464
|
-
getSupportedTrackCounts() {
|
|
465
|
-
return {
|
|
466
|
-
video: { min: 0, max: 0 },
|
|
467
|
-
audio: { min: 1, max: 1 },
|
|
468
|
-
subtitle: { min: 0, max: 0 },
|
|
469
|
-
total: { min: 1, max: 1 },
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
get fileExtension() {
|
|
473
|
-
return '.aac';
|
|
474
|
-
}
|
|
475
|
-
get mimeType() {
|
|
476
|
-
return 'audio/aac';
|
|
477
|
-
}
|
|
478
|
-
getSupportedCodecs() {
|
|
479
|
-
return ['aac'];
|
|
480
|
-
}
|
|
481
|
-
get supportsVideoRotationMetadata() {
|
|
482
|
-
return false;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* FLAC file format.
|
|
487
|
-
* @group Output formats
|
|
488
|
-
* @public
|
|
489
|
-
*/
|
|
490
|
-
export class FlacOutputFormat extends OutputFormat {
|
|
491
|
-
/** Creates a new {@link FlacOutputFormat} configured with the specified `options`. */
|
|
492
|
-
constructor(options = {}) {
|
|
493
|
-
if (!options || typeof options !== 'object') {
|
|
494
|
-
throw new TypeError('options must be an object.');
|
|
495
|
-
}
|
|
496
|
-
super();
|
|
497
|
-
this._options = options;
|
|
498
|
-
}
|
|
499
|
-
/** @internal */
|
|
500
|
-
_createMuxer(output) {
|
|
501
|
-
return new FlacMuxer(output, this);
|
|
502
|
-
}
|
|
503
|
-
/** @internal */
|
|
504
|
-
get _name() {
|
|
505
|
-
return 'FLAC';
|
|
506
|
-
}
|
|
507
|
-
getSupportedTrackCounts() {
|
|
508
|
-
return {
|
|
509
|
-
video: { min: 0, max: 0 },
|
|
510
|
-
audio: { min: 1, max: 1 },
|
|
511
|
-
subtitle: { min: 0, max: 0 },
|
|
512
|
-
total: { min: 1, max: 1 },
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
get fileExtension() {
|
|
516
|
-
return '.flac';
|
|
517
|
-
}
|
|
518
|
-
get mimeType() {
|
|
519
|
-
return 'audio/flac';
|
|
520
|
-
}
|
|
521
|
-
getSupportedCodecs() {
|
|
522
|
-
return ['flac'];
|
|
523
|
-
}
|
|
524
|
-
get supportsVideoRotationMetadata() {
|
|
525
|
-
return false;
|
|
526
|
-
}
|
|
527
|
-
}
|