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.
- package/README.md +51 -59
- package/dist/api/bitstream-filter.d.ts +183 -123
- package/dist/api/bitstream-filter.js +185 -127
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +282 -130
- package/dist/api/decoder.js +290 -142
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +249 -160
- package/dist/api/encoder.js +276 -207
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +1944 -96
- package/dist/api/filter-presets.js +2059 -105
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/filter.d.ts +264 -200
- package/dist/api/filter.js +269 -231
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +246 -117
- package/dist/api/hardware.js +440 -217
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +3 -3
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/io-stream.d.ts +65 -55
- package/dist/api/io-stream.js +43 -40
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/media-input.d.ts +242 -139
- package/dist/api/media-input.js +205 -103
- package/dist/api/media-input.js.map +1 -1
- package/dist/api/media-output.d.ts +208 -126
- package/dist/api/media-output.js +212 -126
- package/dist/api/media-output.js.map +1 -1
- package/dist/api/pipeline.d.ts +361 -38
- package/dist/api/pipeline.js +255 -14
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/types.d.ts +26 -187
- package/dist/api/utilities/audio-sample.d.ts +0 -8
- package/dist/api/utilities/audio-sample.js +0 -8
- package/dist/api/utilities/audio-sample.js.map +1 -1
- package/dist/api/utilities/channel-layout.d.ts +0 -8
- package/dist/api/utilities/channel-layout.js +0 -8
- package/dist/api/utilities/channel-layout.js.map +1 -1
- package/dist/api/utilities/image.d.ts +0 -8
- package/dist/api/utilities/image.js +0 -8
- package/dist/api/utilities/image.js.map +1 -1
- package/dist/api/utilities/index.d.ts +3 -3
- package/dist/api/utilities/index.js +3 -3
- package/dist/api/utilities/index.js.map +1 -1
- package/dist/api/utilities/media-type.d.ts +1 -9
- package/dist/api/utilities/media-type.js +1 -9
- package/dist/api/utilities/media-type.js.map +1 -1
- package/dist/api/utilities/pixel-format.d.ts +1 -9
- package/dist/api/utilities/pixel-format.js +1 -9
- package/dist/api/utilities/pixel-format.js.map +1 -1
- package/dist/api/utilities/sample-format.d.ts +1 -9
- package/dist/api/utilities/sample-format.js +1 -9
- package/dist/api/utilities/sample-format.js.map +1 -1
- package/dist/api/utilities/streaming.d.ts +0 -8
- package/dist/api/utilities/streaming.js +0 -8
- package/dist/api/utilities/streaming.js.map +1 -1
- package/dist/api/utilities/timestamp.d.ts +0 -8
- package/dist/api/utilities/timestamp.js +0 -8
- package/dist/api/utilities/timestamp.js.map +1 -1
- package/dist/api/utils.d.ts +1 -2
- package/dist/api/utils.js +11 -0
- package/dist/api/utils.js.map +1 -1
- package/dist/constants/constants.d.ts +1 -1
- package/dist/constants/constants.js +2 -0
- package/dist/constants/constants.js.map +1 -1
- package/dist/lib/audio-fifo.d.ts +127 -170
- package/dist/lib/audio-fifo.js +130 -173
- package/dist/lib/audio-fifo.js.map +1 -1
- package/dist/lib/binding.d.ts +1 -0
- package/dist/lib/binding.js +7 -0
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/bitstream-filter-context.d.ts +139 -184
- package/dist/lib/bitstream-filter-context.js +139 -188
- package/dist/lib/bitstream-filter-context.js.map +1 -1
- package/dist/lib/bitstream-filter.d.ts +68 -54
- package/dist/lib/bitstream-filter.js +68 -54
- package/dist/lib/bitstream-filter.js.map +1 -1
- package/dist/lib/codec-context.d.ts +316 -380
- package/dist/lib/codec-context.js +316 -381
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/codec-parameters.d.ts +160 -170
- package/dist/lib/codec-parameters.js +162 -172
- package/dist/lib/codec-parameters.js.map +1 -1
- package/dist/lib/codec-parser.d.ts +91 -104
- package/dist/lib/codec-parser.js +92 -103
- package/dist/lib/codec-parser.js.map +1 -1
- package/dist/lib/codec.d.ts +266 -283
- package/dist/lib/codec.js +270 -287
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/dictionary.d.ts +149 -203
- package/dist/lib/dictionary.js +158 -212
- package/dist/lib/dictionary.js.map +1 -1
- package/dist/lib/error.d.ts +96 -130
- package/dist/lib/error.js +98 -128
- package/dist/lib/error.js.map +1 -1
- package/dist/lib/filter-context.d.ts +284 -218
- package/dist/lib/filter-context.js +290 -227
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +251 -292
- package/dist/lib/filter-graph.js +253 -294
- package/dist/lib/filter-graph.js.map +1 -1
- package/dist/lib/filter-inout.d.ts +87 -95
- package/dist/lib/filter-inout.js +87 -95
- package/dist/lib/filter-inout.js.map +1 -1
- package/dist/lib/filter.d.ts +93 -111
- package/dist/lib/filter.js +93 -111
- package/dist/lib/filter.js.map +1 -1
- package/dist/lib/format-context.d.ts +320 -428
- package/dist/lib/format-context.js +313 -385
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +262 -405
- package/dist/lib/frame.js +263 -408
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-device-context.d.ts +149 -203
- package/dist/lib/hardware-device-context.js +149 -203
- package/dist/lib/hardware-device-context.js.map +1 -1
- package/dist/lib/hardware-frames-context.d.ts +170 -180
- package/dist/lib/hardware-frames-context.js +171 -181
- package/dist/lib/hardware-frames-context.js.map +1 -1
- package/dist/lib/index.d.ts +3 -2
- package/dist/lib/index.js +3 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/input-format.d.ts +89 -117
- package/dist/lib/input-format.js +89 -117
- package/dist/lib/input-format.js.map +1 -1
- package/dist/lib/io-context.d.ts +209 -241
- package/dist/lib/io-context.js +220 -252
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/log.d.ts +85 -119
- package/dist/lib/log.js +85 -122
- package/dist/lib/log.js.map +1 -1
- package/dist/lib/native-types.d.ts +118 -106
- package/dist/lib/native-types.js +0 -7
- package/dist/lib/native-types.js.map +1 -1
- package/dist/lib/option.d.ts +437 -218
- package/dist/lib/option.js +462 -226
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/output-format.d.ts +77 -101
- package/dist/lib/output-format.js +77 -101
- package/dist/lib/output-format.js.map +1 -1
- package/dist/lib/packet.d.ts +172 -240
- package/dist/lib/packet.js +172 -241
- package/dist/lib/packet.js.map +1 -1
- package/dist/lib/rational.d.ts +0 -2
- package/dist/lib/rational.js +0 -2
- package/dist/lib/rational.js.map +1 -1
- package/dist/lib/software-resample-context.d.ts +241 -325
- package/dist/lib/software-resample-context.js +242 -326
- package/dist/lib/software-resample-context.js.map +1 -1
- package/dist/lib/software-scale-context.d.ts +129 -173
- package/dist/lib/software-scale-context.js +131 -175
- package/dist/lib/software-scale-context.js.map +1 -1
- package/dist/lib/stream.d.ts +87 -197
- package/dist/lib/stream.js +87 -197
- package/dist/lib/stream.js.map +1 -1
- package/dist/lib/utilities.d.ts +435 -181
- package/dist/lib/utilities.js +438 -182
- package/dist/lib/utilities.js.map +1 -1
- package/install/check.js +0 -1
- package/install/ffmpeg.js +0 -11
- package/package.json +25 -18
- package/release_notes.md +24 -59
- package/CHANGELOG.md +0 -8
package/dist/lib/option.d.ts
CHANGED
|
@@ -1,501 +1,683 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Option - FFmpeg AVOption System Bindings
|
|
3
|
-
*
|
|
4
|
-
* Provides low-level access to FFmpeg's AVOption API for getting and setting
|
|
5
|
-
* options on various FFmpeg objects (CodecContext, FormatContext, FilterContext, etc).
|
|
6
|
-
*
|
|
7
|
-
* The AVOption API is FFmpeg's unified system for runtime configuration,
|
|
8
|
-
* allowing type-safe access to object properties with validation.
|
|
9
|
-
*
|
|
10
|
-
* @module lib/option
|
|
11
|
-
*/
|
|
12
1
|
import { Dictionary } from './dictionary.js';
|
|
13
2
|
import type { AVOptionFlag, AVOptionSearchFlags, AVOptionType, AVOptionTypeBinary, AVOptionTypeBinaryIntArray, AVOptionTypeBool, AVOptionTypeChLayout, AVOptionTypeColor, AVOptionTypeConst, AVOptionTypeDict, AVOptionTypeDouble, AVOptionTypeDuration, AVOptionTypeFlags, AVOptionTypeFloat, AVOptionTypeImageSize, AVOptionTypeInt, AVOptionTypeInt64, AVOptionTypePixelFmt, AVOptionTypeRational, AVOptionTypeSampleFmt, AVOptionTypeString, AVOptionTypeUint, AVOptionTypeUint64, AVOptionTypeVideoRate, AVPixelFormat, AVSampleFormat } from '../constants/index.js';
|
|
14
3
|
import type { OptionCapableObject } from './binding.js';
|
|
15
4
|
import type { NativeOption } from './native-types.js';
|
|
16
5
|
import type { ChannelLayout, IRational } from './types.js';
|
|
17
6
|
/**
|
|
18
|
-
*
|
|
7
|
+
* Option information descriptor.
|
|
8
|
+
*
|
|
9
|
+
* Describes a single option available on an FFmpeg object.
|
|
10
|
+
* Contains metadata about the option including name, type, default value,
|
|
11
|
+
* valid range, and documentation. Used to discover and validate options.
|
|
19
12
|
*
|
|
20
|
-
*
|
|
21
|
-
* Options are not created directly but retrieved through Option.next() or Option.find().
|
|
13
|
+
* Direct mapping to FFmpeg's AVOption.
|
|
22
14
|
*
|
|
23
15
|
* @example
|
|
24
16
|
* ```typescript
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
17
|
+
* import { Option } from 'node-av';
|
|
18
|
+
*
|
|
19
|
+
* // Get option info
|
|
20
|
+
* const optInfo = Option.find(obj, 'bitrate');
|
|
21
|
+
* if (optInfo) {
|
|
22
|
+
* console.log(`Option: ${optInfo.name}`);
|
|
23
|
+
* console.log(`Help: ${optInfo.help}`);
|
|
24
|
+
* console.log(`Type: ${optInfo.type}`);
|
|
25
|
+
* console.log(`Default: ${optInfo.defaultValue}`);
|
|
26
|
+
* console.log(`Range: ${optInfo.min} - ${optInfo.max}`);
|
|
29
27
|
* }
|
|
30
28
|
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see [AVOption](https://ffmpeg.org/doxygen/trunk/structAVOption.html) - FFmpeg Doxygen
|
|
31
31
|
*/
|
|
32
32
|
export declare class OptionInfo {
|
|
33
33
|
private native;
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* @param native - The native option instance
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
35
38
|
constructor(native: NativeOption);
|
|
36
39
|
/**
|
|
37
40
|
* Option name.
|
|
38
41
|
*
|
|
39
|
-
* The
|
|
42
|
+
* The name used to get/set this option.
|
|
43
|
+
*
|
|
44
|
+
* Direct mapping to AVOption->name.
|
|
40
45
|
*/
|
|
41
46
|
get name(): string | null;
|
|
42
47
|
/**
|
|
43
48
|
* Option help text.
|
|
44
49
|
*
|
|
45
|
-
* Human-readable description of the option.
|
|
50
|
+
* Human-readable description of the option's purpose.
|
|
51
|
+
*
|
|
52
|
+
* Direct mapping to AVOption->help.
|
|
46
53
|
*/
|
|
47
54
|
get help(): string | null;
|
|
48
55
|
/**
|
|
49
56
|
* Option type.
|
|
50
57
|
*
|
|
51
|
-
*
|
|
58
|
+
* Data type of the option value (AV_OPT_TYPE_*).
|
|
59
|
+
*
|
|
60
|
+
* Direct mapping to AVOption->type.
|
|
52
61
|
*/
|
|
53
62
|
get type(): AVOptionType;
|
|
54
63
|
/**
|
|
55
64
|
* Default value.
|
|
56
65
|
*
|
|
57
|
-
* The value
|
|
66
|
+
* The default value for this option.
|
|
58
67
|
* Type depends on the option type.
|
|
68
|
+
*
|
|
69
|
+
* Direct mapping to AVOption->default_val.
|
|
59
70
|
*/
|
|
60
71
|
get defaultValue(): unknown;
|
|
61
72
|
/**
|
|
62
73
|
* Minimum value.
|
|
63
74
|
*
|
|
64
|
-
*
|
|
75
|
+
* Minimum valid value for numeric options.
|
|
76
|
+
*
|
|
77
|
+
* Direct mapping to AVOption->min.
|
|
65
78
|
*/
|
|
66
79
|
get min(): number;
|
|
67
80
|
/**
|
|
68
81
|
* Maximum value.
|
|
69
82
|
*
|
|
70
|
-
*
|
|
83
|
+
* Maximum valid value for numeric options.
|
|
84
|
+
*
|
|
85
|
+
* Direct mapping to AVOption->max.
|
|
71
86
|
*/
|
|
72
87
|
get max(): number;
|
|
73
88
|
/**
|
|
74
89
|
* Option flags.
|
|
75
90
|
*
|
|
76
|
-
*
|
|
91
|
+
* Combination of AV_OPT_FLAG_* indicating option properties.
|
|
92
|
+
*
|
|
93
|
+
* Direct mapping to AVOption->flags.
|
|
77
94
|
*/
|
|
78
95
|
get flags(): AVOptionFlag;
|
|
79
96
|
/**
|
|
80
97
|
* Option unit.
|
|
81
98
|
*
|
|
82
|
-
*
|
|
99
|
+
* Unit string for grouping related options.
|
|
100
|
+
*
|
|
101
|
+
* Direct mapping to AVOption->unit.
|
|
83
102
|
*/
|
|
84
103
|
get unit(): string | null;
|
|
85
104
|
/**
|
|
86
|
-
* Get the native
|
|
105
|
+
* Get the underlying native Option object.
|
|
87
106
|
*
|
|
88
|
-
* @
|
|
89
|
-
*
|
|
107
|
+
* @returns The native Option binding object
|
|
108
|
+
*
|
|
109
|
+
* @internal
|
|
90
110
|
*/
|
|
91
111
|
getNative(): NativeOption;
|
|
92
112
|
}
|
|
93
113
|
/**
|
|
94
|
-
*
|
|
114
|
+
* FFmpeg option management utilities.
|
|
95
115
|
*
|
|
96
|
-
* Provides static methods for
|
|
97
|
-
*
|
|
116
|
+
* Provides static methods for getting, setting, and querying options
|
|
117
|
+
* on FFmpeg objects that support the AVOption API. Handles type conversion
|
|
118
|
+
* and validation for various option types including strings, numbers,
|
|
119
|
+
* rationals, pixel formats, and more.
|
|
98
120
|
*
|
|
99
|
-
*
|
|
121
|
+
* Direct mapping to FFmpeg's AVOption API.
|
|
100
122
|
*
|
|
101
123
|
* @example
|
|
102
124
|
* ```typescript
|
|
103
|
-
*
|
|
104
|
-
*
|
|
125
|
+
* import { Option, FFmpegError } from 'node-av';
|
|
126
|
+
* import { AV_OPT_SEARCH_CHILDREN, AV_PIX_FMT_YUV420P } from 'node-av/constants';
|
|
127
|
+
*
|
|
128
|
+
* // Set various option types
|
|
129
|
+
* let ret = Option.set(obj, 'preset', 'fast');
|
|
130
|
+
* FFmpegError.throwIfError(ret, 'set preset');
|
|
105
131
|
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
132
|
+
* ret = Option.setInt(obj, 'bitrate', 2000000);
|
|
133
|
+
* FFmpegError.throwIfError(ret, 'set bitrate');
|
|
108
134
|
*
|
|
109
|
-
*
|
|
135
|
+
* ret = Option.setRational(obj, 'framerate', { num: 30, den: 1 });
|
|
136
|
+
* FFmpegError.throwIfError(ret, 'set framerate');
|
|
137
|
+
*
|
|
138
|
+
* // Get option values
|
|
139
|
+
* const preset = Option.get(obj, 'preset');
|
|
140
|
+
* const bitrate = Option.getInt(obj, 'bitrate');
|
|
141
|
+
* const framerate = Option.getRational(obj, 'framerate');
|
|
142
|
+
*
|
|
143
|
+
* // List all options
|
|
110
144
|
* let opt = null;
|
|
111
|
-
* while ((opt = Option.next(
|
|
145
|
+
* while ((opt = Option.next(obj, opt))) {
|
|
112
146
|
* console.log(`${opt.name}: ${opt.help}`);
|
|
113
147
|
* }
|
|
114
148
|
* ```
|
|
149
|
+
*
|
|
150
|
+
* @see [AVOption API](https://ffmpeg.org/doxygen/trunk/group__avoptions.html) - FFmpeg Doxygen
|
|
151
|
+
* @see {@link OptionMember} For inherited option support
|
|
115
152
|
*/
|
|
116
153
|
export declare class Option {
|
|
117
|
-
private constructor();
|
|
118
154
|
/**
|
|
119
|
-
* Iterate
|
|
155
|
+
* Iterate to next option.
|
|
120
156
|
*
|
|
121
|
-
*
|
|
157
|
+
* Iterates through available options on an object.
|
|
122
158
|
*
|
|
123
|
-
*
|
|
124
|
-
* @param prev - Previous option for iteration, or null to start
|
|
159
|
+
* Direct mapping to av_opt_next().
|
|
125
160
|
*
|
|
126
|
-
* @
|
|
161
|
+
* @param obj - Object with options
|
|
162
|
+
* @param prev - Previous option (null to get first)
|
|
163
|
+
* @returns Next option, or null if no more
|
|
127
164
|
*
|
|
128
165
|
* @example
|
|
129
166
|
* ```typescript
|
|
130
167
|
* let opt = null;
|
|
131
|
-
* while ((opt = Option.next(
|
|
132
|
-
* console.log(
|
|
168
|
+
* while ((opt = Option.next(obj, opt))) {
|
|
169
|
+
* console.log(`Option: ${opt.name}`);
|
|
133
170
|
* }
|
|
134
171
|
* ```
|
|
135
172
|
*/
|
|
136
173
|
static next(obj: OptionCapableObject, prev?: OptionInfo | null): OptionInfo | null;
|
|
137
174
|
/**
|
|
138
|
-
* Find
|
|
175
|
+
* Find option by name.
|
|
139
176
|
*
|
|
140
|
-
*
|
|
177
|
+
* Searches for an option with the specified name.
|
|
141
178
|
*
|
|
142
|
-
*
|
|
143
|
-
* @param name - Option name to find
|
|
144
|
-
* @param searchFlags - Search flags (default: 0)
|
|
179
|
+
* Direct mapping to av_opt_find().
|
|
145
180
|
*
|
|
146
|
-
* @
|
|
181
|
+
* @param obj - Object to search
|
|
182
|
+
* @param name - Option name
|
|
183
|
+
* @param searchFlags - Search flags
|
|
184
|
+
* @returns Option info if found, null otherwise
|
|
147
185
|
*
|
|
148
186
|
* @example
|
|
149
187
|
* ```typescript
|
|
150
|
-
* const opt = Option.find(
|
|
188
|
+
* const opt = Option.find(obj, 'bitrate');
|
|
151
189
|
* if (opt) {
|
|
152
|
-
* console.log(`Found
|
|
190
|
+
* console.log(`Found: ${opt.name}, Type: ${opt.type}`);
|
|
153
191
|
* }
|
|
154
192
|
* ```
|
|
155
193
|
*/
|
|
156
194
|
static find(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): OptionInfo | null;
|
|
157
195
|
/**
|
|
158
|
-
* Find
|
|
196
|
+
* Find option with target info.
|
|
197
|
+
*
|
|
198
|
+
* Like find() but also indicates if option was found on different target.
|
|
159
199
|
*
|
|
160
|
-
*
|
|
200
|
+
* Direct mapping to av_opt_find2().
|
|
161
201
|
*
|
|
162
|
-
* @param obj -
|
|
163
|
-
* @param name - Option name
|
|
164
|
-
* @param searchFlags - Search flags
|
|
202
|
+
* @param obj - Object to search
|
|
203
|
+
* @param name - Option name
|
|
204
|
+
* @param searchFlags - Search flags
|
|
205
|
+
* @returns Object with option and target info
|
|
165
206
|
*
|
|
166
|
-
* @
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const result = Option.find2(obj, 'bitrate', AV_OPT_SEARCH_CHILDREN);
|
|
210
|
+
* if (result?.option) {
|
|
211
|
+
* console.log(`Found on ${result.isDifferentTarget ? 'child' : 'object'}`);
|
|
212
|
+
* }
|
|
213
|
+
* ```
|
|
167
214
|
*/
|
|
168
215
|
static find2(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): {
|
|
169
216
|
option: OptionInfo | null;
|
|
170
217
|
isDifferentTarget: boolean;
|
|
171
218
|
} | null;
|
|
172
219
|
/**
|
|
173
|
-
* Get option value
|
|
220
|
+
* Get string option value.
|
|
174
221
|
*
|
|
175
|
-
*
|
|
176
|
-
* Converts any option type to its string representation.
|
|
222
|
+
* Direct mapping to av_opt_get().
|
|
177
223
|
*
|
|
178
|
-
* @param obj -
|
|
224
|
+
* @param obj - Object to query
|
|
179
225
|
* @param name - Option name
|
|
180
|
-
* @param searchFlags - Search flags
|
|
226
|
+
* @param searchFlags - Search flags
|
|
227
|
+
* @returns Option value as string, or null
|
|
181
228
|
*
|
|
182
|
-
* @
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* // Get codec preset option
|
|
232
|
+
* const preset = Option.get(codecContext, 'preset', AV_OPT_SEARCH_CHILDREN);
|
|
233
|
+
* console.log('Codec preset:', preset); // 'medium', 'fast', etc.
|
|
234
|
+
* ```
|
|
183
235
|
*/
|
|
184
236
|
static get(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): string | null;
|
|
185
237
|
/**
|
|
186
|
-
* Get option value
|
|
238
|
+
* Get integer option value.
|
|
187
239
|
*
|
|
188
|
-
*
|
|
189
|
-
* Option must be of integer type.
|
|
240
|
+
* Direct mapping to av_opt_get_int().
|
|
190
241
|
*
|
|
191
|
-
* @param obj -
|
|
242
|
+
* @param obj - Object to query
|
|
192
243
|
* @param name - Option name
|
|
193
|
-
* @param searchFlags - Search flags
|
|
244
|
+
* @param searchFlags - Search flags
|
|
245
|
+
* @returns Option value as integer, or null
|
|
194
246
|
*
|
|
195
|
-
* @
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* // Get codec GOP size
|
|
250
|
+
* const gopSize = Option.getInt(codecContext, 'g', AV_OPT_SEARCH_CHILDREN);
|
|
251
|
+
* console.log('GOP size:', gopSize); // 60, 120, etc.
|
|
252
|
+
* ```
|
|
196
253
|
*/
|
|
197
254
|
static getInt(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
|
|
198
255
|
/**
|
|
199
|
-
* Get option value
|
|
256
|
+
* Get double option value.
|
|
200
257
|
*
|
|
201
|
-
*
|
|
202
|
-
* Option must be of double/float type.
|
|
258
|
+
* Direct mapping to av_opt_get_double().
|
|
203
259
|
*
|
|
204
|
-
* @param obj -
|
|
260
|
+
* @param obj - Object to query
|
|
205
261
|
* @param name - Option name
|
|
206
|
-
* @param searchFlags - Search flags
|
|
262
|
+
* @param searchFlags - Search flags
|
|
263
|
+
* @returns Option value as double, or null
|
|
207
264
|
*
|
|
208
|
-
* @
|
|
265
|
+
* @example
|
|
266
|
+
* ```typescript
|
|
267
|
+
* // Get codec quality scale
|
|
268
|
+
* const crf = Option.getDouble(codecContext, 'crf', AV_OPT_SEARCH_CHILDREN);
|
|
269
|
+
* console.log('CRF value:', crf); // 23.0, 18.0, etc.
|
|
270
|
+
* ```
|
|
209
271
|
*/
|
|
210
272
|
static getDouble(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
|
|
211
273
|
/**
|
|
212
|
-
* Get option value
|
|
274
|
+
* Get rational option value.
|
|
213
275
|
*
|
|
214
|
-
*
|
|
215
|
-
* Option must be of rational type.
|
|
276
|
+
* Direct mapping to av_opt_get_q().
|
|
216
277
|
*
|
|
217
|
-
* @param obj -
|
|
278
|
+
* @param obj - Object to query
|
|
218
279
|
* @param name - Option name
|
|
219
|
-
* @param searchFlags - Search flags
|
|
280
|
+
* @param searchFlags - Search flags
|
|
281
|
+
* @returns Option value as rational, or null
|
|
220
282
|
*
|
|
221
|
-
* @
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* // Get codec time base
|
|
286
|
+
* const timeBase = Option.getRational(codecContext, 'time_base', AV_OPT_SEARCH_CHILDREN);
|
|
287
|
+
* console.log('Time base:', timeBase); // { num: 1, den: 30 }
|
|
288
|
+
* ```
|
|
222
289
|
*/
|
|
223
290
|
static getRational(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): IRational | null;
|
|
224
291
|
/**
|
|
225
|
-
* Get option value
|
|
292
|
+
* Get pixel format option value.
|
|
226
293
|
*
|
|
227
|
-
*
|
|
228
|
-
* Option must be of pixel format type.
|
|
294
|
+
* Direct mapping to av_opt_get_pixel_fmt().
|
|
229
295
|
*
|
|
230
|
-
* @param obj -
|
|
296
|
+
* @param obj - Object to query
|
|
231
297
|
* @param name - Option name
|
|
232
|
-
* @param searchFlags - Search flags
|
|
298
|
+
* @param searchFlags - Search flags
|
|
299
|
+
* @returns Pixel format value, or null
|
|
233
300
|
*
|
|
234
|
-
* @
|
|
301
|
+
* @example
|
|
302
|
+
* ```typescript
|
|
303
|
+
* // Get filter pixel format
|
|
304
|
+
* const pixFmt = Option.getPixelFormat(filterContext, 'pix_fmt', AV_OPT_SEARCH_CHILDREN);
|
|
305
|
+
* console.log('Pixel format:', pixFmt); // AV_PIX_FMT_YUV420P, etc.
|
|
306
|
+
* ```
|
|
235
307
|
*/
|
|
236
308
|
static getPixelFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVPixelFormat | null;
|
|
237
309
|
/**
|
|
238
|
-
* Get option value
|
|
310
|
+
* Get sample format option value.
|
|
239
311
|
*
|
|
240
|
-
*
|
|
241
|
-
* Option must be of sample format type.
|
|
312
|
+
* Direct mapping to av_opt_get_sample_fmt().
|
|
242
313
|
*
|
|
243
|
-
* @param obj -
|
|
314
|
+
* @param obj - Object to query
|
|
244
315
|
* @param name - Option name
|
|
245
|
-
* @param searchFlags - Search flags
|
|
316
|
+
* @param searchFlags - Search flags
|
|
317
|
+
* @returns Sample format value, or null
|
|
246
318
|
*
|
|
247
|
-
* @
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* // Get audio codec sample format
|
|
322
|
+
* const sampleFmt = Option.getSampleFormat(codecContext, 'sample_fmt', AV_OPT_SEARCH_CHILDREN);
|
|
323
|
+
* console.log('Sample format:', sampleFmt); // AV_SAMPLE_FMT_FLTP, etc.
|
|
324
|
+
* ```
|
|
248
325
|
*/
|
|
249
326
|
static getSampleFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVSampleFormat | null;
|
|
250
327
|
/**
|
|
251
|
-
* Get option value
|
|
328
|
+
* Get image size option value.
|
|
252
329
|
*
|
|
253
|
-
*
|
|
254
|
-
* Option must be of image size type.
|
|
330
|
+
* Direct mapping to av_opt_get_image_size().
|
|
255
331
|
*
|
|
256
|
-
* @param obj -
|
|
332
|
+
* @param obj - Object to query
|
|
257
333
|
* @param name - Option name
|
|
258
|
-
* @param searchFlags - Search flags
|
|
334
|
+
* @param searchFlags - Search flags
|
|
335
|
+
* @returns Width and height, or null
|
|
259
336
|
*
|
|
260
|
-
* @
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* // Get filter output size
|
|
340
|
+
* const size = Option.getImageSize(filterContext, 'size', AV_OPT_SEARCH_CHILDREN);
|
|
341
|
+
* console.log('Output size:', size); // { width: 1920, height: 1080 }
|
|
342
|
+
* ```
|
|
261
343
|
*/
|
|
262
344
|
static getImageSize(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): {
|
|
263
345
|
width: number;
|
|
264
346
|
height: number;
|
|
265
347
|
} | null;
|
|
266
348
|
/**
|
|
267
|
-
* Get option value
|
|
349
|
+
* Get channel layout option value.
|
|
268
350
|
*
|
|
269
|
-
*
|
|
270
|
-
* Option must be of channel layout type.
|
|
351
|
+
* Direct mapping to av_opt_get_chlayout().
|
|
271
352
|
*
|
|
272
|
-
* @param obj -
|
|
353
|
+
* @param obj - Object to query
|
|
273
354
|
* @param name - Option name
|
|
274
|
-
* @param searchFlags - Search flags
|
|
355
|
+
* @param searchFlags - Search flags
|
|
356
|
+
* @returns Channel layout, or null
|
|
275
357
|
*
|
|
276
|
-
* @
|
|
358
|
+
* @example
|
|
359
|
+
* ```typescript
|
|
360
|
+
* // Get audio channel layout
|
|
361
|
+
* const layout = Option.getChannelLayout(codecContext, 'channel_layout', AV_OPT_SEARCH_CHILDREN);
|
|
362
|
+
* console.log('Channel layout:', layout); // stereo, 5.1, etc.
|
|
363
|
+
* ```
|
|
277
364
|
*/
|
|
278
365
|
static getChannelLayout(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): ChannelLayout | null;
|
|
279
366
|
/**
|
|
280
|
-
* Get option value
|
|
367
|
+
* Get dictionary option value.
|
|
281
368
|
*
|
|
282
|
-
*
|
|
283
|
-
* Option must be of dictionary type.
|
|
369
|
+
* Direct mapping to av_opt_get_dict_val().
|
|
284
370
|
*
|
|
285
|
-
* @param obj -
|
|
371
|
+
* @param obj - Object to query
|
|
286
372
|
* @param name - Option name
|
|
287
|
-
* @param searchFlags - Search flags
|
|
373
|
+
* @param searchFlags - Search flags
|
|
374
|
+
* @returns Dictionary value, or null
|
|
288
375
|
*
|
|
289
|
-
* @
|
|
376
|
+
* @example
|
|
377
|
+
* ```typescript
|
|
378
|
+
* // Get metadata dictionary
|
|
379
|
+
* const metadata = Option.getDict(formatContext, 'metadata', AV_OPT_SEARCH_CHILDREN);
|
|
380
|
+
* console.log('Metadata:', metadata?.get('title'));
|
|
381
|
+
* ```
|
|
290
382
|
*/
|
|
291
383
|
static getDict(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): Dictionary | null;
|
|
292
384
|
/**
|
|
293
|
-
* Set option value
|
|
385
|
+
* Set string option value.
|
|
294
386
|
*
|
|
295
|
-
*
|
|
296
|
-
* Can be used for any option type - FFmpeg will parse the string.
|
|
387
|
+
* Direct mapping to av_opt_set().
|
|
297
388
|
*
|
|
298
|
-
* @param obj -
|
|
389
|
+
* @param obj - Object to modify
|
|
299
390
|
* @param name - Option name
|
|
300
|
-
* @param value - String value
|
|
301
|
-
* @param searchFlags - Search flags
|
|
391
|
+
* @param value - String value
|
|
392
|
+
* @param searchFlags - Search flags
|
|
393
|
+
* @returns 0 on success, negative AVERROR on error
|
|
302
394
|
*
|
|
303
|
-
* @
|
|
395
|
+
* @example
|
|
396
|
+
* ```typescript
|
|
397
|
+
* // Set codec preset
|
|
398
|
+
* const ret = Option.set(codecContext, 'preset', 'fast', AV_OPT_SEARCH_CHILDREN);
|
|
399
|
+
* FFmpegError.throwIfError(ret, 'Failed to set preset');
|
|
400
|
+
* ```
|
|
304
401
|
*/
|
|
305
402
|
static set(obj: OptionCapableObject, name: string, value: string, searchFlags?: AVOptionSearchFlags): number;
|
|
306
403
|
/**
|
|
307
|
-
* Set option value
|
|
404
|
+
* Set integer option value.
|
|
308
405
|
*
|
|
309
|
-
*
|
|
310
|
-
* More efficient than set() for numeric options.
|
|
406
|
+
* Direct mapping to av_opt_set_int().
|
|
311
407
|
*
|
|
312
|
-
* @param obj -
|
|
408
|
+
* @param obj - Object to modify
|
|
313
409
|
* @param name - Option name
|
|
314
|
-
* @param value -
|
|
315
|
-
* @param searchFlags - Search flags
|
|
410
|
+
* @param value - Integer value
|
|
411
|
+
* @param searchFlags - Search flags
|
|
412
|
+
* @returns 0 on success, negative AVERROR on error
|
|
316
413
|
*
|
|
317
|
-
* @
|
|
414
|
+
* @example
|
|
415
|
+
* ```typescript
|
|
416
|
+
* // Set codec bitrate
|
|
417
|
+
* const ret = Option.setInt(codecContext, 'b', 2000000, AV_OPT_SEARCH_CHILDREN);
|
|
418
|
+
* FFmpegError.throwIfError(ret, 'Failed to set bitrate');
|
|
419
|
+
* ```
|
|
318
420
|
*/
|
|
319
421
|
static setInt(obj: OptionCapableObject, name: string, value: number | bigint, searchFlags?: AVOptionSearchFlags): number;
|
|
320
422
|
/**
|
|
321
|
-
* Set option value
|
|
423
|
+
* Set double option value.
|
|
322
424
|
*
|
|
323
|
-
*
|
|
324
|
-
* More efficient than set() for floating point options.
|
|
425
|
+
* Direct mapping to av_opt_set_double().
|
|
325
426
|
*
|
|
326
|
-
* @param obj -
|
|
427
|
+
* @param obj - Object to modify
|
|
327
428
|
* @param name - Option name
|
|
328
|
-
* @param value - Double value
|
|
329
|
-
* @param searchFlags - Search flags
|
|
429
|
+
* @param value - Double value
|
|
430
|
+
* @param searchFlags - Search flags
|
|
431
|
+
* @returns 0 on success, negative AVERROR on error
|
|
330
432
|
*
|
|
331
|
-
* @
|
|
433
|
+
* @example
|
|
434
|
+
* ```typescript
|
|
435
|
+
* // Set codec CRF value
|
|
436
|
+
* const ret = Option.setDouble(codecContext, 'crf', 23.0, AV_OPT_SEARCH_CHILDREN);
|
|
437
|
+
* FFmpegError.throwIfError(ret, 'Failed to set CRF');
|
|
438
|
+
* ```
|
|
332
439
|
*/
|
|
333
440
|
static setDouble(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
|
|
334
441
|
/**
|
|
335
|
-
* Set option value
|
|
442
|
+
* Set rational option value.
|
|
336
443
|
*
|
|
337
|
-
*
|
|
338
|
-
* For framerates, aspect ratios, time bases, etc.
|
|
444
|
+
* Direct mapping to av_opt_set_q().
|
|
339
445
|
*
|
|
340
|
-
* @param obj -
|
|
446
|
+
* @param obj - Object to modify
|
|
341
447
|
* @param name - Option name
|
|
342
|
-
* @param value - Rational
|
|
343
|
-
* @param searchFlags - Search flags
|
|
448
|
+
* @param value - Rational value
|
|
449
|
+
* @param searchFlags - Search flags
|
|
450
|
+
* @returns 0 on success, negative AVERROR on error
|
|
344
451
|
*
|
|
345
|
-
* @
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* // Set codec frame rate
|
|
455
|
+
* const ret = Option.setRational(codecContext, 'framerate', { num: 30, den: 1 }, AV_OPT_SEARCH_CHILDREN);
|
|
456
|
+
* FFmpegError.throwIfError(ret, 'Failed to set framerate');
|
|
457
|
+
* ```
|
|
346
458
|
*/
|
|
347
459
|
static setRational(obj: OptionCapableObject, name: string, value: IRational, searchFlags?: AVOptionSearchFlags): number;
|
|
348
460
|
/**
|
|
349
|
-
* Set option value
|
|
461
|
+
* Set pixel format option value.
|
|
350
462
|
*
|
|
351
|
-
*
|
|
352
|
-
* More type-safe than using set() with string names.
|
|
463
|
+
* Direct mapping to av_opt_set_pixel_fmt().
|
|
353
464
|
*
|
|
354
|
-
* @param obj -
|
|
465
|
+
* @param obj - Object to modify
|
|
355
466
|
* @param name - Option name
|
|
356
|
-
* @param value -
|
|
357
|
-
* @param searchFlags - Search flags
|
|
467
|
+
* @param value - Pixel format
|
|
468
|
+
* @param searchFlags - Search flags
|
|
469
|
+
* @returns 0 on success, negative AVERROR on error
|
|
358
470
|
*
|
|
359
|
-
* @
|
|
471
|
+
* @example
|
|
472
|
+
* ```typescript
|
|
473
|
+
* // Set filter pixel format
|
|
474
|
+
* const ret = Option.setPixelFormat(filterContext, 'pix_fmt', AV_PIX_FMT_YUV420P, AV_OPT_SEARCH_CHILDREN);
|
|
475
|
+
* FFmpegError.throwIfError(ret, 'Failed to set pixel format');
|
|
476
|
+
* ```
|
|
360
477
|
*/
|
|
361
478
|
static setPixelFormat(obj: OptionCapableObject, name: string, value: AVPixelFormat, searchFlags?: AVOptionSearchFlags): number;
|
|
362
479
|
/**
|
|
363
|
-
* Set option value
|
|
480
|
+
* Set sample format option value.
|
|
364
481
|
*
|
|
365
|
-
*
|
|
366
|
-
* More type-safe than using set() with string names.
|
|
482
|
+
* Direct mapping to av_opt_set_sample_fmt().
|
|
367
483
|
*
|
|
368
|
-
* @param obj -
|
|
484
|
+
* @param obj - Object to modify
|
|
369
485
|
* @param name - Option name
|
|
370
|
-
* @param value -
|
|
371
|
-
* @param searchFlags - Search flags
|
|
486
|
+
* @param value - Sample format
|
|
487
|
+
* @param searchFlags - Search flags
|
|
488
|
+
* @returns 0 on success, negative AVERROR on error
|
|
372
489
|
*
|
|
373
|
-
* @
|
|
490
|
+
* @example
|
|
491
|
+
* ```typescript
|
|
492
|
+
* // Set audio codec sample format
|
|
493
|
+
* const ret = Option.setSampleFormat(codecContext, 'sample_fmt', AV_SAMPLE_FMT_FLTP, AV_OPT_SEARCH_CHILDREN);
|
|
494
|
+
* FFmpegError.throwIfError(ret, 'Failed to set sample format');
|
|
495
|
+
* ```
|
|
374
496
|
*/
|
|
375
497
|
static setSampleFormat(obj: OptionCapableObject, name: string, value: AVSampleFormat, searchFlags?: AVOptionSearchFlags): number;
|
|
376
498
|
/**
|
|
377
|
-
* Set option value
|
|
499
|
+
* Set image size option value.
|
|
378
500
|
*
|
|
379
|
-
*
|
|
380
|
-
* Convenient for setting width and height together.
|
|
501
|
+
* Direct mapping to av_opt_set_image_size().
|
|
381
502
|
*
|
|
382
|
-
* @param obj -
|
|
503
|
+
* @param obj - Object to modify
|
|
383
504
|
* @param name - Option name
|
|
384
|
-
* @param width -
|
|
385
|
-
* @param height -
|
|
386
|
-
* @param searchFlags - Search flags
|
|
505
|
+
* @param width - Image width
|
|
506
|
+
* @param height - Image height
|
|
507
|
+
* @param searchFlags - Search flags
|
|
508
|
+
* @returns 0 on success, negative AVERROR on error
|
|
387
509
|
*
|
|
388
|
-
* @
|
|
510
|
+
* @example
|
|
511
|
+
* ```typescript
|
|
512
|
+
* // Set filter output size
|
|
513
|
+
* const ret = Option.setImageSize(filterContext, 'size', 1920, 1080, AV_OPT_SEARCH_CHILDREN);
|
|
514
|
+
* FFmpegError.throwIfError(ret, 'Failed to set image size');
|
|
515
|
+
* ```
|
|
389
516
|
*/
|
|
390
517
|
static setImageSize(obj: OptionCapableObject, name: string, width: number, height: number, searchFlags?: AVOptionSearchFlags): number;
|
|
391
518
|
/**
|
|
392
|
-
* Set option value
|
|
519
|
+
* Set channel layout option value.
|
|
393
520
|
*
|
|
394
|
-
*
|
|
395
|
-
* For audio channel configuration.
|
|
521
|
+
* Direct mapping to av_opt_set_chlayout().
|
|
396
522
|
*
|
|
397
|
-
* @param obj -
|
|
523
|
+
* @param obj - Object to modify
|
|
398
524
|
* @param name - Option name
|
|
399
|
-
* @param value - Channel layout
|
|
400
|
-
* @param searchFlags - Search flags
|
|
525
|
+
* @param value - Channel layout
|
|
526
|
+
* @param searchFlags - Search flags
|
|
527
|
+
* @returns 0 on success, negative AVERROR on error
|
|
401
528
|
*
|
|
402
|
-
* @
|
|
529
|
+
* @example
|
|
530
|
+
* ```typescript
|
|
531
|
+
* // Set audio channel layout to stereo
|
|
532
|
+
* const ret = Option.setChannelLayout(codecContext, 'channel_layout', AV_CHANNEL_LAYOUT_STEREO, AV_OPT_SEARCH_CHILDREN);
|
|
533
|
+
* FFmpegError.throwIfError(ret, 'Failed to set channel layout');
|
|
534
|
+
* ```
|
|
403
535
|
*/
|
|
404
536
|
static setChannelLayout(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
|
|
405
537
|
/**
|
|
406
|
-
* Set option value
|
|
538
|
+
* Set dictionary option value.
|
|
407
539
|
*
|
|
408
|
-
*
|
|
409
|
-
* For options that accept key-value pairs.
|
|
540
|
+
* Direct mapping to av_opt_set_dict_val().
|
|
410
541
|
*
|
|
411
|
-
* @param obj -
|
|
542
|
+
* @param obj - Object to modify
|
|
412
543
|
* @param name - Option name
|
|
413
|
-
* @param value - Dictionary
|
|
414
|
-
* @param searchFlags - Search flags
|
|
544
|
+
* @param value - Dictionary value
|
|
545
|
+
* @param searchFlags - Search flags
|
|
546
|
+
* @returns 0 on success, negative AVERROR on error
|
|
415
547
|
*
|
|
416
|
-
* @
|
|
548
|
+
* @example
|
|
549
|
+
* ```typescript
|
|
550
|
+
* // Set metadata dictionary
|
|
551
|
+
* const dict = new Dictionary();
|
|
552
|
+
* dict.set('title', 'My Video');
|
|
553
|
+
* const ret = Option.setDict(formatContext, 'metadata', dict, AV_OPT_SEARCH_CHILDREN);
|
|
554
|
+
* FFmpegError.throwIfError(ret, 'Failed to set metadata');
|
|
555
|
+
* ```
|
|
417
556
|
*/
|
|
418
557
|
static setDict(obj: OptionCapableObject, name: string, value: Dictionary, searchFlags?: AVOptionSearchFlags): number;
|
|
419
558
|
/**
|
|
420
|
-
* Set option value
|
|
559
|
+
* Set binary option value.
|
|
421
560
|
*
|
|
422
|
-
*
|
|
423
|
-
* For options that accept raw binary data.
|
|
561
|
+
* Direct mapping to av_opt_set_bin().
|
|
424
562
|
*
|
|
425
|
-
* @param obj -
|
|
563
|
+
* @param obj - Object to modify
|
|
426
564
|
* @param name - Option name
|
|
427
|
-
* @param value - Binary data
|
|
428
|
-
* @param searchFlags - Search flags
|
|
565
|
+
* @param value - Binary data
|
|
566
|
+
* @param searchFlags - Search flags
|
|
567
|
+
* @returns 0 on success, negative AVERROR on error
|
|
429
568
|
*
|
|
430
|
-
* @
|
|
569
|
+
* @example
|
|
570
|
+
* ```typescript
|
|
571
|
+
* // Set binary extradata
|
|
572
|
+
* const extradata = Buffer.from([0x00, 0x01, 0x02, 0x03]);
|
|
573
|
+
* const ret = Option.setBin(codecContext, 'extradata', extradata, AV_OPT_SEARCH_CHILDREN);
|
|
574
|
+
* FFmpegError.throwIfError(ret, 'Failed to set extradata');
|
|
575
|
+
* ```
|
|
431
576
|
*/
|
|
432
577
|
static setBin(obj: OptionCapableObject, name: string, value: Buffer, searchFlags?: AVOptionSearchFlags): number;
|
|
433
578
|
/**
|
|
434
|
-
* Set
|
|
579
|
+
* Set defaults on object.
|
|
580
|
+
*
|
|
581
|
+
* Sets all options to their default values.
|
|
435
582
|
*
|
|
436
|
-
*
|
|
583
|
+
* Direct mapping to av_opt_set_defaults().
|
|
437
584
|
*
|
|
438
|
-
* @param obj -
|
|
585
|
+
* @param obj - Object to reset
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* ```typescript
|
|
589
|
+
* // Reset all codec options to defaults
|
|
590
|
+
* Option.setDefaults(codecContext);
|
|
591
|
+
* ```
|
|
439
592
|
*/
|
|
440
593
|
static setDefaults(obj: OptionCapableObject): void;
|
|
441
594
|
/**
|
|
442
|
-
* Copy options
|
|
595
|
+
* Copy options between objects.
|
|
596
|
+
*
|
|
597
|
+
* Copies option values from source to destination.
|
|
443
598
|
*
|
|
444
|
-
*
|
|
445
|
-
* Copies all option values from one object to another.
|
|
599
|
+
* Direct mapping to av_opt_copy().
|
|
446
600
|
*
|
|
447
601
|
* @param dest - Destination object
|
|
448
602
|
* @param src - Source object
|
|
603
|
+
* @returns 0 on success, negative AVERROR on error
|
|
449
604
|
*
|
|
450
|
-
* @
|
|
605
|
+
* @example
|
|
606
|
+
* ```typescript
|
|
607
|
+
* // Copy options from one codec context to another
|
|
608
|
+
* const ret = Option.copy(destCodecContext, srcCodecContext);
|
|
609
|
+
* FFmpegError.throwIfError(ret, 'Failed to copy options');
|
|
610
|
+
* ```
|
|
451
611
|
*/
|
|
452
612
|
static copy(dest: OptionCapableObject, src: OptionCapableObject): number;
|
|
453
613
|
/**
|
|
454
|
-
* Check if option is set to
|
|
614
|
+
* Check if option is set to default.
|
|
455
615
|
*
|
|
456
|
-
*
|
|
616
|
+
* Direct mapping to av_opt_is_set_to_default().
|
|
457
617
|
*
|
|
458
|
-
* @param obj -
|
|
618
|
+
* @param obj - Object to check
|
|
459
619
|
* @param name - Option name
|
|
460
|
-
* @param searchFlags - Search flags
|
|
620
|
+
* @param searchFlags - Search flags
|
|
621
|
+
* @returns True if default, false if modified, null if not found
|
|
461
622
|
*
|
|
462
|
-
* @
|
|
623
|
+
* @example
|
|
624
|
+
* ```typescript
|
|
625
|
+
* // Check if bitrate is at default value
|
|
626
|
+
* const isDefault = Option.isSetToDefault(codecContext, 'b', AV_OPT_SEARCH_CHILDREN);
|
|
627
|
+
* console.log('Bitrate is default:', isDefault);
|
|
628
|
+
* ```
|
|
463
629
|
*/
|
|
464
630
|
static isSetToDefault(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): boolean | null;
|
|
465
631
|
/**
|
|
466
632
|
* Serialize options to string.
|
|
467
633
|
*
|
|
468
|
-
*
|
|
469
|
-
* Converts all non-default options to a string representation.
|
|
634
|
+
* Direct mapping to av_opt_serialize().
|
|
470
635
|
*
|
|
471
|
-
* @param obj -
|
|
472
|
-
* @param optFlags - Option flags
|
|
473
|
-
* @param flags - Serialization flags
|
|
474
|
-
* @param keyValSep - Key-value separator
|
|
475
|
-
* @param pairsSep - Pairs separator
|
|
636
|
+
* @param obj - Object to serialize
|
|
637
|
+
* @param optFlags - Option flags filter
|
|
638
|
+
* @param flags - Serialization flags
|
|
639
|
+
* @param keyValSep - Key-value separator
|
|
640
|
+
* @param pairsSep - Pairs separator
|
|
641
|
+
* @returns Serialized string, or null on error
|
|
476
642
|
*
|
|
477
|
-
* @
|
|
643
|
+
* @example
|
|
644
|
+
* ```typescript
|
|
645
|
+
* // Serialize codec options to string
|
|
646
|
+
* const serialized = Option.serialize(codecContext, 0, 0, '=', ':');
|
|
647
|
+
* console.log('Options:', serialized); // 'bitrate=2000000:preset=fast'
|
|
648
|
+
* ```
|
|
478
649
|
*/
|
|
479
650
|
static serialize(obj: OptionCapableObject, optFlags?: number, flags?: number, keyValSep?: string, pairsSep?: string): string | null;
|
|
480
651
|
/**
|
|
481
|
-
* Free
|
|
652
|
+
* Free option resources.
|
|
653
|
+
*
|
|
654
|
+
* Direct mapping to av_opt_free().
|
|
482
655
|
*
|
|
483
|
-
*
|
|
656
|
+
* @param obj - Object to free options from
|
|
484
657
|
*
|
|
485
|
-
* @
|
|
658
|
+
* @example
|
|
659
|
+
* ```typescript
|
|
660
|
+
* // Free codec context options
|
|
661
|
+
* Option.free(codecContext);
|
|
662
|
+
* ```
|
|
486
663
|
*/
|
|
487
664
|
static free(obj: OptionCapableObject): void;
|
|
488
665
|
/**
|
|
489
|
-
* Show options
|
|
666
|
+
* Show options for debugging.
|
|
490
667
|
*
|
|
491
|
-
*
|
|
492
|
-
* Prints all available options to stderr.
|
|
668
|
+
* Direct mapping to av_opt_show2().
|
|
493
669
|
*
|
|
494
|
-
* @param obj -
|
|
495
|
-
* @param reqFlags - Required flags
|
|
496
|
-
* @param rejFlags - Rejected flags
|
|
670
|
+
* @param obj - Object to show options for
|
|
671
|
+
* @param reqFlags - Required flags
|
|
672
|
+
* @param rejFlags - Rejected flags
|
|
673
|
+
* @returns 0 on success, negative AVERROR on error
|
|
497
674
|
*
|
|
498
|
-
* @
|
|
675
|
+
* @example
|
|
676
|
+
* ```typescript
|
|
677
|
+
* // Show all codec options for debugging
|
|
678
|
+
* const ret = Option.show(codecContext, 0, 0);
|
|
679
|
+
* FFmpegError.throwIfError(ret, 'Failed to show options');
|
|
680
|
+
* ```
|
|
499
681
|
*/
|
|
500
682
|
static show(obj: OptionCapableObject, reqFlags?: number, rejFlags?: number): number;
|
|
501
683
|
}
|
|
@@ -513,10 +695,42 @@ export declare class Option {
|
|
|
513
695
|
*
|
|
514
696
|
* @example
|
|
515
697
|
* ```typescript
|
|
698
|
+
* import { OptionMember, FFmpegError } from 'node-av';
|
|
699
|
+
* import { AV_OPT_TYPE_INT, AV_OPT_TYPE_STRING, AV_OPT_TYPE_RATIONAL } from 'node-av/constants';
|
|
700
|
+
*
|
|
516
701
|
* class CodecContext extends OptionMember<NativeCodecContext> {
|
|
517
|
-
*
|
|
702
|
+
* constructor(native: NativeCodecContext) {
|
|
703
|
+
* super(native);
|
|
704
|
+
* }
|
|
705
|
+
* }
|
|
706
|
+
*
|
|
707
|
+
* // Use inherited methods
|
|
708
|
+
* const codec = new CodecContext(native);
|
|
709
|
+
*
|
|
710
|
+
* // Set options with automatic type handling
|
|
711
|
+
* let ret = codec.setOption('preset', 'fast');
|
|
712
|
+
* FFmpegError.throwIfError(ret, 'set preset');
|
|
713
|
+
*
|
|
714
|
+
* ret = codec.setOption('bitrate', 2000000, AV_OPT_TYPE_INT);
|
|
715
|
+
* FFmpegError.throwIfError(ret, 'set bitrate');
|
|
716
|
+
*
|
|
717
|
+
* ret = codec.setOption('framerate', { num: 30, den: 1 }, AV_OPT_TYPE_RATIONAL);
|
|
718
|
+
* FFmpegError.throwIfError(ret, 'set framerate');
|
|
719
|
+
*
|
|
720
|
+
* // Get typed options
|
|
721
|
+
* const preset = codec.getOption('preset');
|
|
722
|
+
* const bitrate = codec.getOption('bitrate', AV_OPT_TYPE_INT);
|
|
723
|
+
* const framerate = codec.getOption('framerate', AV_OPT_TYPE_RATIONAL);
|
|
724
|
+
*
|
|
725
|
+
* // List all available options
|
|
726
|
+
* const options = codec.listOptions();
|
|
727
|
+
* for (const opt of options) {
|
|
728
|
+
* console.log(`${opt.name}: ${opt.help}`);
|
|
518
729
|
* }
|
|
519
730
|
* ```
|
|
731
|
+
*
|
|
732
|
+
* @see {@link Option} For static option methods
|
|
733
|
+
* @see {@link OptionInfo} For option metadata
|
|
520
734
|
*/
|
|
521
735
|
export declare class OptionMember<T extends OptionCapableObject> {
|
|
522
736
|
protected native: T;
|
|
@@ -574,6 +788,8 @@ export declare class OptionMember<T extends OptionCapableObject> {
|
|
|
574
788
|
* Uses the AVOption API to enumerate all options.
|
|
575
789
|
* Useful for discovering available settings and their types.
|
|
576
790
|
*
|
|
791
|
+
* Direct mapping to av_opt_next() iteration.
|
|
792
|
+
*
|
|
577
793
|
* @returns Array of option information objects
|
|
578
794
|
*
|
|
579
795
|
* @example
|
|
@@ -582,8 +798,11 @@ export declare class OptionMember<T extends OptionCapableObject> {
|
|
|
582
798
|
* for (const opt of options) {
|
|
583
799
|
* console.log(`${opt.name}: ${opt.help}`);
|
|
584
800
|
* console.log(` Type: ${opt.type}, Default: ${opt.defaultValue}`);
|
|
801
|
+
* console.log(` Range: ${opt.min} - ${opt.max}`);
|
|
585
802
|
* }
|
|
586
803
|
* ```
|
|
804
|
+
*
|
|
805
|
+
* @see {@link OptionInfo} For option metadata structure
|
|
587
806
|
*/
|
|
588
807
|
listOptions(): OptionInfo[];
|
|
589
808
|
}
|