node-av 1.1.0 → 1.3.0

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 (166) hide show
  1. package/README.md +51 -59
  2. package/dist/api/bitstream-filter.d.ts +183 -123
  3. package/dist/api/bitstream-filter.js +185 -127
  4. package/dist/api/bitstream-filter.js.map +1 -1
  5. package/dist/api/decoder.d.ts +282 -130
  6. package/dist/api/decoder.js +290 -142
  7. package/dist/api/decoder.js.map +1 -1
  8. package/dist/api/encoder.d.ts +249 -160
  9. package/dist/api/encoder.js +276 -207
  10. package/dist/api/encoder.js.map +1 -1
  11. package/dist/api/filter-presets.d.ts +1944 -96
  12. package/dist/api/filter-presets.js +2059 -105
  13. package/dist/api/filter-presets.js.map +1 -1
  14. package/dist/api/filter.d.ts +264 -200
  15. package/dist/api/filter.js +269 -231
  16. package/dist/api/filter.js.map +1 -1
  17. package/dist/api/hardware.d.ts +246 -117
  18. package/dist/api/hardware.js +440 -217
  19. package/dist/api/hardware.js.map +1 -1
  20. package/dist/api/index.d.ts +3 -3
  21. package/dist/api/index.js +1 -1
  22. package/dist/api/index.js.map +1 -1
  23. package/dist/api/io-stream.d.ts +65 -55
  24. package/dist/api/io-stream.js +43 -40
  25. package/dist/api/io-stream.js.map +1 -1
  26. package/dist/api/media-input.d.ts +242 -139
  27. package/dist/api/media-input.js +205 -103
  28. package/dist/api/media-input.js.map +1 -1
  29. package/dist/api/media-output.d.ts +208 -126
  30. package/dist/api/media-output.js +212 -126
  31. package/dist/api/media-output.js.map +1 -1
  32. package/dist/api/pipeline.d.ts +361 -38
  33. package/dist/api/pipeline.js +255 -14
  34. package/dist/api/pipeline.js.map +1 -1
  35. package/dist/api/types.d.ts +26 -187
  36. package/dist/api/utilities/audio-sample.d.ts +0 -8
  37. package/dist/api/utilities/audio-sample.js +0 -8
  38. package/dist/api/utilities/audio-sample.js.map +1 -1
  39. package/dist/api/utilities/channel-layout.d.ts +0 -8
  40. package/dist/api/utilities/channel-layout.js +0 -8
  41. package/dist/api/utilities/channel-layout.js.map +1 -1
  42. package/dist/api/utilities/image.d.ts +0 -8
  43. package/dist/api/utilities/image.js +0 -8
  44. package/dist/api/utilities/image.js.map +1 -1
  45. package/dist/api/utilities/index.d.ts +3 -3
  46. package/dist/api/utilities/index.js +3 -3
  47. package/dist/api/utilities/index.js.map +1 -1
  48. package/dist/api/utilities/media-type.d.ts +1 -9
  49. package/dist/api/utilities/media-type.js +1 -9
  50. package/dist/api/utilities/media-type.js.map +1 -1
  51. package/dist/api/utilities/pixel-format.d.ts +1 -9
  52. package/dist/api/utilities/pixel-format.js +1 -9
  53. package/dist/api/utilities/pixel-format.js.map +1 -1
  54. package/dist/api/utilities/sample-format.d.ts +1 -9
  55. package/dist/api/utilities/sample-format.js +1 -9
  56. package/dist/api/utilities/sample-format.js.map +1 -1
  57. package/dist/api/utilities/streaming.d.ts +0 -8
  58. package/dist/api/utilities/streaming.js +0 -8
  59. package/dist/api/utilities/streaming.js.map +1 -1
  60. package/dist/api/utilities/timestamp.d.ts +0 -8
  61. package/dist/api/utilities/timestamp.js +0 -8
  62. package/dist/api/utilities/timestamp.js.map +1 -1
  63. package/dist/api/utils.d.ts +1 -2
  64. package/dist/api/utils.js +11 -0
  65. package/dist/api/utils.js.map +1 -1
  66. package/dist/constants/constants.d.ts +1 -1
  67. package/dist/constants/constants.js +2 -0
  68. package/dist/constants/constants.js.map +1 -1
  69. package/dist/lib/audio-fifo.d.ts +127 -170
  70. package/dist/lib/audio-fifo.js +130 -173
  71. package/dist/lib/audio-fifo.js.map +1 -1
  72. package/dist/lib/binding.d.ts +1 -0
  73. package/dist/lib/binding.js +7 -0
  74. package/dist/lib/binding.js.map +1 -1
  75. package/dist/lib/bitstream-filter-context.d.ts +139 -184
  76. package/dist/lib/bitstream-filter-context.js +139 -188
  77. package/dist/lib/bitstream-filter-context.js.map +1 -1
  78. package/dist/lib/bitstream-filter.d.ts +68 -54
  79. package/dist/lib/bitstream-filter.js +68 -54
  80. package/dist/lib/bitstream-filter.js.map +1 -1
  81. package/dist/lib/codec-context.d.ts +316 -380
  82. package/dist/lib/codec-context.js +316 -381
  83. package/dist/lib/codec-context.js.map +1 -1
  84. package/dist/lib/codec-parameters.d.ts +160 -170
  85. package/dist/lib/codec-parameters.js +162 -172
  86. package/dist/lib/codec-parameters.js.map +1 -1
  87. package/dist/lib/codec-parser.d.ts +91 -104
  88. package/dist/lib/codec-parser.js +92 -103
  89. package/dist/lib/codec-parser.js.map +1 -1
  90. package/dist/lib/codec.d.ts +266 -283
  91. package/dist/lib/codec.js +270 -287
  92. package/dist/lib/codec.js.map +1 -1
  93. package/dist/lib/dictionary.d.ts +149 -203
  94. package/dist/lib/dictionary.js +158 -212
  95. package/dist/lib/dictionary.js.map +1 -1
  96. package/dist/lib/error.d.ts +96 -130
  97. package/dist/lib/error.js +98 -128
  98. package/dist/lib/error.js.map +1 -1
  99. package/dist/lib/filter-context.d.ts +284 -218
  100. package/dist/lib/filter-context.js +290 -227
  101. package/dist/lib/filter-context.js.map +1 -1
  102. package/dist/lib/filter-graph.d.ts +251 -292
  103. package/dist/lib/filter-graph.js +253 -294
  104. package/dist/lib/filter-graph.js.map +1 -1
  105. package/dist/lib/filter-inout.d.ts +87 -95
  106. package/dist/lib/filter-inout.js +87 -95
  107. package/dist/lib/filter-inout.js.map +1 -1
  108. package/dist/lib/filter.d.ts +93 -111
  109. package/dist/lib/filter.js +93 -111
  110. package/dist/lib/filter.js.map +1 -1
  111. package/dist/lib/format-context.d.ts +320 -428
  112. package/dist/lib/format-context.js +313 -385
  113. package/dist/lib/format-context.js.map +1 -1
  114. package/dist/lib/frame.d.ts +262 -405
  115. package/dist/lib/frame.js +263 -408
  116. package/dist/lib/frame.js.map +1 -1
  117. package/dist/lib/hardware-device-context.d.ts +149 -203
  118. package/dist/lib/hardware-device-context.js +149 -203
  119. package/dist/lib/hardware-device-context.js.map +1 -1
  120. package/dist/lib/hardware-frames-context.d.ts +170 -180
  121. package/dist/lib/hardware-frames-context.js +171 -181
  122. package/dist/lib/hardware-frames-context.js.map +1 -1
  123. package/dist/lib/index.d.ts +3 -2
  124. package/dist/lib/index.js +3 -3
  125. package/dist/lib/index.js.map +1 -1
  126. package/dist/lib/input-format.d.ts +89 -117
  127. package/dist/lib/input-format.js +89 -117
  128. package/dist/lib/input-format.js.map +1 -1
  129. package/dist/lib/io-context.d.ts +209 -241
  130. package/dist/lib/io-context.js +220 -252
  131. package/dist/lib/io-context.js.map +1 -1
  132. package/dist/lib/log.d.ts +85 -119
  133. package/dist/lib/log.js +85 -122
  134. package/dist/lib/log.js.map +1 -1
  135. package/dist/lib/native-types.d.ts +118 -106
  136. package/dist/lib/native-types.js +0 -7
  137. package/dist/lib/native-types.js.map +1 -1
  138. package/dist/lib/option.d.ts +437 -218
  139. package/dist/lib/option.js +462 -226
  140. package/dist/lib/option.js.map +1 -1
  141. package/dist/lib/output-format.d.ts +77 -101
  142. package/dist/lib/output-format.js +77 -101
  143. package/dist/lib/output-format.js.map +1 -1
  144. package/dist/lib/packet.d.ts +172 -240
  145. package/dist/lib/packet.js +172 -241
  146. package/dist/lib/packet.js.map +1 -1
  147. package/dist/lib/rational.d.ts +0 -2
  148. package/dist/lib/rational.js +0 -2
  149. package/dist/lib/rational.js.map +1 -1
  150. package/dist/lib/software-resample-context.d.ts +241 -325
  151. package/dist/lib/software-resample-context.js +242 -326
  152. package/dist/lib/software-resample-context.js.map +1 -1
  153. package/dist/lib/software-scale-context.d.ts +129 -173
  154. package/dist/lib/software-scale-context.js +131 -175
  155. package/dist/lib/software-scale-context.js.map +1 -1
  156. package/dist/lib/stream.d.ts +87 -197
  157. package/dist/lib/stream.js +87 -197
  158. package/dist/lib/stream.js.map +1 -1
  159. package/dist/lib/utilities.d.ts +435 -181
  160. package/dist/lib/utilities.js +438 -182
  161. package/dist/lib/utilities.js.map +1 -1
  162. package/install/check.js +0 -1
  163. package/install/ffmpeg.js +0 -11
  164. package/package.json +25 -18
  165. package/release_notes.md +24 -59
  166. package/CHANGELOG.md +0 -8
