@revizly/node-av 5.2.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUILD_LINUX.md +61 -0
- package/LICENSE.md +22 -0
- package/README.md +662 -0
- package/build_mac_local.sh +69 -0
- package/dist/api/audio-frame-buffer.d.ts +205 -0
- package/dist/api/audio-frame-buffer.js +287 -0
- package/dist/api/audio-frame-buffer.js.map +1 -0
- package/dist/api/bitstream-filter.d.ts +820 -0
- package/dist/api/bitstream-filter.js +1242 -0
- package/dist/api/bitstream-filter.js.map +1 -0
- package/dist/api/constants.d.ts +44 -0
- package/dist/api/constants.js +45 -0
- package/dist/api/constants.js.map +1 -0
- package/dist/api/data/test_av1.ivf +0 -0
- package/dist/api/data/test_h264.h264 +0 -0
- package/dist/api/data/test_hevc.h265 +0 -0
- package/dist/api/data/test_mjpeg.mjpeg +0 -0
- package/dist/api/data/test_vp8.ivf +0 -0
- package/dist/api/data/test_vp9.ivf +0 -0
- package/dist/api/decoder.d.ts +1088 -0
- package/dist/api/decoder.js +1775 -0
- package/dist/api/decoder.js.map +1 -0
- package/dist/api/demuxer.d.ts +1219 -0
- package/dist/api/demuxer.js +2081 -0
- package/dist/api/demuxer.js.map +1 -0
- package/dist/api/device.d.ts +586 -0
- package/dist/api/device.js +961 -0
- package/dist/api/device.js.map +1 -0
- package/dist/api/encoder.d.ts +1132 -0
- package/dist/api/encoder.js +1988 -0
- package/dist/api/encoder.js.map +1 -0
- package/dist/api/filter-complex.d.ts +821 -0
- package/dist/api/filter-complex.js +1604 -0
- package/dist/api/filter-complex.js.map +1 -0
- package/dist/api/filter-presets.d.ts +1286 -0
- package/dist/api/filter-presets.js +2152 -0
- package/dist/api/filter-presets.js.map +1 -0
- package/dist/api/filter.d.ts +1234 -0
- package/dist/api/filter.js +1976 -0
- package/dist/api/filter.js.map +1 -0
- package/dist/api/fmp4-stream.d.ts +426 -0
- package/dist/api/fmp4-stream.js +739 -0
- package/dist/api/fmp4-stream.js.map +1 -0
- package/dist/api/hardware.d.ts +651 -0
- package/dist/api/hardware.js +1260 -0
- package/dist/api/hardware.js.map +1 -0
- package/dist/api/index.d.ts +17 -0
- package/dist/api/index.js +32 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/io-stream.d.ts +307 -0
- package/dist/api/io-stream.js +282 -0
- package/dist/api/io-stream.js.map +1 -0
- package/dist/api/muxer.d.ts +957 -0
- package/dist/api/muxer.js +2002 -0
- package/dist/api/muxer.js.map +1 -0
- package/dist/api/pipeline.d.ts +607 -0
- package/dist/api/pipeline.js +1145 -0
- package/dist/api/pipeline.js.map +1 -0
- package/dist/api/utilities/async-queue.d.ts +120 -0
- package/dist/api/utilities/async-queue.js +211 -0
- package/dist/api/utilities/async-queue.js.map +1 -0
- package/dist/api/utilities/audio-sample.d.ts +117 -0
- package/dist/api/utilities/audio-sample.js +112 -0
- package/dist/api/utilities/audio-sample.js.map +1 -0
- package/dist/api/utilities/channel-layout.d.ts +76 -0
- package/dist/api/utilities/channel-layout.js +80 -0
- package/dist/api/utilities/channel-layout.js.map +1 -0
- package/dist/api/utilities/electron-shared-texture.d.ts +328 -0
- package/dist/api/utilities/electron-shared-texture.js +503 -0
- package/dist/api/utilities/electron-shared-texture.js.map +1 -0
- package/dist/api/utilities/image.d.ts +207 -0
- package/dist/api/utilities/image.js +213 -0
- package/dist/api/utilities/image.js.map +1 -0
- package/dist/api/utilities/index.d.ts +12 -0
- package/dist/api/utilities/index.js +25 -0
- package/dist/api/utilities/index.js.map +1 -0
- package/dist/api/utilities/media-type.d.ts +49 -0
- package/dist/api/utilities/media-type.js +53 -0
- package/dist/api/utilities/media-type.js.map +1 -0
- package/dist/api/utilities/pixel-format.d.ts +89 -0
- package/dist/api/utilities/pixel-format.js +97 -0
- package/dist/api/utilities/pixel-format.js.map +1 -0
- package/dist/api/utilities/sample-format.d.ts +129 -0
- package/dist/api/utilities/sample-format.js +141 -0
- package/dist/api/utilities/sample-format.js.map +1 -0
- package/dist/api/utilities/scheduler.d.ts +138 -0
- package/dist/api/utilities/scheduler.js +98 -0
- package/dist/api/utilities/scheduler.js.map +1 -0
- package/dist/api/utilities/streaming.d.ts +186 -0
- package/dist/api/utilities/streaming.js +309 -0
- package/dist/api/utilities/streaming.js.map +1 -0
- package/dist/api/utilities/timestamp.d.ts +193 -0
- package/dist/api/utilities/timestamp.js +206 -0
- package/dist/api/utilities/timestamp.js.map +1 -0
- package/dist/api/utilities/whisper-model.d.ts +310 -0
- package/dist/api/utilities/whisper-model.js +528 -0
- package/dist/api/utilities/whisper-model.js.map +1 -0
- package/dist/api/utils.d.ts +19 -0
- package/dist/api/utils.js +39 -0
- package/dist/api/utils.js.map +1 -0
- package/dist/api/whisper.d.ts +324 -0
- package/dist/api/whisper.js +362 -0
- package/dist/api/whisper.js.map +1 -0
- package/dist/constants/channel-layouts.d.ts +53 -0
- package/dist/constants/channel-layouts.js +57 -0
- package/dist/constants/channel-layouts.js.map +1 -0
- package/dist/constants/constants.d.ts +2325 -0
- package/dist/constants/constants.js +1887 -0
- package/dist/constants/constants.js.map +1 -0
- package/dist/constants/decoders.d.ts +633 -0
- package/dist/constants/decoders.js +641 -0
- package/dist/constants/decoders.js.map +1 -0
- package/dist/constants/encoders.d.ts +295 -0
- package/dist/constants/encoders.js +308 -0
- package/dist/constants/encoders.js.map +1 -0
- package/dist/constants/hardware.d.ts +26 -0
- package/dist/constants/hardware.js +27 -0
- package/dist/constants/hardware.js.map +1 -0
- package/dist/constants/index.d.ts +5 -0
- package/dist/constants/index.js +6 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/ffmpeg/index.d.ts +99 -0
- package/dist/ffmpeg/index.js +115 -0
- package/dist/ffmpeg/index.js.map +1 -0
- package/dist/ffmpeg/utils.d.ts +31 -0
- package/dist/ffmpeg/utils.js +68 -0
- package/dist/ffmpeg/utils.js.map +1 -0
- package/dist/ffmpeg/version.d.ts +6 -0
- package/dist/ffmpeg/version.js +7 -0
- package/dist/ffmpeg/version.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/audio-fifo.d.ts +399 -0
- package/dist/lib/audio-fifo.js +431 -0
- package/dist/lib/audio-fifo.js.map +1 -0
- package/dist/lib/binding.d.ts +228 -0
- package/dist/lib/binding.js +60 -0
- package/dist/lib/binding.js.map +1 -0
- package/dist/lib/bitstream-filter-context.d.ts +379 -0
- package/dist/lib/bitstream-filter-context.js +441 -0
- package/dist/lib/bitstream-filter-context.js.map +1 -0
- package/dist/lib/bitstream-filter.d.ts +140 -0
- package/dist/lib/bitstream-filter.js +154 -0
- package/dist/lib/bitstream-filter.js.map +1 -0
- package/dist/lib/codec-context.d.ts +1071 -0
- package/dist/lib/codec-context.js +1354 -0
- package/dist/lib/codec-context.js.map +1 -0
- package/dist/lib/codec-parameters.d.ts +616 -0
- package/dist/lib/codec-parameters.js +761 -0
- package/dist/lib/codec-parameters.js.map +1 -0
- package/dist/lib/codec-parser.d.ts +201 -0
- package/dist/lib/codec-parser.js +213 -0
- package/dist/lib/codec-parser.js.map +1 -0
- package/dist/lib/codec.d.ts +586 -0
- package/dist/lib/codec.js +713 -0
- package/dist/lib/codec.js.map +1 -0
- package/dist/lib/device.d.ts +291 -0
- package/dist/lib/device.js +324 -0
- package/dist/lib/device.js.map +1 -0
- package/dist/lib/dictionary.d.ts +333 -0
- package/dist/lib/dictionary.js +372 -0
- package/dist/lib/dictionary.js.map +1 -0
- package/dist/lib/error.d.ts +242 -0
- package/dist/lib/error.js +303 -0
- package/dist/lib/error.js.map +1 -0
- package/dist/lib/fifo.d.ts +416 -0
- package/dist/lib/fifo.js +453 -0
- package/dist/lib/fifo.js.map +1 -0
- package/dist/lib/filter-context.d.ts +712 -0
- package/dist/lib/filter-context.js +789 -0
- package/dist/lib/filter-context.js.map +1 -0
- package/dist/lib/filter-graph-segment.d.ts +160 -0
- package/dist/lib/filter-graph-segment.js +171 -0
- package/dist/lib/filter-graph-segment.js.map +1 -0
- package/dist/lib/filter-graph.d.ts +641 -0
- package/dist/lib/filter-graph.js +704 -0
- package/dist/lib/filter-graph.js.map +1 -0
- package/dist/lib/filter-inout.d.ts +198 -0
- package/dist/lib/filter-inout.js +257 -0
- package/dist/lib/filter-inout.js.map +1 -0
- package/dist/lib/filter.d.ts +243 -0
- package/dist/lib/filter.js +272 -0
- package/dist/lib/filter.js.map +1 -0
- package/dist/lib/format-context.d.ts +1254 -0
- package/dist/lib/format-context.js +1379 -0
- package/dist/lib/format-context.js.map +1 -0
- package/dist/lib/frame-utils.d.ts +116 -0
- package/dist/lib/frame-utils.js +98 -0
- package/dist/lib/frame-utils.js.map +1 -0
- package/dist/lib/frame.d.ts +1222 -0
- package/dist/lib/frame.js +1435 -0
- package/dist/lib/frame.js.map +1 -0
- package/dist/lib/hardware-device-context.d.ts +362 -0
- package/dist/lib/hardware-device-context.js +383 -0
- package/dist/lib/hardware-device-context.js.map +1 -0
- package/dist/lib/hardware-frames-context.d.ts +419 -0
- package/dist/lib/hardware-frames-context.js +477 -0
- package/dist/lib/hardware-frames-context.js.map +1 -0
- package/dist/lib/index.d.ts +35 -0
- package/dist/lib/index.js +60 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/input-format.d.ts +249 -0
- package/dist/lib/input-format.js +306 -0
- package/dist/lib/input-format.js.map +1 -0
- package/dist/lib/io-context.d.ts +696 -0
- package/dist/lib/io-context.js +769 -0
- package/dist/lib/io-context.js.map +1 -0
- package/dist/lib/log.d.ts +174 -0
- package/dist/lib/log.js +184 -0
- package/dist/lib/log.js.map +1 -0
- package/dist/lib/native-types.d.ts +946 -0
- package/dist/lib/native-types.js +2 -0
- package/dist/lib/native-types.js.map +1 -0
- package/dist/lib/option.d.ts +927 -0
- package/dist/lib/option.js +1583 -0
- package/dist/lib/option.js.map +1 -0
- package/dist/lib/output-format.d.ts +180 -0
- package/dist/lib/output-format.js +213 -0
- package/dist/lib/output-format.js.map +1 -0
- package/dist/lib/packet.d.ts +501 -0
- package/dist/lib/packet.js +590 -0
- package/dist/lib/packet.js.map +1 -0
- package/dist/lib/rational.d.ts +251 -0
- package/dist/lib/rational.js +278 -0
- package/dist/lib/rational.js.map +1 -0
- package/dist/lib/software-resample-context.d.ts +552 -0
- package/dist/lib/software-resample-context.js +592 -0
- package/dist/lib/software-resample-context.js.map +1 -0
- package/dist/lib/software-scale-context.d.ts +344 -0
- package/dist/lib/software-scale-context.js +366 -0
- package/dist/lib/software-scale-context.js.map +1 -0
- package/dist/lib/stream.d.ts +379 -0
- package/dist/lib/stream.js +526 -0
- package/dist/lib/stream.js.map +1 -0
- package/dist/lib/sync-queue.d.ts +179 -0
- package/dist/lib/sync-queue.js +197 -0
- package/dist/lib/sync-queue.js.map +1 -0
- package/dist/lib/types.d.ts +34 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utilities.d.ts +1127 -0
- package/dist/lib/utilities.js +1225 -0
- package/dist/lib/utilities.js.map +1 -0
- package/dist/utils/electron.d.ts +49 -0
- package/dist/utils/electron.js +63 -0
- package/dist/utils/electron.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -0
- package/install/check.js +121 -0
- package/install/ffmpeg.js +66 -0
- package/jellyfin-ffmpeg.patch +181 -0
- package/package.json +129 -0
|
@@ -0,0 +1,927 @@
|
|
|
1
|
+
import { Dictionary } from './dictionary.js';
|
|
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';
|
|
3
|
+
import type { OptionCapableObject } from './binding.js';
|
|
4
|
+
import type { NativeOption } from './native-types.js';
|
|
5
|
+
import type { ChannelLayout, IDimension, IRational } from './types.js';
|
|
6
|
+
/**
|
|
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.
|
|
12
|
+
*
|
|
13
|
+
* Direct mapping to FFmpeg's AVOption.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
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}`);
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see [AVOption](https://ffmpeg.org/doxygen/trunk/structAVOption.html) - FFmpeg Doxygen
|
|
31
|
+
*/
|
|
32
|
+
export declare class OptionInfo {
|
|
33
|
+
private native;
|
|
34
|
+
/**
|
|
35
|
+
* @param native - The native option instance
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
constructor(native: NativeOption);
|
|
40
|
+
/**
|
|
41
|
+
* Option name.
|
|
42
|
+
*
|
|
43
|
+
* The name used to get/set this option.
|
|
44
|
+
*
|
|
45
|
+
* Direct mapping to AVOption->name.
|
|
46
|
+
*/
|
|
47
|
+
get name(): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Option help text.
|
|
50
|
+
*
|
|
51
|
+
* Human-readable description of the option's purpose.
|
|
52
|
+
*
|
|
53
|
+
* Direct mapping to AVOption->help.
|
|
54
|
+
*/
|
|
55
|
+
get help(): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Option type.
|
|
58
|
+
*
|
|
59
|
+
* Data type of the option value (AV_OPT_TYPE_*).
|
|
60
|
+
*
|
|
61
|
+
* Direct mapping to AVOption->type.
|
|
62
|
+
*/
|
|
63
|
+
get type(): AVOptionType;
|
|
64
|
+
/**
|
|
65
|
+
* Default value.
|
|
66
|
+
*
|
|
67
|
+
* The default value for this option.
|
|
68
|
+
* Type depends on the option type.
|
|
69
|
+
*
|
|
70
|
+
* Direct mapping to AVOption->default_val.
|
|
71
|
+
*/
|
|
72
|
+
get defaultValue(): unknown;
|
|
73
|
+
/**
|
|
74
|
+
* Minimum value.
|
|
75
|
+
*
|
|
76
|
+
* Minimum valid value for numeric options.
|
|
77
|
+
*
|
|
78
|
+
* Direct mapping to AVOption->min.
|
|
79
|
+
*/
|
|
80
|
+
get min(): number;
|
|
81
|
+
/**
|
|
82
|
+
* Maximum value.
|
|
83
|
+
*
|
|
84
|
+
* Maximum valid value for numeric options.
|
|
85
|
+
*
|
|
86
|
+
* Direct mapping to AVOption->max.
|
|
87
|
+
*/
|
|
88
|
+
get max(): number;
|
|
89
|
+
/**
|
|
90
|
+
* Option flags.
|
|
91
|
+
*
|
|
92
|
+
* Combination of AV_OPT_FLAG_* indicating option properties.
|
|
93
|
+
*
|
|
94
|
+
* Direct mapping to AVOption->flags.
|
|
95
|
+
*/
|
|
96
|
+
get flags(): AVOptionFlag;
|
|
97
|
+
/**
|
|
98
|
+
* Check if option has specific flags.
|
|
99
|
+
*
|
|
100
|
+
* Tests whether all specified flags are set using bitwise AND.
|
|
101
|
+
*
|
|
102
|
+
* @param flags - One or more flag values to check
|
|
103
|
+
*
|
|
104
|
+
* @returns true if all specified flags are set, false otherwise
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* import { AV_OPT_FLAG_ENCODING_PARAM } from 'node-av/constants';
|
|
109
|
+
*
|
|
110
|
+
* if (option.hasFlags(AV_OPT_FLAG_ENCODING_PARAM)) {
|
|
111
|
+
* console.log('This option is used for encoding');
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @see {@link flags} For direct flags access
|
|
116
|
+
*/
|
|
117
|
+
hasFlags(...flags: AVOptionFlag[]): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Option unit.
|
|
120
|
+
*
|
|
121
|
+
* Unit string for grouping related options.
|
|
122
|
+
*
|
|
123
|
+
* Direct mapping to AVOption->unit.
|
|
124
|
+
*/
|
|
125
|
+
get unit(): string | null;
|
|
126
|
+
/**
|
|
127
|
+
* Get the underlying native Option object.
|
|
128
|
+
*
|
|
129
|
+
* @returns The native Option binding object
|
|
130
|
+
*
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
getNative(): NativeOption;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* FFmpeg option management utilities.
|
|
137
|
+
*
|
|
138
|
+
* Provides static methods for getting, setting, and querying options
|
|
139
|
+
* on FFmpeg objects that support the AVOption API. Handles type conversion
|
|
140
|
+
* and validation for various option types including strings, numbers,
|
|
141
|
+
* rationals, pixel formats, and more.
|
|
142
|
+
*
|
|
143
|
+
* Direct mapping to FFmpeg's AVOption API.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* import { Option, FFmpegError } from 'node-av';
|
|
148
|
+
* import { AV_OPT_SEARCH_CHILDREN, AV_PIX_FMT_YUV420P } from 'node-av/constants';
|
|
149
|
+
*
|
|
150
|
+
* // Set various option types
|
|
151
|
+
* let ret = Option.set(obj, 'preset', 'fast');
|
|
152
|
+
* FFmpegError.throwIfError(ret, 'set preset');
|
|
153
|
+
*
|
|
154
|
+
* ret = Option.setInt(obj, 'bitrate', 2000000);
|
|
155
|
+
* FFmpegError.throwIfError(ret, 'set bitrate');
|
|
156
|
+
*
|
|
157
|
+
* ret = Option.setRational(obj, 'framerate', { num: 30, den: 1 });
|
|
158
|
+
* FFmpegError.throwIfError(ret, 'set framerate');
|
|
159
|
+
*
|
|
160
|
+
* // Get option values
|
|
161
|
+
* const preset = Option.get(obj, 'preset');
|
|
162
|
+
* const bitrate = Option.getInt(obj, 'bitrate');
|
|
163
|
+
* const framerate = Option.getRational(obj, 'framerate');
|
|
164
|
+
*
|
|
165
|
+
* // List all options
|
|
166
|
+
* let opt = null;
|
|
167
|
+
* while ((opt = Option.next(obj, opt))) {
|
|
168
|
+
* console.log(`${opt.name}: ${opt.help}`);
|
|
169
|
+
* }
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* @see [AVOption API](https://ffmpeg.org/doxygen/trunk/group__avoptions.html) - FFmpeg Doxygen
|
|
173
|
+
* @see {@link OptionMember} For inherited option support
|
|
174
|
+
*/
|
|
175
|
+
export declare class Option {
|
|
176
|
+
/**
|
|
177
|
+
* Iterate to next option.
|
|
178
|
+
*
|
|
179
|
+
* Iterates through available options on an object.
|
|
180
|
+
*
|
|
181
|
+
* Direct mapping to av_opt_next().
|
|
182
|
+
*
|
|
183
|
+
* @param obj - Object with options
|
|
184
|
+
*
|
|
185
|
+
* @param prev - Previous option (null to get first)
|
|
186
|
+
*
|
|
187
|
+
* @returns Next option, or null if no more
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* let opt = null;
|
|
192
|
+
* while ((opt = Option.next(obj, opt))) {
|
|
193
|
+
* console.log(`Option: ${opt.name}`);
|
|
194
|
+
* }
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
static next(obj: OptionCapableObject, prev?: OptionInfo | null): OptionInfo | null;
|
|
198
|
+
/**
|
|
199
|
+
* Find option by name.
|
|
200
|
+
*
|
|
201
|
+
* Searches for an option with the specified name.
|
|
202
|
+
*
|
|
203
|
+
* Direct mapping to av_opt_find().
|
|
204
|
+
*
|
|
205
|
+
* @param obj - Object to search
|
|
206
|
+
*
|
|
207
|
+
* @param name - Option name
|
|
208
|
+
*
|
|
209
|
+
* @param searchFlags - Search flags
|
|
210
|
+
*
|
|
211
|
+
* @returns Option info if found, null otherwise
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const opt = Option.find(obj, 'bitrate');
|
|
216
|
+
* if (opt) {
|
|
217
|
+
* console.log(`Found: ${opt.name}, Type: ${opt.type}`);
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
static find(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): OptionInfo | null;
|
|
222
|
+
/**
|
|
223
|
+
* Find option with target info.
|
|
224
|
+
*
|
|
225
|
+
* Like find() but also indicates if option was found on different target.
|
|
226
|
+
*
|
|
227
|
+
* Direct mapping to av_opt_find2().
|
|
228
|
+
*
|
|
229
|
+
* @param obj - Object to search
|
|
230
|
+
*
|
|
231
|
+
* @param name - Option name
|
|
232
|
+
*
|
|
233
|
+
* @param searchFlags - Search flags
|
|
234
|
+
*
|
|
235
|
+
* @returns Object with option and target info
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const result = Option.find2(obj, 'bitrate', AV_OPT_SEARCH_CHILDREN);
|
|
240
|
+
* if (result?.option) {
|
|
241
|
+
* console.log(`Found on ${result.isDifferentTarget ? 'child' : 'object'}`);
|
|
242
|
+
* }
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
static find2(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): {
|
|
246
|
+
option: OptionInfo | null;
|
|
247
|
+
isDifferentTarget: boolean;
|
|
248
|
+
} | null;
|
|
249
|
+
/**
|
|
250
|
+
* Get string option value.
|
|
251
|
+
*
|
|
252
|
+
* Direct mapping to av_opt_get().
|
|
253
|
+
*
|
|
254
|
+
* @param obj - Object to query
|
|
255
|
+
*
|
|
256
|
+
* @param name - Option name
|
|
257
|
+
*
|
|
258
|
+
* @param searchFlags - Search flags
|
|
259
|
+
*
|
|
260
|
+
* @returns Option value as string, or null
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```typescript
|
|
264
|
+
* // Get codec preset option
|
|
265
|
+
* const preset = Option.get(codecContext, 'preset', AV_OPT_SEARCH_CHILDREN);
|
|
266
|
+
* console.log('Codec preset:', preset); // 'medium', 'fast', etc.
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
static get(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): string | null;
|
|
270
|
+
/**
|
|
271
|
+
* Get integer option value.
|
|
272
|
+
*
|
|
273
|
+
* Direct mapping to av_opt_get_int().
|
|
274
|
+
*
|
|
275
|
+
* @param obj - Object to query
|
|
276
|
+
*
|
|
277
|
+
* @param name - Option name
|
|
278
|
+
*
|
|
279
|
+
* @param searchFlags - Search flags
|
|
280
|
+
*
|
|
281
|
+
* @returns Option value as integer, or null
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* // Get codec GOP size
|
|
286
|
+
* const gopSize = Option.getInt(codecContext, 'g', AV_OPT_SEARCH_CHILDREN);
|
|
287
|
+
* console.log('GOP size:', gopSize); // 60, 120, etc.
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
static getInt(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
|
|
291
|
+
/**
|
|
292
|
+
* Get double option value.
|
|
293
|
+
*
|
|
294
|
+
* Direct mapping to av_opt_get_double().
|
|
295
|
+
*
|
|
296
|
+
* @param obj - Object to query
|
|
297
|
+
*
|
|
298
|
+
* @param name - Option name
|
|
299
|
+
*
|
|
300
|
+
* @param searchFlags - Search flags
|
|
301
|
+
*
|
|
302
|
+
* @returns Option value as double, or null
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* ```typescript
|
|
306
|
+
* // Get codec quality scale
|
|
307
|
+
* const crf = Option.getDouble(codecContext, 'crf', AV_OPT_SEARCH_CHILDREN);
|
|
308
|
+
* console.log('CRF value:', crf); // 23.0, 18.0, etc.
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
static getDouble(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
|
|
312
|
+
/**
|
|
313
|
+
* Get rational option value.
|
|
314
|
+
*
|
|
315
|
+
* Direct mapping to av_opt_get_q().
|
|
316
|
+
*
|
|
317
|
+
* @param obj - Object to query
|
|
318
|
+
*
|
|
319
|
+
* @param name - Option name
|
|
320
|
+
*
|
|
321
|
+
* @param searchFlags - Search flags
|
|
322
|
+
*
|
|
323
|
+
* @returns Option value as rational, or null
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```typescript
|
|
327
|
+
* // Get codec time base
|
|
328
|
+
* const timeBase = Option.getRational(codecContext, 'time_base', AV_OPT_SEARCH_CHILDREN);
|
|
329
|
+
* console.log('Time base:', timeBase); // { num: 1, den: 30 }
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
static getRational(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): IRational | null;
|
|
333
|
+
/**
|
|
334
|
+
* Get pixel format option value.
|
|
335
|
+
*
|
|
336
|
+
* Direct mapping to av_opt_get_pixel_fmt().
|
|
337
|
+
*
|
|
338
|
+
* @param obj - Object to query
|
|
339
|
+
*
|
|
340
|
+
* @param name - Option name
|
|
341
|
+
*
|
|
342
|
+
* @param searchFlags - Search flags
|
|
343
|
+
*
|
|
344
|
+
* @returns Pixel format value, or null
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```typescript
|
|
348
|
+
* // Get filter pixel format
|
|
349
|
+
* const pixFmt = Option.getPixelFormat(filterContext, 'pix_fmt', AV_OPT_SEARCH_CHILDREN);
|
|
350
|
+
* console.log('Pixel format:', pixFmt); // AV_PIX_FMT_YUV420P, etc.
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
static getPixelFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVPixelFormat | null;
|
|
354
|
+
/**
|
|
355
|
+
* Get sample format option value.
|
|
356
|
+
*
|
|
357
|
+
* Direct mapping to av_opt_get_sample_fmt().
|
|
358
|
+
*
|
|
359
|
+
* @param obj - Object to query
|
|
360
|
+
*
|
|
361
|
+
* @param name - Option name
|
|
362
|
+
*
|
|
363
|
+
* @param searchFlags - Search flags
|
|
364
|
+
*
|
|
365
|
+
* @returns Sample format value, or null
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```typescript
|
|
369
|
+
* // Get audio codec sample format
|
|
370
|
+
* const sampleFmt = Option.getSampleFormat(codecContext, 'sample_fmt', AV_OPT_SEARCH_CHILDREN);
|
|
371
|
+
* console.log('Sample format:', sampleFmt); // AV_SAMPLE_FMT_FLTP, etc.
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
static getSampleFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVSampleFormat | null;
|
|
375
|
+
/**
|
|
376
|
+
* Get image size option value.
|
|
377
|
+
*
|
|
378
|
+
* Direct mapping to av_opt_get_image_size().
|
|
379
|
+
*
|
|
380
|
+
* @param obj - Object to query
|
|
381
|
+
*
|
|
382
|
+
* @param name - Option name
|
|
383
|
+
*
|
|
384
|
+
* @param searchFlags - Search flags
|
|
385
|
+
*
|
|
386
|
+
* @returns Width and height, or null
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```typescript
|
|
390
|
+
* // Get filter output size
|
|
391
|
+
* const size = Option.getImageSize(filterContext, 'size', AV_OPT_SEARCH_CHILDREN);
|
|
392
|
+
* console.log('Output size:', size); // { width: 1920, height: 1080 }
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
static getImageSize(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): IDimension | null;
|
|
396
|
+
/**
|
|
397
|
+
* Get channel layout option value.
|
|
398
|
+
*
|
|
399
|
+
* Direct mapping to av_opt_get_chlayout().
|
|
400
|
+
*
|
|
401
|
+
* @param obj - Object to query
|
|
402
|
+
*
|
|
403
|
+
* @param name - Option name
|
|
404
|
+
*
|
|
405
|
+
* @param searchFlags - Search flags
|
|
406
|
+
*
|
|
407
|
+
* @returns Channel layout, or null
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* // Get audio channel layout
|
|
412
|
+
* const layout = Option.getChannelLayout(codecContext, 'channel_layout', AV_OPT_SEARCH_CHILDREN);
|
|
413
|
+
* console.log('Channel layout:', layout); // stereo, 5.1, etc.
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
static getChannelLayout(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): ChannelLayout | null;
|
|
417
|
+
/**
|
|
418
|
+
* Get dictionary option value.
|
|
419
|
+
*
|
|
420
|
+
* Direct mapping to av_opt_get_dict_val().
|
|
421
|
+
*
|
|
422
|
+
* @param obj - Object to query
|
|
423
|
+
*
|
|
424
|
+
* @param name - Option name
|
|
425
|
+
*
|
|
426
|
+
* @param searchFlags - Search flags
|
|
427
|
+
*
|
|
428
|
+
* @returns Dictionary value, or null
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```typescript
|
|
432
|
+
* // Get metadata dictionary
|
|
433
|
+
* const metadata = Option.getDict(formatContext, 'metadata', AV_OPT_SEARCH_CHILDREN);
|
|
434
|
+
* console.log('Metadata:', metadata?.get('title'));
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
static getDict(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): Dictionary | null;
|
|
438
|
+
/**
|
|
439
|
+
* Set string option value.
|
|
440
|
+
*
|
|
441
|
+
* Direct mapping to av_opt_set().
|
|
442
|
+
*
|
|
443
|
+
* @param obj - Object to modify
|
|
444
|
+
*
|
|
445
|
+
* @param name - Option name
|
|
446
|
+
*
|
|
447
|
+
* @param value - String value
|
|
448
|
+
*
|
|
449
|
+
* @param searchFlags - Search flags
|
|
450
|
+
*
|
|
451
|
+
* @returns 0 on success, negative AVERROR on error
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```typescript
|
|
455
|
+
* // Set codec preset
|
|
456
|
+
* const ret = Option.set(codecContext, 'preset', 'fast', AV_OPT_SEARCH_CHILDREN);
|
|
457
|
+
* FFmpegError.throwIfError(ret, 'Failed to set preset');
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
static set(obj: OptionCapableObject, name: string, value: string, searchFlags?: AVOptionSearchFlags): number;
|
|
461
|
+
/**
|
|
462
|
+
* Set integer option value.
|
|
463
|
+
*
|
|
464
|
+
* Direct mapping to av_opt_set_int().
|
|
465
|
+
*
|
|
466
|
+
* @param obj - Object to modify
|
|
467
|
+
*
|
|
468
|
+
* @param name - Option name
|
|
469
|
+
*
|
|
470
|
+
* @param value - Integer value
|
|
471
|
+
*
|
|
472
|
+
* @param searchFlags - Search flags
|
|
473
|
+
*
|
|
474
|
+
* @returns 0 on success, negative AVERROR on error
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```typescript
|
|
478
|
+
* // Set codec bitrate
|
|
479
|
+
* const ret = Option.setInt(codecContext, 'b', 2000000, AV_OPT_SEARCH_CHILDREN);
|
|
480
|
+
* FFmpegError.throwIfError(ret, 'Failed to set bitrate');
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
static setInt(obj: OptionCapableObject, name: string, value: number | bigint, searchFlags?: AVOptionSearchFlags): number;
|
|
484
|
+
/**
|
|
485
|
+
* Set double option value.
|
|
486
|
+
*
|
|
487
|
+
* Direct mapping to av_opt_set_double().
|
|
488
|
+
*
|
|
489
|
+
* @param obj - Object to modify
|
|
490
|
+
*
|
|
491
|
+
* @param name - Option name
|
|
492
|
+
*
|
|
493
|
+
* @param value - Double value
|
|
494
|
+
*
|
|
495
|
+
* @param searchFlags - Search flags
|
|
496
|
+
*
|
|
497
|
+
* @returns 0 on success, negative AVERROR on error
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```typescript
|
|
501
|
+
* // Set codec CRF value
|
|
502
|
+
* const ret = Option.setDouble(codecContext, 'crf', 23.0, AV_OPT_SEARCH_CHILDREN);
|
|
503
|
+
* FFmpegError.throwIfError(ret, 'Failed to set CRF');
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
static setDouble(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
|
|
507
|
+
/**
|
|
508
|
+
* Set rational option value.
|
|
509
|
+
*
|
|
510
|
+
* Direct mapping to av_opt_set_q().
|
|
511
|
+
*
|
|
512
|
+
* @param obj - Object to modify
|
|
513
|
+
*
|
|
514
|
+
* @param name - Option name
|
|
515
|
+
*
|
|
516
|
+
* @param value - Rational value
|
|
517
|
+
*
|
|
518
|
+
* @param searchFlags - Search flags
|
|
519
|
+
*
|
|
520
|
+
* @returns 0 on success, negative AVERROR on error
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* ```typescript
|
|
524
|
+
* // Set codec frame rate
|
|
525
|
+
* const ret = Option.setRational(codecContext, 'framerate', { num: 30, den: 1 }, AV_OPT_SEARCH_CHILDREN);
|
|
526
|
+
* FFmpegError.throwIfError(ret, 'Failed to set framerate');
|
|
527
|
+
* ```
|
|
528
|
+
*/
|
|
529
|
+
static setRational(obj: OptionCapableObject, name: string, value: IRational, searchFlags?: AVOptionSearchFlags): number;
|
|
530
|
+
/**
|
|
531
|
+
* Set pixel format option value.
|
|
532
|
+
*
|
|
533
|
+
* Direct mapping to av_opt_set_pixel_fmt().
|
|
534
|
+
*
|
|
535
|
+
* @param obj - Object to modify
|
|
536
|
+
*
|
|
537
|
+
* @param name - Option name
|
|
538
|
+
*
|
|
539
|
+
* @param value - Pixel format
|
|
540
|
+
*
|
|
541
|
+
* @param searchFlags - Search flags
|
|
542
|
+
*
|
|
543
|
+
* @returns 0 on success, negative AVERROR on error
|
|
544
|
+
*
|
|
545
|
+
* @example
|
|
546
|
+
* ```typescript
|
|
547
|
+
* // Set filter pixel format
|
|
548
|
+
* const ret = Option.setPixelFormat(filterContext, 'pix_fmt', AV_PIX_FMT_YUV420P, AV_OPT_SEARCH_CHILDREN);
|
|
549
|
+
* FFmpegError.throwIfError(ret, 'Failed to set pixel format');
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
static setPixelFormat(obj: OptionCapableObject, name: string, value: AVPixelFormat, searchFlags?: AVOptionSearchFlags): number;
|
|
553
|
+
/**
|
|
554
|
+
* Set sample format option value.
|
|
555
|
+
*
|
|
556
|
+
* Direct mapping to av_opt_set_sample_fmt().
|
|
557
|
+
*
|
|
558
|
+
* @param obj - Object to modify
|
|
559
|
+
*
|
|
560
|
+
* @param name - Option name
|
|
561
|
+
*
|
|
562
|
+
* @param value - Sample format
|
|
563
|
+
*
|
|
564
|
+
* @param searchFlags - Search flags
|
|
565
|
+
*
|
|
566
|
+
* @returns 0 on success, negative AVERROR on error
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* ```typescript
|
|
570
|
+
* // Set audio codec sample format
|
|
571
|
+
* const ret = Option.setSampleFormat(codecContext, 'sample_fmt', AV_SAMPLE_FMT_FLTP, AV_OPT_SEARCH_CHILDREN);
|
|
572
|
+
* FFmpegError.throwIfError(ret, 'Failed to set sample format');
|
|
573
|
+
* ```
|
|
574
|
+
*/
|
|
575
|
+
static setSampleFormat(obj: OptionCapableObject, name: string, value: AVSampleFormat, searchFlags?: AVOptionSearchFlags): number;
|
|
576
|
+
/**
|
|
577
|
+
* Set image size option value.
|
|
578
|
+
*
|
|
579
|
+
* Direct mapping to av_opt_set_image_size().
|
|
580
|
+
*
|
|
581
|
+
* @param obj - Object to modify
|
|
582
|
+
*
|
|
583
|
+
* @param name - Option name
|
|
584
|
+
*
|
|
585
|
+
* @param width - Image width
|
|
586
|
+
*
|
|
587
|
+
* @param height - Image height
|
|
588
|
+
*
|
|
589
|
+
* @param searchFlags - Search flags
|
|
590
|
+
*
|
|
591
|
+
* @returns 0 on success, negative AVERROR on error
|
|
592
|
+
*
|
|
593
|
+
* @example
|
|
594
|
+
* ```typescript
|
|
595
|
+
* // Set filter output size
|
|
596
|
+
* const ret = Option.setImageSize(filterContext, 'size', 1920, 1080, AV_OPT_SEARCH_CHILDREN);
|
|
597
|
+
* FFmpegError.throwIfError(ret, 'Failed to set image size');
|
|
598
|
+
* ```
|
|
599
|
+
*/
|
|
600
|
+
static setImageSize(obj: OptionCapableObject, name: string, width: number, height: number, searchFlags?: AVOptionSearchFlags): number;
|
|
601
|
+
/**
|
|
602
|
+
* Set channel layout option value.
|
|
603
|
+
*
|
|
604
|
+
* Direct mapping to av_opt_set_chlayout().
|
|
605
|
+
*
|
|
606
|
+
* @param obj - Object to modify
|
|
607
|
+
*
|
|
608
|
+
* @param name - Option name
|
|
609
|
+
*
|
|
610
|
+
* @param value - Channel layout
|
|
611
|
+
*
|
|
612
|
+
* @param searchFlags - Search flags
|
|
613
|
+
*
|
|
614
|
+
* @returns 0 on success, negative AVERROR on error
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```typescript
|
|
618
|
+
* // Set audio channel layout to stereo
|
|
619
|
+
* const ret = Option.setChannelLayout(codecContext, 'channel_layout', AV_CHANNEL_LAYOUT_STEREO, AV_OPT_SEARCH_CHILDREN);
|
|
620
|
+
* FFmpegError.throwIfError(ret, 'Failed to set channel layout');
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
static setChannelLayout(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
|
|
624
|
+
/**
|
|
625
|
+
* Set dictionary option value.
|
|
626
|
+
*
|
|
627
|
+
* Direct mapping to av_opt_set_dict_val().
|
|
628
|
+
*
|
|
629
|
+
* @param obj - Object to modify
|
|
630
|
+
*
|
|
631
|
+
* @param name - Option name
|
|
632
|
+
*
|
|
633
|
+
* @param value - Dictionary value
|
|
634
|
+
*
|
|
635
|
+
* @param searchFlags - Search flags
|
|
636
|
+
*
|
|
637
|
+
* @returns 0 on success, negative AVERROR on error
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```typescript
|
|
641
|
+
* // Set metadata dictionary
|
|
642
|
+
* const dict = new Dictionary();
|
|
643
|
+
* dict.set('title', 'My Video');
|
|
644
|
+
* const ret = Option.setDict(formatContext, 'metadata', dict, AV_OPT_SEARCH_CHILDREN);
|
|
645
|
+
* FFmpegError.throwIfError(ret, 'Failed to set metadata');
|
|
646
|
+
* ```
|
|
647
|
+
*/
|
|
648
|
+
static setDict(obj: OptionCapableObject, name: string, value: Dictionary, searchFlags?: AVOptionSearchFlags): number;
|
|
649
|
+
/**
|
|
650
|
+
* Set binary option value.
|
|
651
|
+
*
|
|
652
|
+
* Direct mapping to av_opt_set_bin().
|
|
653
|
+
*
|
|
654
|
+
* @param obj - Object to modify
|
|
655
|
+
*
|
|
656
|
+
* @param name - Option name
|
|
657
|
+
*
|
|
658
|
+
* @param value - Binary data
|
|
659
|
+
*
|
|
660
|
+
* @param searchFlags - Search flags
|
|
661
|
+
*
|
|
662
|
+
* @returns 0 on success, negative AVERROR on error
|
|
663
|
+
*
|
|
664
|
+
* @example
|
|
665
|
+
* ```typescript
|
|
666
|
+
* // Set binary extradata
|
|
667
|
+
* const extradata = Buffer.from([0x00, 0x01, 0x02, 0x03]);
|
|
668
|
+
* const ret = Option.setBin(codecContext, 'extradata', extradata, AV_OPT_SEARCH_CHILDREN);
|
|
669
|
+
* FFmpegError.throwIfError(ret, 'Failed to set extradata');
|
|
670
|
+
* ```
|
|
671
|
+
*/
|
|
672
|
+
static setBin(obj: OptionCapableObject, name: string, value: Buffer, searchFlags?: AVOptionSearchFlags): number;
|
|
673
|
+
/**
|
|
674
|
+
* Set defaults on object.
|
|
675
|
+
*
|
|
676
|
+
* Sets all options to their default values.
|
|
677
|
+
*
|
|
678
|
+
* Direct mapping to av_opt_set_defaults().
|
|
679
|
+
*
|
|
680
|
+
* @param obj - Object to reset
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```typescript
|
|
684
|
+
* // Reset all codec options to defaults
|
|
685
|
+
* Option.setDefaults(codecContext);
|
|
686
|
+
* ```
|
|
687
|
+
*/
|
|
688
|
+
static setDefaults(obj: OptionCapableObject): void;
|
|
689
|
+
/**
|
|
690
|
+
* Copy options between objects.
|
|
691
|
+
*
|
|
692
|
+
* Copies option values from source to destination.
|
|
693
|
+
*
|
|
694
|
+
* Direct mapping to av_opt_copy().
|
|
695
|
+
*
|
|
696
|
+
* @param dest - Destination object
|
|
697
|
+
*
|
|
698
|
+
* @param src - Source object
|
|
699
|
+
*
|
|
700
|
+
* @returns 0 on success, negative AVERROR on error
|
|
701
|
+
*
|
|
702
|
+
* @example
|
|
703
|
+
* ```typescript
|
|
704
|
+
* // Copy options from one codec context to another
|
|
705
|
+
* const ret = Option.copy(destCodecContext, srcCodecContext);
|
|
706
|
+
* FFmpegError.throwIfError(ret, 'Failed to copy options');
|
|
707
|
+
* ```
|
|
708
|
+
*/
|
|
709
|
+
static copy(dest: OptionCapableObject, src: OptionCapableObject): number;
|
|
710
|
+
/**
|
|
711
|
+
* Check if option is set to default.
|
|
712
|
+
*
|
|
713
|
+
* Direct mapping to av_opt_is_set_to_default().
|
|
714
|
+
*
|
|
715
|
+
* @param obj - Object to check
|
|
716
|
+
*
|
|
717
|
+
* @param name - Option name
|
|
718
|
+
*
|
|
719
|
+
* @param searchFlags - Search flags
|
|
720
|
+
*
|
|
721
|
+
* @returns True if default, false if modified, null if not found
|
|
722
|
+
*
|
|
723
|
+
* @example
|
|
724
|
+
* ```typescript
|
|
725
|
+
* // Check if bitrate is at default value
|
|
726
|
+
* const isDefault = Option.isSetToDefault(codecContext, 'b', AV_OPT_SEARCH_CHILDREN);
|
|
727
|
+
* console.log('Bitrate is default:', isDefault);
|
|
728
|
+
* ```
|
|
729
|
+
*/
|
|
730
|
+
static isSetToDefault(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): boolean | null;
|
|
731
|
+
/**
|
|
732
|
+
* Serialize options to string.
|
|
733
|
+
*
|
|
734
|
+
* Direct mapping to av_opt_serialize().
|
|
735
|
+
*
|
|
736
|
+
* @param obj - Object to serialize
|
|
737
|
+
*
|
|
738
|
+
* @param optFlags - Option flags filter
|
|
739
|
+
*
|
|
740
|
+
* @param flags - Serialization flags
|
|
741
|
+
*
|
|
742
|
+
* @param keyValSep - Key-value separator
|
|
743
|
+
*
|
|
744
|
+
* @param pairsSep - Pairs separator
|
|
745
|
+
*
|
|
746
|
+
* @returns Serialized string, or null on error
|
|
747
|
+
*
|
|
748
|
+
* @example
|
|
749
|
+
* ```typescript
|
|
750
|
+
* // Serialize codec options to string
|
|
751
|
+
* const serialized = Option.serialize(codecContext, 0, 0, '=', ':');
|
|
752
|
+
* console.log('Options:', serialized); // 'bitrate=2000000:preset=fast'
|
|
753
|
+
* ```
|
|
754
|
+
*/
|
|
755
|
+
static serialize(obj: OptionCapableObject, optFlags?: number, flags?: number, keyValSep?: string, pairsSep?: string): string | null;
|
|
756
|
+
/**
|
|
757
|
+
* Free option resources.
|
|
758
|
+
*
|
|
759
|
+
* Direct mapping to av_opt_free().
|
|
760
|
+
*
|
|
761
|
+
* @param obj - Object to free options from
|
|
762
|
+
*
|
|
763
|
+
* @example
|
|
764
|
+
* ```typescript
|
|
765
|
+
* // Free codec context options
|
|
766
|
+
* Option.free(codecContext);
|
|
767
|
+
* ```
|
|
768
|
+
*/
|
|
769
|
+
static free(obj: OptionCapableObject): void;
|
|
770
|
+
/**
|
|
771
|
+
* Show options for debugging.
|
|
772
|
+
*
|
|
773
|
+
* Direct mapping to av_opt_show2().
|
|
774
|
+
*
|
|
775
|
+
* @param obj - Object to show options for
|
|
776
|
+
*
|
|
777
|
+
* @param reqFlags - Required flags
|
|
778
|
+
*
|
|
779
|
+
* @param rejFlags - Rejected flags
|
|
780
|
+
*
|
|
781
|
+
* @returns 0 on success, negative AVERROR on error
|
|
782
|
+
*
|
|
783
|
+
* @example
|
|
784
|
+
* ```typescript
|
|
785
|
+
* // Show all codec options for debugging
|
|
786
|
+
* const ret = Option.show(codecContext, 0, 0);
|
|
787
|
+
* FFmpegError.throwIfError(ret, 'Failed to show options');
|
|
788
|
+
* ```
|
|
789
|
+
*/
|
|
790
|
+
static show(obj: OptionCapableObject, reqFlags?: number, rejFlags?: number): number;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Base class for FFmpeg objects that support AVOptions.
|
|
794
|
+
*
|
|
795
|
+
* Provides a common interface for getting, setting, and listing options
|
|
796
|
+
* on FFmpeg objects that have an AVClass structure. This includes codecs,
|
|
797
|
+
* formats, filters, and various processing contexts.
|
|
798
|
+
*
|
|
799
|
+
* Classes that support AVOptions should extend this class to inherit
|
|
800
|
+
* the option management functionality.
|
|
801
|
+
*
|
|
802
|
+
* @template T - The native FFmpeg object type that supports AVOptions
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* ```typescript
|
|
806
|
+
* import { OptionMember, FFmpegError } from 'node-av';
|
|
807
|
+
* import { AV_OPT_TYPE_INT, AV_OPT_TYPE_STRING, AV_OPT_TYPE_RATIONAL } from 'node-av/constants';
|
|
808
|
+
*
|
|
809
|
+
* class CodecContext extends OptionMember<NativeCodecContext> {
|
|
810
|
+
* constructor(native: NativeCodecContext) {
|
|
811
|
+
* super(native);
|
|
812
|
+
* }
|
|
813
|
+
* }
|
|
814
|
+
*
|
|
815
|
+
* // Use inherited methods
|
|
816
|
+
* const codec = new CodecContext(native);
|
|
817
|
+
*
|
|
818
|
+
* // Set options with automatic type handling
|
|
819
|
+
* let ret = codec.setOption('preset', 'fast');
|
|
820
|
+
* FFmpegError.throwIfError(ret, 'set preset');
|
|
821
|
+
*
|
|
822
|
+
* ret = codec.setOption('bitrate', 2000000, AV_OPT_TYPE_INT);
|
|
823
|
+
* FFmpegError.throwIfError(ret, 'set bitrate');
|
|
824
|
+
*
|
|
825
|
+
* ret = codec.setOption('framerate', { num: 30, den: 1 }, AV_OPT_TYPE_RATIONAL);
|
|
826
|
+
* FFmpegError.throwIfError(ret, 'set framerate');
|
|
827
|
+
*
|
|
828
|
+
* // Get typed options
|
|
829
|
+
* const preset = codec.getOption('preset');
|
|
830
|
+
* const bitrate = codec.getOption('bitrate', AV_OPT_TYPE_INT);
|
|
831
|
+
* const framerate = codec.getOption('framerate', AV_OPT_TYPE_RATIONAL);
|
|
832
|
+
*
|
|
833
|
+
* // List all available options
|
|
834
|
+
* const options = codec.listOptions();
|
|
835
|
+
* for (const opt of options) {
|
|
836
|
+
* console.log(`${opt.name}: ${opt.help}`);
|
|
837
|
+
* }
|
|
838
|
+
* ```
|
|
839
|
+
*
|
|
840
|
+
* @see {@link Option} For static option methods
|
|
841
|
+
* @see {@link OptionInfo} For option metadata
|
|
842
|
+
*/
|
|
843
|
+
export declare class OptionMember<T extends OptionCapableObject> {
|
|
844
|
+
protected native: T;
|
|
845
|
+
constructor(native: T);
|
|
846
|
+
setOption(name: string, value: string | number | boolean | bigint | null | undefined): number;
|
|
847
|
+
setOption(name: string, value: string, type: AVOptionTypeString, searchFlags?: AVOptionSearchFlags): number;
|
|
848
|
+
setOption(name: string, value: string, type: AVOptionTypeColor, searchFlags?: AVOptionSearchFlags): number;
|
|
849
|
+
setOption(name: string, value: number, type: AVOptionTypeInt, searchFlags?: AVOptionSearchFlags): number;
|
|
850
|
+
setOption(name: string, value: bigint, type: AVOptionTypeInt64, searchFlags?: AVOptionSearchFlags): number;
|
|
851
|
+
setOption(name: string, value: number, type: AVOptionTypeUint, searchFlags?: AVOptionSearchFlags): number;
|
|
852
|
+
setOption(name: string, value: bigint, type: AVOptionTypeUint64, searchFlags?: AVOptionSearchFlags): number;
|
|
853
|
+
setOption(name: string, value: number, type: AVOptionTypeFlags, searchFlags?: AVOptionSearchFlags): number;
|
|
854
|
+
setOption(name: string, value: boolean, type: AVOptionTypeBool, searchFlags?: AVOptionSearchFlags): number;
|
|
855
|
+
setOption(name: string, value: number, type: AVOptionTypeDuration, searchFlags?: AVOptionSearchFlags): number;
|
|
856
|
+
setOption(name: string, value: number, type: AVOptionTypeConst, searchFlags?: AVOptionSearchFlags): number;
|
|
857
|
+
setOption(name: string, value: number, type: AVOptionTypeDouble, searchFlags?: AVOptionSearchFlags): number;
|
|
858
|
+
setOption(name: string, value: number, type: AVOptionTypeFloat, searchFlags?: AVOptionSearchFlags): number;
|
|
859
|
+
setOption(name: string, value: IRational, type: AVOptionTypeRational, searchFlags?: AVOptionSearchFlags): number;
|
|
860
|
+
setOption(name: string, value: IRational, type: AVOptionTypeVideoRate, searchFlags?: AVOptionSearchFlags): number;
|
|
861
|
+
setOption(name: string, value: AVPixelFormat, type: AVOptionTypePixelFmt, searchFlags?: AVOptionSearchFlags): number;
|
|
862
|
+
setOption(name: string, value: AVSampleFormat, type: AVOptionTypeSampleFmt, searchFlags?: AVOptionSearchFlags): number;
|
|
863
|
+
setOption(name: string, value: IDimension, type: AVOptionTypeImageSize, searchFlags?: AVOptionSearchFlags): number;
|
|
864
|
+
setOption(name: string, value: number | bigint, type: AVOptionTypeChLayout, searchFlags?: AVOptionSearchFlags): number;
|
|
865
|
+
setOption(name: string, value: Buffer, type: AVOptionTypeBinary, searchFlags?: AVOptionSearchFlags): number;
|
|
866
|
+
setOption(name: string, value: number[], type: AVOptionTypeBinaryIntArray, searchFlags?: AVOptionSearchFlags): number;
|
|
867
|
+
setOption(name: string, value: Dictionary, type: AVOptionTypeDict, searchFlags?: AVOptionSearchFlags): number;
|
|
868
|
+
getOption(name: string, type?: AVOptionTypeString, searchFlags?: AVOptionSearchFlags): string | null;
|
|
869
|
+
getOption(name: string, type: AVOptionTypeColor, searchFlags?: AVOptionSearchFlags): string | null;
|
|
870
|
+
getOption(name: string, type: AVOptionTypeInt, searchFlags?: AVOptionSearchFlags): number | null;
|
|
871
|
+
getOption(name: string, type: AVOptionTypeInt64, searchFlags?: AVOptionSearchFlags): bigint | null;
|
|
872
|
+
getOption(name: string, type: AVOptionTypeUint, searchFlags?: AVOptionSearchFlags): number | null;
|
|
873
|
+
getOption(name: string, type: AVOptionTypeUint64, searchFlags?: AVOptionSearchFlags): bigint | null;
|
|
874
|
+
getOption(name: string, type: AVOptionTypeFlags, searchFlags?: AVOptionSearchFlags): number | null;
|
|
875
|
+
getOption(name: string, type: AVOptionTypeBool, searchFlags?: AVOptionSearchFlags): boolean | null;
|
|
876
|
+
getOption(name: string, type: AVOptionTypeDuration, searchFlags?: AVOptionSearchFlags): number | null;
|
|
877
|
+
getOption(name: string, type: AVOptionTypeConst, searchFlags?: AVOptionSearchFlags): number | null;
|
|
878
|
+
getOption(name: string, type: AVOptionTypeDouble, searchFlags?: AVOptionSearchFlags): number | null;
|
|
879
|
+
getOption(name: string, type: AVOptionTypeFloat, searchFlags?: AVOptionSearchFlags): number | null;
|
|
880
|
+
getOption(name: string, type: AVOptionTypeRational, searchFlags?: AVOptionSearchFlags): IRational | null;
|
|
881
|
+
getOption(name: string, type: AVOptionTypeVideoRate, searchFlags?: AVOptionSearchFlags): IRational | null;
|
|
882
|
+
getOption(name: string, type: AVOptionTypePixelFmt, searchFlags?: AVOptionSearchFlags): AVPixelFormat | null;
|
|
883
|
+
getOption(name: string, type: AVOptionTypeSampleFmt, searchFlags?: AVOptionSearchFlags): AVSampleFormat | null;
|
|
884
|
+
getOption(name: string, type: AVOptionTypeImageSize, searchFlags?: AVOptionSearchFlags): IDimension | null;
|
|
885
|
+
getOption(name: string, type: AVOptionTypeChLayout, searchFlags?: AVOptionSearchFlags): ChannelLayout | null;
|
|
886
|
+
getOption(name: string, type: AVOptionTypeDict, searchFlags?: AVOptionSearchFlags): Dictionary | null;
|
|
887
|
+
getOption(name: string, type: AVOptionTypeBinary, searchFlags?: AVOptionSearchFlags): string | null;
|
|
888
|
+
/**
|
|
889
|
+
* List all available options for this object.
|
|
890
|
+
*
|
|
891
|
+
* Uses the AVOption API to enumerate all options.
|
|
892
|
+
* Useful for discovering available settings and their types.
|
|
893
|
+
*
|
|
894
|
+
* Direct mapping to av_opt_next() iteration.
|
|
895
|
+
*
|
|
896
|
+
* @returns Array of option information objects
|
|
897
|
+
*
|
|
898
|
+
* @example
|
|
899
|
+
* ```typescript
|
|
900
|
+
* const options = obj.listOptions();
|
|
901
|
+
* for (const opt of options) {
|
|
902
|
+
* console.log(`${opt.name}: ${opt.help}`);
|
|
903
|
+
* console.log(` Type: ${opt.type}, Default: ${opt.defaultValue}`);
|
|
904
|
+
* console.log(` Range: ${opt.min} - ${opt.max}`);
|
|
905
|
+
* }
|
|
906
|
+
* ```
|
|
907
|
+
*
|
|
908
|
+
* @see {@link OptionInfo} For option metadata structure
|
|
909
|
+
*/
|
|
910
|
+
listOptions(): OptionInfo[];
|
|
911
|
+
/**
|
|
912
|
+
* Intelligently set a format option based on its FFmpeg type.
|
|
913
|
+
*
|
|
914
|
+
* Queries the option type using av_opt_find() and calls the appropriate
|
|
915
|
+
* typed setOption() overload. Handles automatic type conversion from
|
|
916
|
+
* JavaScript types to FFmpeg option types.
|
|
917
|
+
*
|
|
918
|
+
* @param name - Option name
|
|
919
|
+
*
|
|
920
|
+
* @param value - Option value (null/undefined are skipped)
|
|
921
|
+
*
|
|
922
|
+
* @returns 0 on success, negative on error
|
|
923
|
+
*
|
|
924
|
+
* @internal
|
|
925
|
+
*/
|
|
926
|
+
private setUnknownOption;
|
|
927
|
+
}
|