mediabunny 1.0.2 → 1.0.4

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.
Files changed (188) hide show
  1. package/README.md +4 -4
  2. package/dist/mediabunny.d.ts +4 -2
  3. package/dist/modules/codec-data.d.ts +95 -0
  4. package/dist/modules/codec-data.d.ts.map +1 -0
  5. package/dist/modules/codec-data.js +1103 -0
  6. package/dist/modules/codec.d.ts +250 -0
  7. package/dist/modules/codec.d.ts.map +1 -0
  8. package/dist/modules/codec.js +1100 -0
  9. package/dist/modules/conversion.d.ts +158 -0
  10. package/dist/modules/conversion.d.ts.map +1 -0
  11. package/dist/modules/conversion.js +866 -0
  12. package/dist/modules/custom-coder.d.ts +119 -0
  13. package/dist/modules/custom-coder.d.ts.map +1 -0
  14. package/dist/modules/custom-coder.js +91 -0
  15. package/dist/modules/demuxer.d.ts +17 -0
  16. package/dist/modules/demuxer.d.ts.map +1 -0
  17. package/dist/modules/demuxer.js +12 -0
  18. package/dist/modules/index.d.ts +25 -0
  19. package/dist/modules/index.d.ts.map +1 -0
  20. package/dist/modules/index.js +24 -0
  21. package/dist/modules/input-format.d.ts +121 -0
  22. package/dist/modules/input-format.d.ts.map +1 -0
  23. package/dist/modules/input-format.js +333 -0
  24. package/dist/modules/input-track.d.ts +138 -0
  25. package/dist/modules/input-track.d.ts.map +1 -0
  26. package/dist/modules/input-track.js +230 -0
  27. package/dist/modules/input.d.ts +55 -0
  28. package/dist/modules/input.d.ts.map +1 -0
  29. package/dist/modules/input.js +104 -0
  30. package/dist/modules/isobmff/isobmff-boxes.d.ts +202 -0
  31. package/dist/modules/isobmff/isobmff-boxes.d.ts.map +1 -0
  32. package/dist/modules/isobmff/isobmff-boxes.js +1111 -0
  33. package/dist/modules/isobmff/isobmff-demuxer.d.ts +163 -0
  34. package/dist/modules/isobmff/isobmff-demuxer.d.ts.map +1 -0
  35. package/dist/modules/isobmff/isobmff-demuxer.js +2080 -0
  36. package/dist/modules/isobmff/isobmff-misc.d.ts +14 -0
  37. package/dist/modules/isobmff/isobmff-misc.d.ts.map +1 -0
  38. package/dist/modules/isobmff/isobmff-misc.js +20 -0
  39. package/dist/modules/isobmff/isobmff-muxer.d.ts +142 -0
  40. package/dist/modules/isobmff/isobmff-muxer.d.ts.map +1 -0
  41. package/dist/modules/isobmff/isobmff-muxer.js +858 -0
  42. package/dist/modules/isobmff/isobmff-reader.d.ts +36 -0
  43. package/dist/modules/isobmff/isobmff-reader.d.ts.map +1 -0
  44. package/dist/modules/isobmff/isobmff-reader.js +105 -0
  45. package/dist/modules/matroska/ebml.d.ts +156 -0
  46. package/dist/modules/matroska/ebml.d.ts.map +1 -0
  47. package/dist/modules/matroska/ebml.js +529 -0
  48. package/dist/modules/matroska/matroska-demuxer.d.ts +119 -0
  49. package/dist/modules/matroska/matroska-demuxer.d.ts.map +1 -0
  50. package/dist/modules/matroska/matroska-demuxer.js +1330 -0
  51. package/dist/modules/matroska/matroska-misc.d.ts +14 -0
  52. package/dist/modules/matroska/matroska-misc.d.ts.map +1 -0
  53. package/dist/modules/matroska/matroska-misc.js +20 -0
  54. package/dist/modules/matroska/matroska-muxer.d.ts +71 -0
  55. package/dist/modules/matroska/matroska-muxer.d.ts.map +1 -0
  56. package/dist/modules/matroska/matroska-muxer.js +729 -0
  57. package/dist/modules/media-sink.d.ts +272 -0
  58. package/dist/modules/media-sink.d.ts.map +1 -0
  59. package/dist/modules/media-sink.js +1264 -0
  60. package/dist/modules/media-source.d.ts +230 -0
  61. package/dist/modules/media-source.d.ts.map +1 -0
  62. package/dist/modules/media-source.js +1095 -0
  63. package/dist/modules/misc.d.ts +127 -0
  64. package/dist/modules/misc.d.ts.map +1 -0
  65. package/dist/modules/misc.js +462 -0
  66. package/dist/modules/mp3/mp3-demuxer.d.ts +32 -0
  67. package/dist/modules/mp3/mp3-demuxer.d.ts.map +1 -0
  68. package/dist/modules/mp3/mp3-demuxer.js +160 -0
  69. package/dist/modules/mp3/mp3-misc.d.ts +37 -0
  70. package/dist/modules/mp3/mp3-misc.d.ts.map +1 -0
  71. package/dist/modules/mp3/mp3-misc.js +122 -0
  72. package/dist/modules/mp3/mp3-muxer.d.ts +27 -0
  73. package/dist/modules/mp3/mp3-muxer.d.ts.map +1 -0
  74. package/dist/modules/mp3/mp3-muxer.js +112 -0
  75. package/dist/modules/mp3/mp3-reader.d.ts +25 -0
  76. package/dist/modules/mp3/mp3-reader.d.ts.map +1 -0
  77. package/dist/modules/mp3/mp3-reader.js +73 -0
  78. package/dist/modules/mp3/mp3-writer.d.ts +30 -0
  79. package/dist/modules/mp3/mp3-writer.d.ts.map +1 -0
  80. package/dist/modules/mp3/mp3-writer.js +72 -0
  81. package/dist/modules/muxer.d.ts +32 -0
  82. package/dist/modules/muxer.d.ts.map +1 -0
  83. package/dist/modules/muxer.js +50 -0
  84. package/dist/modules/ogg/ogg-demuxer.d.ts +53 -0
  85. package/dist/modules/ogg/ogg-demuxer.d.ts.map +1 -0
  86. package/dist/modules/ogg/ogg-demuxer.js +701 -0
  87. package/dist/modules/ogg/ogg-misc.d.ts +27 -0
  88. package/dist/modules/ogg/ogg-misc.d.ts.map +1 -0
  89. package/dist/modules/ogg/ogg-misc.js +78 -0
  90. package/dist/modules/ogg/ogg-muxer.d.ts +58 -0
  91. package/dist/modules/ogg/ogg-muxer.d.ts.map +1 -0
  92. package/dist/modules/ogg/ogg-muxer.js +345 -0
  93. package/dist/modules/ogg/ogg-reader.d.ts +37 -0
  94. package/dist/modules/ogg/ogg-reader.d.ts.map +1 -0
  95. package/dist/modules/ogg/ogg-reader.js +104 -0
  96. package/dist/modules/output-format.d.ts +285 -0
  97. package/dist/modules/output-format.d.ts.map +1 -0
  98. package/dist/modules/output-format.js +385 -0
  99. package/dist/modules/output.d.ts +134 -0
  100. package/dist/modules/output.d.ts.map +1 -0
  101. package/dist/modules/output.js +269 -0
  102. package/dist/modules/packet.d.ts +86 -0
  103. package/dist/modules/packet.d.ts.map +1 -0
  104. package/dist/modules/packet.js +133 -0
  105. package/dist/modules/pcm.d.ts +12 -0
  106. package/dist/modules/pcm.d.ts.map +1 -0
  107. package/dist/modules/pcm.js +85 -0
  108. package/dist/modules/reader.d.ts +40 -0
  109. package/dist/modules/reader.d.ts.map +1 -0
  110. package/dist/modules/reader.js +153 -0
  111. package/dist/modules/sample.d.ts +186 -0
  112. package/dist/modules/sample.d.ts.map +1 -0
  113. package/dist/modules/sample.js +798 -0
  114. package/dist/modules/source.d.ts +76 -0
  115. package/dist/modules/source.d.ts.map +1 -0
  116. package/dist/modules/source.js +183 -0
  117. package/dist/modules/subtitles.d.ts +37 -0
  118. package/dist/modules/subtitles.d.ts.map +1 -0
  119. package/dist/modules/subtitles.js +89 -0
  120. package/dist/modules/target.d.ts +58 -0
  121. package/dist/modules/target.d.ts.map +1 -0
  122. package/dist/modules/target.js +63 -0
  123. package/dist/modules/wave/riff-reader.d.ts +19 -0
  124. package/dist/modules/wave/riff-reader.d.ts.map +1 -0
  125. package/dist/modules/wave/riff-reader.js +38 -0
  126. package/dist/modules/wave/riff-writer.d.ts +18 -0
  127. package/dist/modules/wave/riff-writer.d.ts.map +1 -0
  128. package/dist/modules/wave/riff-writer.js +25 -0
  129. package/dist/modules/wave/wave-demuxer.d.ts +42 -0
  130. package/dist/modules/wave/wave-demuxer.d.ts.map +1 -0
  131. package/dist/modules/wave/wave-demuxer.js +239 -0
  132. package/dist/modules/wave/wave-muxer.d.ts +27 -0
  133. package/dist/modules/wave/wave-muxer.d.ts.map +1 -0
  134. package/dist/modules/wave/wave-muxer.js +108 -0
  135. package/dist/modules/writer.d.ts +85 -0
  136. package/dist/modules/writer.d.ts.map +1 -0
  137. package/dist/modules/writer.js +347 -0
  138. package/package.json +14 -10
  139. package/src/codec-data.ts +1394 -0
  140. package/src/codec.ts +1392 -0
  141. package/src/conversion.ts +1199 -0
  142. package/src/custom-coder.ts +162 -0
  143. package/src/demuxer.ts +22 -0
  144. package/src/index.ts +148 -0
  145. package/src/input-format.ts +386 -0
  146. package/src/input-track.ts +341 -0
  147. package/src/input.ts +138 -0
  148. package/src/isobmff/isobmff-boxes.ts +1365 -0
  149. package/src/isobmff/isobmff-demuxer.ts +2646 -0
  150. package/src/isobmff/isobmff-misc.ts +29 -0
  151. package/src/isobmff/isobmff-muxer.ts +1210 -0
  152. package/src/isobmff/isobmff-reader.ts +137 -0
  153. package/src/matroska/ebml.ts +595 -0
  154. package/src/matroska/matroska-demuxer.ts +1677 -0
  155. package/src/matroska/matroska-misc.ts +29 -0
  156. package/src/matroska/matroska-muxer.ts +999 -0
  157. package/src/media-sink.ts +1577 -0
  158. package/src/media-source.ts +1406 -0
  159. package/src/misc.ts +584 -0
  160. package/src/mp3/mp3-demuxer.ts +228 -0
  161. package/src/mp3/mp3-misc.ts +154 -0
  162. package/src/mp3/mp3-muxer.ts +153 -0
  163. package/src/mp3/mp3-reader.ts +93 -0
  164. package/src/mp3/mp3-writer.ts +112 -0
  165. package/src/muxer.ts +88 -0
  166. package/src/ogg/ogg-demuxer.ts +985 -0
  167. package/src/ogg/ogg-misc.ts +116 -0
  168. package/src/ogg/ogg-muxer.ts +480 -0
  169. package/src/ogg/ogg-reader.ts +143 -0
  170. package/src/output-format.ts +689 -0
  171. package/src/output.ts +427 -0
  172. package/src/packet.ts +180 -0
  173. package/src/pcm.ts +112 -0
  174. package/src/reader.ts +205 -0
  175. package/src/sample.ts +1029 -0
  176. package/src/source.ts +279 -0
  177. package/src/subtitles.ts +131 -0
  178. package/src/target.ts +106 -0
  179. package/src/tsconfig.json +13 -0
  180. package/src/wave/riff-reader.ts +48 -0
  181. package/src/wave/riff-writer.ts +30 -0
  182. package/src/wave/wave-demuxer.ts +317 -0
  183. package/src/wave/wave-muxer.ts +145 -0
  184. package/src/writer.ts +461 -0
  185. /package/dist/{mediabunny.js → bundles/mediabunny.cjs} +0 -0
  186. /package/dist/{mediabunny.min.js → bundles/mediabunny.min.cjs} +0 -0
  187. /package/dist/{mediabunny.min.mjs → bundles/mediabunny.min.mjs} +0 -0
  188. /package/dist/{mediabunny.mjs → bundles/mediabunny.mjs} +0 -0