@@ -1,72 +1,61 @@
1
- /**
2
- * MediaOutput - Unified Output Handler for FFmpeg
3
- *
4
- * Provides a high-level interface for writing media to various destinations.
5
- * Supports files, streams, and custom IO with automatic format configuration.
6
- *
7
- * Central entry point for all media output operations.
8
- * Manages FormatContext lifecycle and provides stream management.
9
- *
10
- * @module api/media-output
11
- */
12
1
  import { FormatContext } from '../lib/index.js';
13
2
  import { Encoder } from './encoder.js';
14
3
  import type { IRational, Packet, Stream } from '../lib/index.js';
15
4
  import type { IOOutputCallbacks, MediaOutputOptions } from './types.js';
16
- interface StreamInfo {
5
+ export interface StreamDescription {
17
6
  stream: Stream;
18
7
  timeBase: IRational;
19
8
  isStreamCopy: boolean;
20
9
  sourceTimeBase?: IRational;
21
10
  }
22
11
  /**
23
- * MediaOutput - High-level media output handler.
12
+ * High-level media output for writing and muxing media files.
24
13
  *
25
- * Creates and manages media containers for writing encoded streams.
26
- * Automatically handles format setup and stream configuration.
27
- *
28
- * Manages the FormatContext and provides convenient methods for
29
- * adding streams, writing packets, and finalizing output.
14
+ * Provides simplified access to media muxing and file writing operations.
15
+ * Handles stream configuration, packet writing, and format management.
16
+ * Supports files, URLs, and custom I/O with automatic cleanup.
17
+ * Essential component for media encoding pipelines and transcoding.
30
18
  *
31
19
  * @example
32
20
  * ```typescript
33
- * import { MediaOutput, Encoder } from 'node-av/api';
21
+ * import { MediaOutput } from 'node-av/api';
34
22
  *
35
- * // Open output file
36
- * const output = await MediaOutput.open('output.mp4');
23
+ * // Create output file
24
+ * await using output = await MediaOutput.open('output.mp4');
37
25
  *
38
- * // Add encoder stream
39
- * const encoder = await Encoder.create('libx264', {
40
- * width: 1920,
41
- * height: 1080,
42
- * pixelFormat: AV_PIX_FMT_YUV420P
43
- * });
44
- * const streamIdx = output.addStream(encoder);
26
+ * // Add streams from encoders
27
+ * const videoIdx = output.addStream(videoEncoder);
28
+ * const audioIdx = output.addStream(audioEncoder);
45
29
  *
46
- * // Write header, packets, trailer
30
+ * // Write header
47
31
  * await output.writeHeader();
48
- * await output.writePacket(packet, streamIdx);
32
+ *
33
+ * // Write packets
34
+ * await output.writePacket(packet, videoIdx);
35
+ *
36
+ * // Write trailer and close
49
37
  * await output.writeTrailer();
50
- * await output.close();
51
38
  * ```
52
39
  *
53
40
  * @example
54
41
  * ```typescript
55
- * // Stream copy without re-encoding
56
- * const input = await MediaInput.open('input.mp4');
57
- * const output = await MediaOutput.open('output.mkv');
58
- *
59
- * const videoStream = input.video();
60
- * const streamIdx = output.addStream(videoStream);
42
+ * // Stream copy
43
+ * await using input = await MediaInput.open('input.mp4');
44
+ * await using output = await MediaOutput.open('output.mp4');
61
45
  *
46
+ * // Copy stream configuration
47
+ * const videoIdx = output.addStream(input.video());
62
48
  * await output.writeHeader();
49
+ *
63
50
  * for await (const packet of input.packets()) {
64
- * if (packet.streamIndex === videoStream.index) {
65
- * await output.writePacket(packet, streamIdx);
66
- * }
51
+ * await output.writePacket(packet, videoIdx);
52
+ * packet.free();
67
53
  * }
68
- * await output.writeTrailer();
69
54
  * ```
55
+ *
56
+ * @see {@link MediaInput} For reading media files
57
+ * @see {@link Encoder} For encoding frames to packets
58
+ * @see {@link FormatContext} For low-level API
70
59
  */
71
60
  export declare class MediaOutput implements AsyncDisposable {
72
61
  private formatContext;
@@ -76,199 +65,292 @@ export declare class MediaOutput implements AsyncDisposable {
76
65
  private trailerWritten;
77
66
  private closed;
78
67
  /**
79
- * Private constructor - use MediaOutput.open() instead.
80
- *
81
- * Initializes the output with a new FormatContext.
82
- * The actual format setup happens in the static factory method.
68
+ * @internal
83
69
  */
84
70
  private constructor();
85
71
  /**
86
- * Opens a media output for writing with custom IO callbacks or stream URL or file output
72
+ * Open media output for writing.
87
73
  *
88
- * Creates a FormatContext and prepares the output for writing.
89
- * Automatically detects format from filename/URL if not specified.
74
+ * Creates and configures output context for muxing.
75
+ * Automatically creates directories for file output.
76
+ * Supports files, URLs, and custom I/O callbacks.
90
77
  *
91
- * If io callbacks is used, it creates a FormatContext with custom IO handling.
92
- * Format must be explicitly specified for custom IO.
78
+ * Direct mapping to avformat_alloc_output_context2() and avio_open2().
93
79
  *
94
- * Uses avformat_alloc_output_context2() and avio_alloc_context() internally.
80
+ * @param target - File path, URL, or I/O callbacks
81
+ * @param options - Output configuration options
82
+ * @returns Opened media output instance
95
83
  *
96
- * @param target - File path or stream URL or custom IO callbacks
97
- * @param options - Optional configuration
84
+ * @throws {Error} If format required for custom I/O
98
85
  *
99
- * @returns Promise resolving to MediaOutput instance
100
- *
101
- * @throws {Error} If format not specified or context allocation fails
86
+ * @throws {FFmpegError} If allocation or opening fails
102
87
  *
103
88
  * @example
104
89
  * ```typescript
105
- * const callbacks = {
106
- * write: (buffer) => myStream.write(buffer),
107
- * seek: (offset, whence) => offset
108
- * };
109
- * const output = await MediaOutput.open(callbacks, { format: 'mp4' });
90
+ * // Create file output
91
+ * await using output = await MediaOutput.open('output.mp4');
110
92
  * ```
111
93
  *
112
94
  * @example
113
95
  * ```typescript
114
- * const output = await MediaOutput.open('output.mp4');
96
+ * // Create output with specific format
97
+ * await using output = await MediaOutput.open('output.ts', {
98
+ * format: 'mpegts'
99
+ * });
115
100
  * ```
116
101
  *
117
102
  * @example
118
103
  * ```typescript
119
- * const output = await MediaOutput.open('rtmp://server/live/streamkey', { format: 'flv' });
104
+ * // Custom I/O callbacks
105
+ * const callbacks = {
106
+ * write: async (buffer: Buffer) => {
107
+ * // Write to custom destination
108
+ * return buffer.length;
109
+ * },
110
+ * seek: async (offset: bigint, whence: number) => {
111
+ * // Seek in custom destination
112
+ * return offset;
113
+ * }
114
+ * };
115
+ *
116
+ * await using output = await MediaOutput.open(callbacks, {
117
+ * format: 'mp4',
118
+ * bufferSize: 8192
119
+ * });
120
120
  * ```
121
+ *
122
+ * @see {@link MediaOutputOptions} For configuration options
123
+ * @see {@link IOOutputCallbacks} For custom I/O interface
121
124
  */
122
125
  static open(target: string | IOOutputCallbacks, options?: MediaOutputOptions): Promise<MediaOutput>;
123
126
  /**
124
- * Adds a stream to the output container.
127
+ * Add a stream to the output.
125
128
  *
126
- * Creates a new stream in the output format context.
127
- * Copies codec parameters from encoder or input stream.
129
+ * Configures output stream from encoder or input stream.
130
+ * Must be called before writeHeader().
131
+ * Returns stream index for packet writing.
128
132
  *
129
- * Uses avformat_new_stream() and avcodec_parameters_copy() internally.
130
- *
131
- * @param source - Encoder for transcoding or Stream for copying
132
- * @param options - Optional stream configuration
133
- * @param options.timeBase - Custom output timebase for the stream.
134
- * If not specified, uses the source's timebase.
135
- * When set, packets will be automatically rescaled
136
- * from source timebase to this output timebase.
133
+ * Direct mapping to avformat_new_stream() and avcodec_parameters_copy().
137
134
  *
135
+ * @param source - Encoder or stream to add
136
+ * @param options - Stream configuration options
137
+ * @param options.timeBase - Optional custom timebase for the stream
138
138
  * @returns Stream index for packet writing
139
139
  *
140
- * @throws {Error} If called after header is written or output is closed
141
- *
142
- * @example
143
- * ```typescript
144
- * // Add encoder stream (transcoding) - uses encoder's timebase
145
- * const encoder = await Encoder.create('libx264', { width: 1920, height: 1080 });
146
- * const streamIdx = output.addStream(encoder);
147
- * ```
140
+ * @throws {Error} If called after header written or output closed
148
141
  *
149
142
  * @example
150
143
  * ```typescript
151
- * // Add stream for direct copy - uses input stream's timebase
152
- * const inputStream = input.video();
153
- * const streamIdx = output.addStream(inputStream);
144
+ * // Add stream from encoder
145
+ * const videoIdx = output.addStream(videoEncoder);
146
+ * const audioIdx = output.addStream(audioEncoder);
154
147
  * ```
155
148
  *
156
149
  * @example
157
150
  * ```typescript
158
- * // Custom output timebase (e.g., for format requirements)
159
- * const streamIdx = output.addStream(encoder, {
160
- * timeBase: { num: 1, den: 90000 } // MPEG-TS standard
151
+ * // Stream copy with custom timebase
152
+ * const streamIdx = output.addStream(input.video(), {
153
+ * timeBase: { num: 1, den: 90000 }
161
154
  * });
162
- * // Packets from encoder will be automatically rescaled to 1/90000
163
155
  * ```
156
+ *
157
+ * @see {@link writePacket} For writing packets to streams
158
+ * @see {@link Encoder} For transcoding source
164
159
  */
165
160
  addStream(source: Encoder | Stream, options?: {
166
161
  timeBase?: IRational;
167
162
  }): number;
168
163
  /**
169
- * Writes a packet to the output container.
164
+ * Write a packet to the output.
170
165
  *
171
- * Writes an encoded packet to the specified stream.
172
- * Automatically sets the stream index on the packet.
166
+ * Writes muxed packet to the specified stream.
167
+ * Automatically handles timestamp rescaling.
168
+ * Must be called after writeHeader() and before writeTrailer().
173
169
  *
174
- * Uses av_interleaved_write_frame() internally.
170
+ * Direct mapping to av_interleaved_write_frame().
175
171
  *
176
172
  * @param packet - Packet to write
177
173
  * @param streamIndex - Target stream index
174
+ * @throws {Error} If stream invalid or called at wrong time
178
175
  *
179
- * @throws {Error} If header not written, trailer already written, or invalid stream
176
+ * @throws {FFmpegError} If write fails
180
177
  *
181
178
  * @example
182
179
  * ```typescript
183
- * const encoded = await encoder.encode(frame);
184
- * if (encoded) {
185
- * await output.writePacket(encoded, streamIdx);
186
- * encoded.free();
180
+ * // Write encoded packet
181
+ * const packet = await encoder.encode(frame);
182
+ * if (packet) {
183
+ * await output.writePacket(packet, videoIdx);
184
+ * packet.free();
187
185
  * }
188
186
  * ```
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * // Stream copy with packet processing
191
+ * for await (const packet of input.packets()) {
192
+ * if (packet.streamIndex === inputVideoIdx) {
193
+ * await output.writePacket(packet, outputVideoIdx);
194
+ * }
195
+ * packet.free();
196
+ * }
197
+ * ```
198
+ *
199
+ * @see {@link addStream} For adding streams
200
+ * @see {@link writeHeader} Must be called first
189
201
  */
190
202
  writePacket(packet: Packet, streamIndex: number): Promise<void>;
191
203
  /**
192
- * Writes the output file header.
204
+ * Write file header.
193
205
  *
194
- * Writes the container header with stream information.
195
- * Must be called before writing any packets.
206
+ * Writes format header with stream configuration.
207
+ * Must be called after adding all streams and before writing packets.
208
+ * Finalizes stream parameters and initializes muxer.
196
209
  *
197
- * Uses avformat_write_header() internally.
210
+ * Direct mapping to avformat_write_header().
198
211
  *
199
- * @param options - Optional header options (format-specific)
212
+ * @throws {Error} If already written or output closed
200
213
  *
201
- * @throws {Error} If header already written or output is closed
214
+ * @throws {FFmpegError} If write fails
202
215
  *
203
216
  * @example
204
217
  * ```typescript
218
+ * // Standard workflow
219
+ * const output = await MediaOutput.open('output.mp4');
220
+ * output.addStream(encoder);
205
221
  * await output.writeHeader();
222
+ * // Now ready to write packets
206
223
  * ```
224
+ *
225
+ * @see {@link addStream} Must add streams first
226
+ * @see {@link writePacket} Can write packets after
227
+ * @see {@link writeTrailer} Must call at end
207
228
  */
208
229
  writeHeader(): Promise<void>;
209
230
  /**
210
- * Writes the output file trailer.
231
+ * Write file trailer.
232
+ *
233
+ * Writes format trailer and finalizes the file.
234
+ * Must be called after all packets are written.
235
+ * Flushes any buffered data and updates file headers.
211
236
  *
212
- * Finalizes the output file with necessary metadata.
213
- * Should be called after all packets have been written.
237
+ * Direct mapping to av_write_trailer().
214
238
  *
215
- * Uses av_write_trailer() internally.
239
+ * @throws {Error} If header not written or already written
216
240
  *
217
- * @throws {Error} If header not written, trailer already written, or output is closed
241
+ * @throws {FFmpegError} If write fails
218
242
  *
219
243
  * @example
220
244
  * ```typescript
245
+ * // Finalize output
221
246
  * await output.writeTrailer();
247
+ * await output.close();
222
248
  * ```
249
+ *
250
+ * @see {@link writeHeader} Must be called first
251
+ * @see {@link close} For cleanup after trailer
223
252
  */
224
253
  writeTrailer(): Promise<void>;
225
254
  /**
226
- * Closes the output and releases all resources.
255
+ * Close media output and free resources.
227
256
  *
228
- * Writes trailer if needed, closes IO context, and frees format context.
257
+ * Writes trailer if needed and releases all resources.
229
258
  * Safe to call multiple times.
230
- *
231
- * Uses av_write_trailer(), avio_closep(), and avformat_free_context() internally.
259
+ * Automatically called by Symbol.asyncDispose.
232
260
  *
233
261
  * @example
234
262
  * ```typescript
235
- * await output.close();
263
+ * const output = await MediaOutput.open('output.mp4');
264
+ * try {
265
+ * // Use output
266
+ * } finally {
267
+ * await output.close();
268
+ * }
236
269
  * ```
270
+ *
271
+ * @see {@link Symbol.asyncDispose} For automatic cleanup
237
272
  */
238
273
  close(): Promise<void>;
239
274
  /**
240
- * Gets information about a specific stream.
275
+ * Get stream information.
276
+ *
277
+ * Returns internal stream info for the specified index.
278
+ *
279
+ * @param streamIndex - Stream index
280
+ * @returns Stream info or undefined
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * const info = output.getStreamInfo(0);
285
+ * console.log(`Stream 0 timebase: ${info?.timeBase.num}/${info?.timeBase.den}`);
286
+ * ```
241
287
  */
242
- getStreamInfo(streamIndex: number): StreamInfo | undefined;
288
+ getStreamInfo(streamIndex: number): StreamDescription | undefined;
243
289
  /**
244
- * Gets all stream indices.
290
+ * Get all stream indices.
291
+ *
292
+ * Returns array of all added stream indices.
293
+ *
294
+ * @returns Array of stream indices
295
+ *
296
+ * @example
297
+ * ```typescript
298
+ * const indices = output.getStreamIndices();
299
+ * console.log(`Output has ${indices.length} streams`);
300
+ * ```
245
301
  */
246
302
  getStreamIndices(): number[];
247
303
  /**
248
- * Checks if header has been written.
304
+ * Check if header has been written.
305
+ *
306
+ * @returns true if header written
307
+ *
308
+ * @example
309
+ * ```typescript
310
+ * if (!output.isHeaderWritten()) {
311
+ * await output.writeHeader();
312
+ * }
313
+ * ```
249
314
  */
250
315
  isHeaderWritten(): boolean;
251
316
  /**
252
- * Checks if trailer has been written.
317
+ * Check if trailer has been written.
318
+ *
319
+ * @returns true if trailer written
320
+ *
321
+ * @example
322
+ * ```typescript
323
+ * if (!output.isTrailerWritten()) {
324
+ * await output.writeTrailer();
325
+ * }
326
+ * ```
253
327
  */
254
328
  isTrailerWritten(): boolean;
255
329
  /**
256
- * Gets the underlying format context.
330
+ * Get underlying format context.
257
331
  *
258
- * For advanced use cases requiring direct format context access.
332
+ * Returns the internal format context for advanced operations.
333
+ *
334
+ * @returns Format context
335
+ *
336
+ * @internal
259
337
  */
260
338
  getFormatContext(): FormatContext;
261
339
  /**
262
- * AsyncDisposable implementation for using statement.
340
+ * Dispose of media output.
263
341
  *
264
- * Enables automatic resource cleanup with await using syntax.
342
+ * Implements AsyncDisposable interface for automatic cleanup.
343
+ * Equivalent to calling close().
265
344
  *
266
345
  * @example
267
346
  * ```typescript
268
- * await using output = await MediaOutput.open('output.mp4');
269
- * // Output automatically closes when scope ends
347
+ * {
348
+ * await using output = await MediaOutput.open('output.mp4');
349
+ * // Use output...
350
+ * } // Automatically closed
270
351
  * ```
352
+ *
353
+ * @see {@link close} For manual cleanup
271
354
  */
272
355
  [Symbol.asyncDispose](): Promise<void>;
273
356
  }
274
- export {};