@@ -0,0 +1,134 @@
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 { Rotation } from './misc';
9
+ import { OutputFormat } from './output-format';
10
+ import { AudioSource, SubtitleSource, VideoSource } from './media-source';
11
+ import { Target } from './target';
12
+ /**
13
+ * The options for creating an Output object.
14
+ * @public
15
+ */
16
+ export type OutputOptions<F extends OutputFormat = OutputFormat, T extends Target = Target> = {
17
+ /** The format of the output file. */
18
+ format: F;
19
+ /** The target to which the file will be written. */
20
+ target: T;
21
+ };
22
+ /**
23
+ * List of all track types.
24
+ * @public
25
+ */
26
+ export declare const ALL_TRACK_TYPES: readonly ["video", "audio", "subtitle"];
27
+ /**
28
+ * Union type of all track types.
29
+ * @public
30
+ */
31
+ export type TrackType = typeof ALL_TRACK_TYPES[number];
32
+ export type OutputTrack = {
33
+ id: number;
34
+ output: Output;
35
+ type: TrackType;
36
+ } & ({
37
+ type: 'video';
38
+ source: VideoSource;
39
+ metadata: VideoTrackMetadata;
40
+ } | {
41
+ type: 'audio';
42
+ source: AudioSource;
43
+ metadata: AudioTrackMetadata;
44
+ } | {
45
+ type: 'subtitle';
46
+ source: SubtitleSource;
47
+ metadata: SubtitleTrackMetadata;
48
+ });
49
+ export type OutputVideoTrack = OutputTrack & {
50
+ type: 'video';
51
+ };
52
+ export type OutputAudioTrack = OutputTrack & {
53
+ type: 'audio';
54
+ };
55
+ export type OutputSubtitleTrack = OutputTrack & {
56
+ type: 'subtitle';
57
+ };
58
+ /**
59
+ * Base track metadata, applicable to all tracks.
60
+ * @public
61
+ */
62
+ export type BaseTrackMetadata = {
63
+ /** The three-letter, ISO 639-2/T language code specifying the language of this track. */
64
+ languageCode?: string;
65
+ };
66
+ /**
67
+ * Additional metadata for video tracks.
68
+ * @public
69
+ */
70
+ export type VideoTrackMetadata = BaseTrackMetadata & {
71
+ /** The angle in degrees by which the track's frames should be rotated (clockwise). */
72
+ rotation?: Rotation;
73
+ /**
74
+ * The expected video frame rate in hertz. If set, all timestamps and durations of this track will be snapped to
75
+ * this frame rate. You should avoid adding more frames than the rate allows, as this will lead to multiple frames
76
+ * with the same timestamp.
77
+ */
78
+ frameRate?: number;
79
+ };
80
+ /**
81
+ * Additional metadata for audio tracks.
82
+ * @public
83
+ */
84
+ export type AudioTrackMetadata = BaseTrackMetadata & {};
85
+ /**
86
+ * Additional metadata for subtitle tracks.
87
+ * @public
88
+ */
89
+ export type SubtitleTrackMetadata = BaseTrackMetadata & {};
90
+ /**
91
+ * Main class orchestrating the creation of a new media file.
92
+ * @public
93
+ */
94
+ export declare class Output<F extends OutputFormat = OutputFormat, T extends Target = Target> {
95
+ /** The format of the output file. */
96
+ format: F;
97
+ /** The target to which the file will be written. */
98
+ target: T;
99
+ /** The current state of the output. */
100
+ state: 'pending' | 'started' | 'canceled' | 'finalizing' | 'finalized';
101
+ constructor(options: OutputOptions<F, T>);
102
+ /** Adds a video track to the output with the given source. Must be called before output is started. */
103
+ addVideoTrack(source: VideoSource, metadata?: VideoTrackMetadata): void;
104
+ /** Adds an audio track to the output with the given source. Must be called before output is started. */
105
+ addAudioTrack(source: AudioSource, metadata?: AudioTrackMetadata): void;
106
+ /** Adds a subtitle track to the output with the given source. Must be called before output is started. */
107
+ addSubtitleTrack(source: SubtitleSource, metadata?: SubtitleTrackMetadata): void;
108
+ /**
109
+ * Starts the creation of the output file. This method should be called after all tracks have been added. Only after
110
+ * the output has started can media samples be added to the tracks.
111
+ *
112
+ * @returns A promise that resolves when the output has successfully started and is ready to receive media samples.
113
+ */
114
+ start(): Promise<void>;
115
+ /**
116
+ * Resolves with the full MIME type of the output file, including track codecs.
117
+ *
118
+ * The returned promise will resolve only once the precise codec strings of all tracks are known.
119
+ */
120
+ getMimeType(): Promise<string>;
121
+ /**
122
+ * Cancels the creation of the output file, releasing internal resources like encoders and preventing further
123
+ * samples from being added.
124
+ *
125
+ * @returns A promise that resolves once all internal resources have been released.
126
+ */
127
+ cancel(): Promise<void>;
128
+ /**
129
+ * Finalizes the output file. This method must be called after all media samples across all tracks have been added.
130
+ * Once the Promise returned by this method completes, the output file is ready.
131
+ */
132
+ finalize(): Promise<void>;
133
+ }
134
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/output.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,269 @@
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 { AsyncMutex, isIso639Dash2LanguageCode } from './misc.js';
9
+ import { OutputFormat } from './output-format.js';
10
+ import { AudioSource, SubtitleSource, VideoSource } from './media-source.js';
11
+ import { Target } from './target.js';
12
+ /**
13
+ * List of all track types.
14
+ * @public
15
+ */
16
+ export const ALL_TRACK_TYPES = ['video', 'audio', 'subtitle'];
17
+ const validateBaseTrackMetadata = (metadata) => {
18
+ if (!metadata || typeof metadata !== 'object') {
19
+ throw new TypeError('metadata must be an object.');
20
+ }
21
+ if (metadata.languageCode !== undefined && !isIso639Dash2LanguageCode(metadata.languageCode)) {
22
+ throw new TypeError('metadata.languageCode must be a three-letter, ISO 639-2/T language code.');
23
+ }
24
+ };
25
+ /**
26
+ * Main class orchestrating the creation of a new media file.
27
+ * @public
28
+ */
29
+ export class Output {
30
+ constructor(options) {
31
+ /** The current state of the output. */
32
+ this.state = 'pending';
33
+ /** @internal */
34
+ this._tracks = [];
35
+ /** @internal */
36
+ this._startPromise = null;
37
+ /** @internal */
38
+ this._cancelPromise = null;
39
+ /** @internal */
40
+ this._finalizePromise = null;
41
+ /** @internal */
42
+ this._mutex = new AsyncMutex();
43
+ if (!options || typeof options !== 'object') {
44
+ throw new TypeError('options must be an object.');
45
+ }
46
+ if (!(options.format instanceof OutputFormat)) {
47
+ throw new TypeError('options.format must be an OutputFormat.');
48
+ }
49
+ if (!(options.target instanceof Target)) {
50
+ throw new TypeError('options.target must be a Target.');
51
+ }
52
+ if (options.target._output) {
53
+ throw new Error('Target is already used for another output.');
54
+ }
55
+ options.target._output = this;
56
+ this.format = options.format;
57
+ this.target = options.target;
58
+ this._writer = options.target._createWriter();
59
+ this._muxer = options.format._createMuxer(this);
60
+ }
61
+ /** Adds a video track to the output with the given source. Must be called before output is started. */
62
+ addVideoTrack(source, metadata = {}) {
63
+ if (!(source instanceof VideoSource)) {
64
+ throw new TypeError('source must be a VideoSource.');
65
+ }
66
+ validateBaseTrackMetadata(metadata);
67
+ if (metadata.rotation !== undefined && ![0, 90, 180, 270].includes(metadata.rotation)) {
68
+ throw new TypeError(`Invalid video rotation: ${metadata.rotation}. Has to be 0, 90, 180 or 270.`);
69
+ }
70
+ if (!this.format.supportsVideoRotationMetadata && metadata.rotation) {
71
+ throw new Error(`${this.format._name} does not support video rotation metadata.`);
72
+ }
73
+ if (metadata.frameRate !== undefined
74
+ && (!Number.isFinite(metadata.frameRate) || metadata.frameRate <= 0)) {
75
+ throw new TypeError(`Invalid video frame rate: ${metadata.frameRate}. Must be a positive number.`);
76
+ }
77
+ this._addTrack('video', source, metadata);
78
+ }
79
+ /** Adds an audio track to the output with the given source. Must be called before output is started. */
80
+ addAudioTrack(source, metadata = {}) {
81
+ if (!(source instanceof AudioSource)) {
82
+ throw new TypeError('source must be an AudioSource.');
83
+ }
84
+ validateBaseTrackMetadata(metadata);
85
+ this._addTrack('audio', source, metadata);
86
+ }
87
+ /** Adds a subtitle track to the output with the given source. Must be called before output is started. */
88
+ addSubtitleTrack(source, metadata = {}) {
89
+ if (!(source instanceof SubtitleSource)) {
90
+ throw new TypeError('source must be a SubtitleSource.');
91
+ }
92
+ validateBaseTrackMetadata(metadata);
93
+ this._addTrack('subtitle', source, metadata);
94
+ }
95
+ /** @internal */
96
+ _addTrack(type, source, metadata) {
97
+ if (this.state !== 'pending') {
98
+ throw new Error('Cannot add track after output has been started or canceled.');
99
+ }
100
+ if (source._connectedTrack) {
101
+ throw new Error('Source is already used for a track.');
102
+ }
103
+ // Verify maximum track count constraints
104
+ const supportedTrackCounts = this.format.getSupportedTrackCounts();
105
+ const presentTracksOfThisType = this._tracks.reduce((count, track) => count + (track.type === type ? 1 : 0), 0);
106
+ const maxCount = supportedTrackCounts[type].max;
107
+ if (presentTracksOfThisType === maxCount) {
108
+ throw new Error(maxCount === 0
109
+ ? `${this.format._name} does not support ${type} tracks.`
110
+ : (`${this.format._name} does not support more than ${maxCount} ${type} track`
111
+ + `${maxCount === 1 ? '' : 's'}.`));
112
+ }
113
+ const maxTotalCount = supportedTrackCounts.total.max;
114
+ if (this._tracks.length === maxTotalCount) {
115
+ throw new Error(`${this.format._name} does not support more than ${maxTotalCount} tracks`
116
+ + `${maxTotalCount === 1 ? '' : 's'} in total.`);
117
+ }
118
+ const track = {
119
+ id: this._tracks.length + 1,
120
+ output: this,
121
+ type,
122
+ source: source,
123
+ metadata,
124
+ };
125
+ if (track.type === 'video') {
126
+ const supportedVideoCodecs = this.format.getSupportedVideoCodecs();
127
+ if (supportedVideoCodecs.length === 0) {
128
+ throw new Error(`${this.format._name} does not support video tracks.`
129
+ + this.format._codecUnsupportedHint(track.source._codec));
130
+ }
131
+ else if (!supportedVideoCodecs.includes(track.source._codec)) {
132
+ throw new Error(`Codec '${track.source._codec}' cannot be contained within ${this.format._name}. Supported`
133
+ + ` video codecs are: ${supportedVideoCodecs.map(codec => `'${codec}'`).join(', ')}.`
134
+ + this.format._codecUnsupportedHint(track.source._codec));
135
+ }
136
+ }
137
+ else if (track.type === 'audio') {
138
+ const supportedAudioCodecs = this.format.getSupportedAudioCodecs();
139
+ if (supportedAudioCodecs.length === 0) {
140
+ throw new Error(`${this.format._name} does not support audio tracks.`
141
+ + this.format._codecUnsupportedHint(track.source._codec));
142
+ }
143
+ else if (!supportedAudioCodecs.includes(track.source._codec)) {
144
+ throw new Error(`Codec '${track.source._codec}' cannot be contained within ${this.format._name}. Supported`
145
+ + ` audio codecs are: ${supportedAudioCodecs.map(codec => `'${codec}'`).join(', ')}.`
146
+ + this.format._codecUnsupportedHint(track.source._codec));
147
+ }
148
+ }
149
+ else if (track.type === 'subtitle') {
150
+ const supportedSubtitleCodecs = this.format.getSupportedSubtitleCodecs();
151
+ if (supportedSubtitleCodecs.length === 0) {
152
+ throw new Error(`${this.format._name} does not support subtitle tracks.`
153
+ + this.format._codecUnsupportedHint(track.source._codec));
154
+ }
155
+ else if (!supportedSubtitleCodecs.includes(track.source._codec)) {
156
+ throw new Error(`Codec '${track.source._codec}' cannot be contained within ${this.format._name}. Supported`
157
+ + ` subtitle codecs are: ${supportedSubtitleCodecs.map(codec => `'${codec}'`).join(', ')}.`
158
+ + this.format._codecUnsupportedHint(track.source._codec));
159
+ }
160
+ }
161
+ this._tracks.push(track);
162
+ source._connectedTrack = track;
163
+ }
164
+ /**
165
+ * Starts the creation of the output file. This method should be called after all tracks have been added. Only after
166
+ * the output has started can media samples be added to the tracks.
167
+ *
168
+ * @returns A promise that resolves when the output has successfully started and is ready to receive media samples.
169
+ */
170
+ async start() {
171
+ // Verify minimum track count constraints
172
+ const supportedTrackCounts = this.format.getSupportedTrackCounts();
173
+ for (const trackType of ALL_TRACK_TYPES) {
174
+ const presentTracksOfThisType = this._tracks.reduce((count, track) => count + (track.type === trackType ? 1 : 0), 0);
175
+ const minCount = supportedTrackCounts[trackType].min;
176
+ if (presentTracksOfThisType < minCount) {
177
+ throw new Error(minCount === supportedTrackCounts[trackType].max
178
+ ? (`${this.format._name} requires exactly ${minCount} ${trackType}`
179
+ + ` track${minCount === 1 ? '' : 's'}.`)
180
+ : (`${this.format._name} requires at least ${minCount} ${trackType}`
181
+ + ` track${minCount === 1 ? '' : 's'}.`));
182
+ }
183
+ }
184
+ const totalMinCount = supportedTrackCounts.total.min;
185
+ if (this._tracks.length < totalMinCount) {
186
+ throw new Error(totalMinCount === supportedTrackCounts.total.max
187
+ ? (`${this.format._name} requires exactly ${totalMinCount} track`
188
+ + `${totalMinCount === 1 ? '' : 's'}.`)
189
+ : (`${this.format._name} requires at least ${totalMinCount} track`
190
+ + `${totalMinCount === 1 ? '' : 's'}.`));
191
+ }
192
+ if (this.state === 'canceled') {
193
+ throw new Error('Output has been canceled.');
194
+ }
195
+ if (this._startPromise) {
196
+ console.warn('Output has already been started.');
197
+ return this._startPromise;
198
+ }
199
+ return this._startPromise = (async () => {
200
+ this.state = 'started';
201
+ this._writer.start();
202
+ const release = await this._mutex.acquire();
203
+ await this._muxer.start();
204
+ for (const track of this._tracks) {
205
+ track.source._start();
206
+ }
207
+ release();
208
+ })();
209
+ }
210
+ /**
211
+ * Resolves with the full MIME type of the output file, including track codecs.
212
+ *
213
+ * The returned promise will resolve only once the precise codec strings of all tracks are known.
214
+ */
215
+ getMimeType() {
216
+ return this._muxer.getMimeType();
217
+ }
218
+ /**
219
+ * Cancels the creation of the output file, releasing internal resources like encoders and preventing further
220
+ * samples from being added.
221
+ *
222
+ * @returns A promise that resolves once all internal resources have been released.
223
+ */
224
+ async cancel() {
225
+ if (this._cancelPromise) {
226
+ console.warn('Output has already been canceled.');
227
+ return this._cancelPromise;
228
+ }
229
+ else if (this.state === 'finalizing' || this.state === 'finalized') {
230
+ console.warn('Output has already been finalized.');
231
+ return;
232
+ }
233
+ return this._cancelPromise = (async () => {
234
+ this.state = 'canceled';
235
+ const release = await this._mutex.acquire();
236
+ const promises = this._tracks.map(x => x.source._flushOrWaitForClose());
237
+ await Promise.all(promises);
238
+ await this._writer.close();
239
+ release();
240
+ })();
241
+ }
242
+ /**
243
+ * Finalizes the output file. This method must be called after all media samples across all tracks have been added.
244
+ * Once the Promise returned by this method completes, the output file is ready.
245
+ */
246
+ async finalize() {
247
+ if (this.state === 'pending') {
248
+ throw new Error('Cannot finalize before starting.');
249
+ }
250
+ if (this.state === 'canceled') {
251
+ throw new Error('Cannot finalize after canceling.');
252
+ }
253
+ if (this._finalizePromise) {
254
+ console.warn('Output has already been finalized.');
255
+ return this._finalizePromise;
256
+ }
257
+ return this._finalizePromise = (async () => {
258
+ this.state = 'finalizing';
259
+ const release = await this._mutex.acquire();
260
+ const promises = this._tracks.map(x => x.source._flushOrWaitForClose());
261
+ await Promise.all(promises);
262
+ await this._muxer.finalize();
263
+ await this._writer.flush();
264
+ await this._writer.finalize();
265
+ this.state = 'finalized';
266
+ release();
267
+ })();
268
+ }
269
+ }
@@ -0,0 +1,86 @@
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
+ export declare const PLACEHOLDER_DATA: Uint8Array<ArrayBuffer>;
9
+ /**
10
+ * The type of a packet. Key packets can be decoded without previous packets, while delta packets depend on previous
11
+ * packets.
12
+ * @public
13
+ */
14
+ export type PacketType = 'key' | 'delta';
15
+ /**
16
+ * Represents an encoded chunk of media. Mainly used as an expressive wrapper around WebCodecs API's EncodedVideoChunk
17
+ * and EncodedAudioChunk, but can also be used standalone.
18
+ * @public
19
+ */
20
+ export declare class EncodedPacket {
21
+ /** The encoded data of this packet. */
22
+ readonly data: Uint8Array;
23
+ /** The type of this packet. */
24
+ readonly type: PacketType;
25
+ /**
26
+ * The presentation timestamp of this packet in seconds. May be negative. Samples with negative end timestamps
27
+ * should not be presented.
28
+ */
29
+ readonly timestamp: number;
30
+ /** The duration of this packet in seconds. */
31
+ readonly duration: number;
32
+ /**
33
+ * The sequence number indicates the decode order of the packets. Packet A must be decoded before packet B if A
34
+ * has a lower sequence number than B. If two packets have the same sequence number, they are the same packet.
35
+ * Otherwise, sequence numbers are arbitrary and are not guaranteed to have any meaning besides their relative
36
+ * ordering. Negative sequence numbers mean the sequence number is undefined.
37
+ */
38
+ readonly sequenceNumber: number;
39
+ /**
40
+ * The actual byte length of the data in this packet. This field is useful for metadata-only packets where the
41
+ * `data` field contains no bytes.
42
+ */
43
+ readonly byteLength: number;
44
+ constructor(
45
+ /** The encoded data of this packet. */
46
+ data: Uint8Array,
47
+ /** The type of this packet. */
48
+ type: PacketType,
49
+ /**
50
+ * The presentation timestamp of this packet in seconds. May be negative. Samples with negative end timestamps
51
+ * should not be presented.
52
+ */
53
+ timestamp: number,
54
+ /** The duration of this packet in seconds. */
55
+ duration: number,
56
+ /**
57
+ * The sequence number indicates the decode order of the packets. Packet A must be decoded before packet B if A
58
+ * has a lower sequence number than B. If two packets have the same sequence number, they are the same packet.
59
+ * Otherwise, sequence numbers are arbitrary and are not guaranteed to have any meaning besides their relative
60
+ * ordering. Negative sequence numbers mean the sequence number is undefined.
61
+ */
62
+ sequenceNumber?: number, byteLength?: number);
63
+ /** If this packet is a metadata-only packet. Metadata-only packets don't contain their packet data. */
64
+ get isMetadataOnly(): boolean;
65
+ /** The timestamp of this packet in microseconds. */
66
+ get microsecondTimestamp(): number;
67
+ /** The duration of this packet in microseconds. */
68
+ get microsecondDuration(): number;
69
+ /** Converts this packet to an EncodedVideoChunk for use with the WebCodecs API. */
70
+ toEncodedVideoChunk(): EncodedVideoChunk;
71
+ /** Converts this packet to an EncodedAudioChunk for use with the WebCodecs API. */
72
+ toEncodedAudioChunk(): EncodedAudioChunk;
73
+ /**
74
+ * Creates an EncodedPacket from an EncodedVideoChunk or EncodedAudioChunk. This method is useful for converting
75
+ * chunks from the WebCodecs API to EncodedPackets.
76
+ */
77
+ static fromEncodedChunk(chunk: EncodedVideoChunk | EncodedAudioChunk): EncodedPacket;
78
+ /** Clones this packet while optionally updating timing information. */
79
+ clone(options?: {
80
+ /** The timestamp of the cloned packet in seconds. */
81
+ timestamp?: number;
82
+ /** The duration of the cloned packet in seconds. */
83
+ duration?: number;
84
+ }): EncodedPacket;
85
+ }
86
+ //# sourceMappingURL=packet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packet.d.ts","sourceRoot":"","sources":["../../src/packet.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,eAAO,MAAM,gBAAgB,yBAAoB,CAAC;AAElD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,CAAC;AAEzC;;;;GAIG;AACH,qBAAa,aAAa;IAQxB,uCAAuC;aACvB,IAAI,EAAE,UAAU;IAChC,+BAA+B;aACf,IAAI,EAAE,UAAU;IAChC;;;OAGG;aACa,SAAS,EAAE,MAAM;IACjC,8CAA8C;aAC9B,QAAQ,EAAE,MAAM;IAChC;;;;;OAKG;aACa,cAAc;IAxB/B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;;IAG3B,uCAAuC;IACvB,IAAI,EAAE,UAAU;IAChC,+BAA+B;IACf,IAAI,EAAE,UAAU;IAChC;;;OAGG;IACa,SAAS,EAAE,MAAM;IACjC,8CAA8C;IAC9B,QAAQ,EAAE,MAAM;IAChC;;;;;OAKG;IACa,cAAc,SAAK,EACnC,UAAU,CAAC,EAAE,MAAM;IAkCpB,uGAAuG;IACvG,IAAI,cAAc,YAEjB;IAED,oDAAoD;IACpD,IAAI,oBAAoB,WAEvB;IAED,mDAAmD;IACnD,IAAI,mBAAmB,WAEtB;IAED,mFAAmF;IACnF,mBAAmB;IAgBnB,mFAAmF;IACnF,mBAAmB;IAgBnB;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,GAAG,iBAAiB,GAAG,aAAa;IAgBpF,uEAAuE;IACvE,KAAK,CAAC,OAAO,CAAC,EAAE;QACf,qDAAqD;QACrD,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,oDAAoD;QACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,aAAa;CAoBjB"}
@@ -0,0 +1,133 @@
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 { SECOND_TO_MICROSECOND_FACTOR } from './misc.js';
9
+ export const PLACEHOLDER_DATA = new Uint8Array(0);
10
+ /**
11
+ * Represents an encoded chunk of media. Mainly used as an expressive wrapper around WebCodecs API's EncodedVideoChunk
12
+ * and EncodedAudioChunk, but can also be used standalone.
13
+ * @public
14
+ */
15
+ export class EncodedPacket {
16
+ constructor(
17
+ /** The encoded data of this packet. */
18
+ data,
19
+ /** The type of this packet. */
20
+ type,
21
+ /**
22
+ * The presentation timestamp of this packet in seconds. May be negative. Samples with negative end timestamps
23
+ * should not be presented.
24
+ */
25
+ timestamp,
26
+ /** The duration of this packet in seconds. */
27
+ duration,
28
+ /**
29
+ * The sequence number indicates the decode order of the packets. Packet A must be decoded before packet B if A
30
+ * has a lower sequence number than B. If two packets have the same sequence number, they are the same packet.
31
+ * Otherwise, sequence numbers are arbitrary and are not guaranteed to have any meaning besides their relative
32
+ * ordering. Negative sequence numbers mean the sequence number is undefined.
33
+ */
34
+ sequenceNumber = -1, byteLength) {
35
+ this.data = data;
36
+ this.type = type;
37
+ this.timestamp = timestamp;
38
+ this.duration = duration;
39
+ this.sequenceNumber = sequenceNumber;
40
+ if (data === PLACEHOLDER_DATA && byteLength === undefined) {
41
+ throw new Error('Internal error: byteLength must be explicitly provided when constructing metadata-only packets.');
42
+ }
43
+ if (byteLength === undefined) {
44
+ byteLength = data.byteLength;
45
+ }
46
+ if (!(data instanceof Uint8Array)) {
47
+ throw new TypeError('data must be a Uint8Array.');
48
+ }
49
+ if (type !== 'key' && type !== 'delta') {
50
+ throw new TypeError('type must be either "key" or "delta".');
51
+ }
52
+ if (!Number.isFinite(timestamp)) {
53
+ throw new TypeError('timestamp must be a number.');
54
+ }
55
+ if (!Number.isFinite(duration) || duration < 0) {
56
+ throw new TypeError('duration must be a non-negative number.');
57
+ }
58
+ if (!Number.isFinite(sequenceNumber)) {
59
+ throw new TypeError('sequenceNumber must be a number.');
60
+ }
61
+ if (!Number.isInteger(byteLength) || byteLength < 0) {
62
+ throw new TypeError('byteLength must be a non-negative integer.');
63
+ }
64
+ this.byteLength = byteLength;
65
+ }
66
+ /** If this packet is a metadata-only packet. Metadata-only packets don't contain their packet data. */
67
+ get isMetadataOnly() {
68
+ return this.data === PLACEHOLDER_DATA;
69
+ }
70
+ /** The timestamp of this packet in microseconds. */
71
+ get microsecondTimestamp() {
72
+ return Math.trunc(SECOND_TO_MICROSECOND_FACTOR * this.timestamp);
73
+ }
74
+ /** The duration of this packet in microseconds. */
75
+ get microsecondDuration() {
76
+ return Math.trunc(SECOND_TO_MICROSECOND_FACTOR * this.duration);
77
+ }
78
+ /** Converts this packet to an EncodedVideoChunk for use with the WebCodecs API. */
79
+ toEncodedVideoChunk() {
80
+ if (this.isMetadataOnly) {
81
+ throw new TypeError('Metadata-only packets cannot be converted to a video chunk.');
82
+ }
83
+ if (typeof EncodedVideoChunk === 'undefined') {
84
+ throw new Error('Your browser does not support EncodedVideoChunk.');
85
+ }
86
+ return new EncodedVideoChunk({
87
+ data: this.data,
88
+ type: this.type,
89
+ timestamp: this.microsecondTimestamp,
90
+ duration: this.microsecondDuration,
91
+ });
92
+ }
93
+ /** Converts this packet to an EncodedAudioChunk for use with the WebCodecs API. */
94
+ toEncodedAudioChunk() {
95
+ if (this.isMetadataOnly) {
96
+ throw new TypeError('Metadata-only packets cannot be converted to an audio chunk.');
97
+ }
98
+ if (typeof EncodedAudioChunk === 'undefined') {
99
+ throw new Error('Your browser does not support EncodedAudioChunk.');
100
+ }
101
+ return new EncodedAudioChunk({
102
+ data: this.data,
103
+ type: this.type,
104
+ timestamp: this.microsecondTimestamp,
105
+ duration: this.microsecondDuration,
106
+ });
107
+ }
108
+ /**
109
+ * Creates an EncodedPacket from an EncodedVideoChunk or EncodedAudioChunk. This method is useful for converting
110
+ * chunks from the WebCodecs API to EncodedPackets.
111
+ */
112
+ static fromEncodedChunk(chunk) {
113
+ if (!(chunk instanceof EncodedVideoChunk || chunk instanceof EncodedAudioChunk)) {
114
+ throw new TypeError('chunk must be an EncodedVideoChunk or EncodedAudioChunk.');
115
+ }
116
+ const data = new Uint8Array(chunk.byteLength);
117
+ chunk.copyTo(data);
118
+ return new EncodedPacket(data, chunk.type, chunk.timestamp / 1e6, (chunk.duration ?? 0) / 1e6);
119
+ }
120
+ /** Clones this packet while optionally updating timing information. */
121
+ clone(options) {
122
+ if (options !== undefined && (typeof options !== 'object' || options === null)) {
123
+ throw new TypeError('options, when provided, must be an object.');
124
+ }
125
+ if (options?.timestamp !== undefined && !Number.isFinite(options.timestamp)) {
126
+ throw new TypeError('options.timestamp, when provided, must be a number.');
127
+ }
128
+ if (options?.duration !== undefined && !Number.isFinite(options.duration)) {
129
+ throw new TypeError('options.duration, when provided, must be a number.');
130
+ }
131
+ return new EncodedPacket(this.data, this.type, options?.timestamp ?? this.timestamp, options?.duration ?? this.duration, this.sequenceNumber, this.byteLength);
132
+ }
133
+ }
@@ -0,0 +1,12 @@
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
+ export declare const toUlaw: (s16: number) => number;
9
+ export declare const fromUlaw: (u8: number) => number;
10
+ export declare const toAlaw: (s16: number) => number;
11
+ export declare const fromAlaw: (u8: number) => number;
12
+ //# sourceMappingURL=pcm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pcm.d.ts","sourceRoot":"","sources":["../../src/pcm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,WA6BjC,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,WAkBlC,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,WA0BjC,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,WAsBlC,CAAC"}