node-av 1.0.3 → 1.2.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 +56 -41
- package/dist/api/bitstream-filter.d.ts +180 -123
- package/dist/api/bitstream-filter.js +182 -126
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +286 -130
- package/dist/api/decoder.js +321 -159
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +254 -158
- package/dist/api/encoder.js +326 -298
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +912 -0
- package/dist/api/filter-presets.js +1407 -0
- package/dist/api/filter-presets.js.map +1 -0
- package/dist/api/filter.d.ts +280 -284
- package/dist/api/filter.js +435 -509
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +226 -159
- package/dist/api/hardware.js +405 -287
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +3 -2
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/io-stream.d.ts +65 -61
- package/dist/api/io-stream.js +45 -47
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/media-input.d.ts +244 -141
- package/dist/api/media-input.js +207 -104
- package/dist/api/media-input.js.map +1 -1
- package/dist/api/media-output.d.ts +206 -128
- package/dist/api/media-output.js +212 -129
- package/dist/api/media-output.js.map +1 -1
- package/dist/api/pipeline.d.ts +168 -38
- package/dist/api/pipeline.js +238 -14
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/types.d.ts +22 -182
- package/dist/api/utilities/audio-sample.d.ts +1 -1
- package/dist/api/utilities/image.d.ts +1 -1
- package/dist/api/utilities/media-type.d.ts +1 -1
- package/dist/api/utilities/pixel-format.d.ts +1 -1
- package/dist/api/utilities/sample-format.d.ts +1 -1
- package/dist/api/utilities/timestamp.d.ts +1 -1
- package/dist/api/utils.d.ts +1 -2
- package/dist/api/utils.js +9 -0
- package/dist/api/utils.js.map +1 -1
- package/dist/{lib → constants}/channel-layouts.d.ts +1 -1
- package/dist/constants/channel-layouts.js.map +1 -0
- package/dist/{lib → constants}/constants.d.ts +19 -4
- package/dist/{lib → constants}/constants.js +15 -1
- package/dist/constants/constants.js.map +1 -0
- package/dist/constants/decoders.d.ts +609 -0
- package/dist/constants/decoders.js +617 -0
- package/dist/constants/decoders.js.map +1 -0
- package/dist/constants/encoders.d.ts +285 -0
- package/dist/constants/encoders.js +298 -0
- package/dist/constants/encoders.js.map +1 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/audio-fifo.d.ts +128 -171
- package/dist/lib/audio-fifo.js +130 -173
- package/dist/lib/audio-fifo.js.map +1 -1
- package/dist/lib/binding.d.ts +7 -5
- package/dist/lib/binding.js +5 -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 +69 -55
- package/dist/lib/bitstream-filter.js +68 -54
- package/dist/lib/bitstream-filter.js.map +1 -1
- package/dist/lib/codec-context.d.ts +317 -381
- package/dist/lib/codec-context.js +316 -381
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/codec-parameters.d.ts +161 -171
- package/dist/lib/codec-parameters.js +162 -172
- package/dist/lib/codec-parameters.js.map +1 -1
- package/dist/lib/codec-parser.d.ts +92 -105
- package/dist/lib/codec-parser.js +92 -103
- package/dist/lib/codec-parser.js.map +1 -1
- package/dist/lib/codec.d.ts +328 -217
- package/dist/lib/codec.js +392 -218
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/dictionary.d.ts +150 -204
- package/dist/lib/dictionary.js +159 -213
- package/dist/lib/dictionary.js.map +1 -1
- package/dist/lib/error.d.ts +97 -131
- package/dist/lib/error.js +98 -128
- package/dist/lib/error.js.map +1 -1
- package/dist/lib/filter-context.d.ts +317 -194
- package/dist/lib/filter-context.js +335 -200
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +252 -293
- 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 +94 -112
- package/dist/lib/filter.js.map +1 -1
- package/dist/lib/format-context.d.ts +321 -429
- package/dist/lib/format-context.js +314 -386
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +263 -406
- package/dist/lib/frame.js +263 -408
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-device-context.d.ts +150 -204
- 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 +171 -181
- 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 +2 -3
- package/dist/lib/index.js +2 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/input-format.d.ts +90 -118
- package/dist/lib/input-format.js +89 -117
- package/dist/lib/input-format.js.map +1 -1
- package/dist/lib/io-context.d.ts +210 -242
- package/dist/lib/io-context.js +221 -253
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/log.d.ts +86 -120
- package/dist/lib/log.js +85 -122
- package/dist/lib/log.js.map +1 -1
- package/dist/lib/native-types.d.ts +127 -112
- package/dist/lib/native-types.js +9 -0
- package/dist/lib/native-types.js.map +1 -1
- package/dist/lib/option.d.ts +285 -242
- package/dist/lib/option.js +310 -250
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/output-format.d.ts +78 -102
- package/dist/lib/output-format.js +77 -101
- package/dist/lib/output-format.js.map +1 -1
- package/dist/lib/packet.d.ts +173 -241
- 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 +242 -326
- 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 +130 -174
- package/dist/lib/software-scale-context.js +132 -176
- package/dist/lib/software-scale-context.js.map +1 -1
- package/dist/lib/stream.d.ts +88 -198
- package/dist/lib/stream.js +87 -197
- package/dist/lib/stream.js.map +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/utilities.d.ts +372 -181
- package/dist/lib/utilities.js +373 -182
- package/dist/lib/utilities.js.map +1 -1
- package/install/check.js +0 -1
- package/package.json +32 -24
- package/release_notes.md +43 -13
- package/CHANGELOG.md +0 -8
- package/dist/lib/channel-layouts.js.map +0 -1
- package/dist/lib/constants.js.map +0 -1
- /package/dist/{lib → constants}/channel-layouts.js +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { AVCodecID } from '
|
|
1
|
+
import type { AVCodecID } from '../constants/constants.js';
|
|
2
2
|
import type { NativeBitStreamFilter, NativeWrapper } from './native-types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Bitstream filter
|
|
4
|
+
* Bitstream filter descriptor.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Provides access to bitstream filter properties and codec compatibility information.
|
|
7
|
+
* Bitstream filters are used to modify or analyze compressed bitstreams without
|
|
8
|
+
* full decoding/encoding. Common uses include H.264/HEVC parameter set extraction,
|
|
9
|
+
* VP9 superframe splitting, and adding/removing codec-specific headers.
|
|
9
10
|
*
|
|
10
11
|
* Direct mapping to FFmpeg's AVBitStreamFilter.
|
|
11
12
|
*
|
|
@@ -13,111 +14,124 @@ import type { NativeBitStreamFilter, NativeWrapper } from './native-types.js';
|
|
|
13
14
|
* ```typescript
|
|
14
15
|
* import { BitStreamFilter } from 'node-av';
|
|
15
16
|
*
|
|
16
|
-
* //
|
|
17
|
-
* const
|
|
18
|
-
* if (
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* // Get a specific bitstream filter
|
|
18
|
+
* const h264Filter = BitStreamFilter.getByName('h264_mp4toannexb');
|
|
19
|
+
* if (h264Filter) {
|
|
20
|
+
* console.log(`Filter: ${h264Filter.name}`);
|
|
21
|
+
* console.log(`Supported codecs: ${h264Filter.codecIds}`);
|
|
22
|
+
* }
|
|
22
23
|
*
|
|
23
24
|
* // List all available bitstream filters
|
|
24
25
|
* const filters = BitStreamFilter.iterate();
|
|
25
26
|
* for (const filter of filters) {
|
|
26
|
-
* console.log(
|
|
27
|
+
* console.log(`- ${filter.name}`);
|
|
27
28
|
* }
|
|
28
29
|
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see [AVBitStreamFilter](https://ffmpeg.org/doxygen/trunk/structAVBitStreamFilter.html) - FFmpeg Doxygen
|
|
29
32
|
*/
|
|
30
33
|
export declare class BitStreamFilter implements NativeWrapper<NativeBitStreamFilter> {
|
|
31
34
|
private native;
|
|
32
35
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* Usually not called directly - use static methods instead.
|
|
36
|
-
* No FFmpeg resources are allocated.
|
|
37
|
-
*
|
|
38
|
-
* @param native - Native BitStreamFilter object from bindings
|
|
36
|
+
* @param native The native bitstream filter instance
|
|
39
37
|
* @internal
|
|
40
38
|
*/
|
|
41
39
|
constructor(native: NativeBitStreamFilter);
|
|
42
40
|
/**
|
|
43
|
-
*
|
|
41
|
+
* Get a bitstream filter by name.
|
|
44
42
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
43
|
+
* Retrieves a specific bitstream filter descriptor by its name.
|
|
44
|
+
* Common filter names include 'h264_mp4toannexb', 'hevc_mp4toannexb',
|
|
45
|
+
* 'extract_extradata', 'vp9_superframe', etc.
|
|
47
46
|
*
|
|
48
|
-
*
|
|
47
|
+
* Direct mapping to av_bsf_get_by_name().
|
|
49
48
|
*
|
|
50
|
-
* @param name - Name of the bitstream filter
|
|
51
|
-
* @returns BitStreamFilter if found, null otherwise
|
|
49
|
+
* @param name - Name of the bitstream filter
|
|
50
|
+
* @returns BitStreamFilter instance if found, null otherwise
|
|
52
51
|
*
|
|
53
52
|
* @example
|
|
54
53
|
* ```typescript
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
54
|
+
* // Get H.264 stream format converter
|
|
55
|
+
* const h264Filter = BitStreamFilter.getByName('h264_mp4toannexb');
|
|
56
|
+
* if (!h264Filter) {
|
|
57
|
+
* throw new Error('H.264 bitstream filter not available');
|
|
58
58
|
* }
|
|
59
|
+
*
|
|
60
|
+
* // Get HEVC metadata extractor
|
|
61
|
+
* const hevcFilter = BitStreamFilter.getByName('hevc_metadata');
|
|
59
62
|
* ```
|
|
63
|
+
*
|
|
64
|
+
* @see {@link iterate} To list all available filters
|
|
65
|
+
* @see {@link BitStreamFilterContext.alloc} To use the filter
|
|
60
66
|
*/
|
|
61
67
|
static getByName(name: string): BitStreamFilter | null;
|
|
62
68
|
/**
|
|
63
|
-
*
|
|
69
|
+
* Iterate over all available bitstream filters.
|
|
64
70
|
*
|
|
65
|
-
* Returns an array of all registered bitstream filters.
|
|
66
|
-
* Useful for
|
|
71
|
+
* Returns an array of all registered bitstream filters in FFmpeg.
|
|
72
|
+
* Useful for discovering available filters or building filter lists.
|
|
67
73
|
*
|
|
68
|
-
*
|
|
74
|
+
* Direct mapping to av_bsf_iterate().
|
|
69
75
|
*
|
|
70
76
|
* @returns Array of all available bitstream filters
|
|
71
77
|
*
|
|
72
78
|
* @example
|
|
73
79
|
* ```typescript
|
|
80
|
+
* import { BitStreamFilter } from 'node-av';
|
|
81
|
+
* import { AV_CODEC_ID_H264 } from 'node-av/constants';
|
|
82
|
+
*
|
|
83
|
+
* // List all available filters
|
|
74
84
|
* const filters = BitStreamFilter.iterate();
|
|
75
|
-
*
|
|
76
|
-
*
|
|
85
|
+
* console.log(`Found ${filters.length} bitstream filters`);
|
|
86
|
+
*
|
|
87
|
+
* // Find filters that support H.264
|
|
88
|
+
* const h264Filters = filters.filter(f =>
|
|
89
|
+
* f.codecIds?.includes(AV_CODEC_ID_H264)
|
|
90
|
+
* );
|
|
91
|
+
* console.log('H.264 compatible filters:');
|
|
92
|
+
* for (const filter of h264Filters) {
|
|
93
|
+
* console.log(`- ${filter.name}`);
|
|
77
94
|
* }
|
|
78
95
|
* ```
|
|
96
|
+
*
|
|
97
|
+
* @see {@link getByName} To get a specific filter
|
|
79
98
|
*/
|
|
80
99
|
static iterate(): BitStreamFilter[];
|
|
81
100
|
/**
|
|
82
|
-
*
|
|
101
|
+
* Name of the bitstream filter.
|
|
83
102
|
*
|
|
84
|
-
*
|
|
85
|
-
* This is the name used with getByName().
|
|
103
|
+
* Human-readable name identifying the filter (e.g., 'h264_mp4toannexb').
|
|
86
104
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* ```typescript
|
|
91
|
-
* const filter = BitStreamFilter.getByName('h264_mp4toannexb');
|
|
92
|
-
* console.log(filter.name); // 'h264_mp4toannexb'
|
|
93
|
-
* ```
|
|
105
|
+
* Direct mapping to AVBitStreamFilter->name.
|
|
94
106
|
*/
|
|
95
107
|
get name(): string | null;
|
|
96
108
|
/**
|
|
97
|
-
*
|
|
109
|
+
* List of supported codec IDs.
|
|
98
110
|
*
|
|
99
|
-
*
|
|
100
|
-
* If null, the filter
|
|
111
|
+
* Array of codec IDs that this filter can process.
|
|
112
|
+
* If null, the filter supports all codecs.
|
|
101
113
|
*
|
|
102
|
-
*
|
|
114
|
+
* Direct mapping to AVBitStreamFilter->codec_ids.
|
|
103
115
|
*
|
|
104
116
|
* @example
|
|
105
117
|
* ```typescript
|
|
106
|
-
* import { AV_CODEC_ID_H264 } from 'node-av/constants';
|
|
107
|
-
*
|
|
108
|
-
* const filter = BitStreamFilter.getByName('
|
|
109
|
-
* if (filter
|
|
110
|
-
*
|
|
118
|
+
* import { AV_CODEC_ID_H264, AV_CODEC_ID_HEVC } from 'node-av/constants';
|
|
119
|
+
*
|
|
120
|
+
* const filter = BitStreamFilter.getByName('extract_extradata');
|
|
121
|
+
* if (filter?.codecIds) {
|
|
122
|
+
* const supportsH264 = filter.codecIds.includes(AV_CODEC_ID_H264);
|
|
123
|
+
* const supportsHEVC = filter.codecIds.includes(AV_CODEC_ID_HEVC);
|
|
124
|
+
* console.log(`H.264 support: ${supportsH264}`);
|
|
125
|
+
* console.log(`HEVC support: ${supportsHEVC}`);
|
|
111
126
|
* }
|
|
112
127
|
* ```
|
|
113
128
|
*/
|
|
114
129
|
get codecIds(): AVCodecID[] | null;
|
|
115
130
|
/**
|
|
116
|
-
* Get the underlying native object.
|
|
131
|
+
* Get the underlying native BitStreamFilter object.
|
|
117
132
|
*
|
|
118
|
-
*
|
|
133
|
+
* @returns The native BitStreamFilter binding object
|
|
119
134
|
*
|
|
120
|
-
* @returns Native BitStreamFilter object
|
|
121
135
|
* @internal
|
|
122
136
|
*/
|
|
123
137
|
getNative(): NativeBitStreamFilter;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { bindings } from './binding.js';
|
|
2
2
|
/**
|
|
3
|
-
* Bitstream filter
|
|
3
|
+
* Bitstream filter descriptor.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Provides access to bitstream filter properties and codec compatibility information.
|
|
6
|
+
* Bitstream filters are used to modify or analyze compressed bitstreams without
|
|
7
|
+
* full decoding/encoding. Common uses include H.264/HEVC parameter set extraction,
|
|
8
|
+
* VP9 superframe splitting, and adding/removing codec-specific headers.
|
|
8
9
|
*
|
|
9
10
|
* Direct mapping to FFmpeg's AVBitStreamFilter.
|
|
10
11
|
*
|
|
@@ -12,111 +13,125 @@ import { bindings } from './binding.js';
|
|
|
12
13
|
* ```typescript
|
|
13
14
|
* import { BitStreamFilter } from 'node-av';
|
|
14
15
|
*
|
|
15
|
-
* //
|
|
16
|
-
* const
|
|
17
|
-
* if (
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* // Get a specific bitstream filter
|
|
17
|
+
* const h264Filter = BitStreamFilter.getByName('h264_mp4toannexb');
|
|
18
|
+
* if (h264Filter) {
|
|
19
|
+
* console.log(`Filter: ${h264Filter.name}`);
|
|
20
|
+
* console.log(`Supported codecs: ${h264Filter.codecIds}`);
|
|
21
|
+
* }
|
|
21
22
|
*
|
|
22
23
|
* // List all available bitstream filters
|
|
23
24
|
* const filters = BitStreamFilter.iterate();
|
|
24
25
|
* for (const filter of filters) {
|
|
25
|
-
* console.log(
|
|
26
|
+
* console.log(`- ${filter.name}`);
|
|
26
27
|
* }
|
|
27
28
|
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see [AVBitStreamFilter](https://ffmpeg.org/doxygen/trunk/structAVBitStreamFilter.html) - FFmpeg Doxygen
|
|
28
31
|
*/
|
|
29
32
|
export class BitStreamFilter {
|
|
30
33
|
native;
|
|
31
34
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* Usually not called directly - use static methods instead.
|
|
35
|
-
* No FFmpeg resources are allocated.
|
|
36
|
-
*
|
|
37
|
-
* @param native - Native BitStreamFilter object from bindings
|
|
35
|
+
* @param native The native bitstream filter instance
|
|
38
36
|
* @internal
|
|
39
37
|
*/
|
|
40
38
|
constructor(native) {
|
|
41
39
|
this.native = native;
|
|
42
40
|
}
|
|
43
41
|
/**
|
|
44
|
-
*
|
|
42
|
+
* Get a bitstream filter by name.
|
|
45
43
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
44
|
+
* Retrieves a specific bitstream filter descriptor by its name.
|
|
45
|
+
* Common filter names include 'h264_mp4toannexb', 'hevc_mp4toannexb',
|
|
46
|
+
* 'extract_extradata', 'vp9_superframe', etc.
|
|
48
47
|
*
|
|
49
|
-
*
|
|
48
|
+
* Direct mapping to av_bsf_get_by_name().
|
|
50
49
|
*
|
|
51
|
-
* @param name - Name of the bitstream filter
|
|
52
|
-
* @returns BitStreamFilter if found, null otherwise
|
|
50
|
+
* @param name - Name of the bitstream filter
|
|
51
|
+
* @returns BitStreamFilter instance if found, null otherwise
|
|
53
52
|
*
|
|
54
53
|
* @example
|
|
55
54
|
* ```typescript
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* // Get H.264 stream format converter
|
|
56
|
+
* const h264Filter = BitStreamFilter.getByName('h264_mp4toannexb');
|
|
57
|
+
* if (!h264Filter) {
|
|
58
|
+
* throw new Error('H.264 bitstream filter not available');
|
|
59
59
|
* }
|
|
60
|
+
*
|
|
61
|
+
* // Get HEVC metadata extractor
|
|
62
|
+
* const hevcFilter = BitStreamFilter.getByName('hevc_metadata');
|
|
60
63
|
* ```
|
|
64
|
+
*
|
|
65
|
+
* @see {@link iterate} To list all available filters
|
|
66
|
+
* @see {@link BitStreamFilterContext.alloc} To use the filter
|
|
61
67
|
*/
|
|
62
68
|
static getByName(name) {
|
|
63
69
|
const native = bindings.BitStreamFilter.getByName(name);
|
|
64
70
|
return native ? new BitStreamFilter(native) : null;
|
|
65
71
|
}
|
|
66
72
|
/**
|
|
67
|
-
*
|
|
73
|
+
* Iterate over all available bitstream filters.
|
|
68
74
|
*
|
|
69
|
-
* Returns an array of all registered bitstream filters.
|
|
70
|
-
* Useful for
|
|
75
|
+
* Returns an array of all registered bitstream filters in FFmpeg.
|
|
76
|
+
* Useful for discovering available filters or building filter lists.
|
|
71
77
|
*
|
|
72
|
-
*
|
|
78
|
+
* Direct mapping to av_bsf_iterate().
|
|
73
79
|
*
|
|
74
80
|
* @returns Array of all available bitstream filters
|
|
75
81
|
*
|
|
76
82
|
* @example
|
|
77
83
|
* ```typescript
|
|
84
|
+
* import { BitStreamFilter } from 'node-av';
|
|
85
|
+
* import { AV_CODEC_ID_H264 } from 'node-av/constants';
|
|
86
|
+
*
|
|
87
|
+
* // List all available filters
|
|
78
88
|
* const filters = BitStreamFilter.iterate();
|
|
79
|
-
*
|
|
80
|
-
*
|
|
89
|
+
* console.log(`Found ${filters.length} bitstream filters`);
|
|
90
|
+
*
|
|
91
|
+
* // Find filters that support H.264
|
|
92
|
+
* const h264Filters = filters.filter(f =>
|
|
93
|
+
* f.codecIds?.includes(AV_CODEC_ID_H264)
|
|
94
|
+
* );
|
|
95
|
+
* console.log('H.264 compatible filters:');
|
|
96
|
+
* for (const filter of h264Filters) {
|
|
97
|
+
* console.log(`- ${filter.name}`);
|
|
81
98
|
* }
|
|
82
99
|
* ```
|
|
100
|
+
*
|
|
101
|
+
* @see {@link getByName} To get a specific filter
|
|
83
102
|
*/
|
|
84
103
|
static iterate() {
|
|
85
104
|
const natives = bindings.BitStreamFilter.iterate();
|
|
86
105
|
return natives.map((native) => new BitStreamFilter(native));
|
|
87
106
|
}
|
|
88
107
|
/**
|
|
89
|
-
*
|
|
108
|
+
* Name of the bitstream filter.
|
|
90
109
|
*
|
|
91
|
-
*
|
|
92
|
-
* This is the name used with getByName().
|
|
110
|
+
* Human-readable name identifying the filter (e.g., 'h264_mp4toannexb').
|
|
93
111
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```typescript
|
|
98
|
-
* const filter = BitStreamFilter.getByName('h264_mp4toannexb');
|
|
99
|
-
* console.log(filter.name); // 'h264_mp4toannexb'
|
|
100
|
-
* ```
|
|
112
|
+
* Direct mapping to AVBitStreamFilter->name.
|
|
101
113
|
*/
|
|
102
114
|
get name() {
|
|
103
115
|
return this.native.name;
|
|
104
116
|
}
|
|
105
117
|
/**
|
|
106
|
-
*
|
|
118
|
+
* List of supported codec IDs.
|
|
107
119
|
*
|
|
108
|
-
*
|
|
109
|
-
* If null, the filter
|
|
120
|
+
* Array of codec IDs that this filter can process.
|
|
121
|
+
* If null, the filter supports all codecs.
|
|
110
122
|
*
|
|
111
|
-
*
|
|
123
|
+
* Direct mapping to AVBitStreamFilter->codec_ids.
|
|
112
124
|
*
|
|
113
125
|
* @example
|
|
114
126
|
* ```typescript
|
|
115
|
-
* import { AV_CODEC_ID_H264 } from 'node-av/constants';
|
|
116
|
-
*
|
|
117
|
-
* const filter = BitStreamFilter.getByName('
|
|
118
|
-
* if (filter
|
|
119
|
-
*
|
|
127
|
+
* import { AV_CODEC_ID_H264, AV_CODEC_ID_HEVC } from 'node-av/constants';
|
|
128
|
+
*
|
|
129
|
+
* const filter = BitStreamFilter.getByName('extract_extradata');
|
|
130
|
+
* if (filter?.codecIds) {
|
|
131
|
+
* const supportsH264 = filter.codecIds.includes(AV_CODEC_ID_H264);
|
|
132
|
+
* const supportsHEVC = filter.codecIds.includes(AV_CODEC_ID_HEVC);
|
|
133
|
+
* console.log(`H.264 support: ${supportsH264}`);
|
|
134
|
+
* console.log(`HEVC support: ${supportsHEVC}`);
|
|
120
135
|
* }
|
|
121
136
|
* ```
|
|
122
137
|
*/
|
|
@@ -124,11 +139,10 @@ export class BitStreamFilter {
|
|
|
124
139
|
return this.native.codecIds;
|
|
125
140
|
}
|
|
126
141
|
/**
|
|
127
|
-
* Get the underlying native object.
|
|
142
|
+
* Get the underlying native BitStreamFilter object.
|
|
128
143
|
*
|
|
129
|
-
*
|
|
144
|
+
* @returns The native BitStreamFilter binding object
|
|
130
145
|
*
|
|
131
|
-
* @returns Native BitStreamFilter object
|
|
132
146
|
* @internal
|
|
133
147
|
*/
|
|
134
148
|
getNative() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitstream-filter.js","sourceRoot":"","sources":["../../src/lib/bitstream-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC
|
|
1
|
+
{"version":3,"file":"bitstream-filter.js","sourceRoot":"","sources":["../../src/lib/bitstream-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,eAAe;IAClB,MAAM,CAAwB;IAEtC;;;OAGG;IACH,YAAY,MAA6B;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,SAAS,CAAC,IAAY;QAC3B,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACrD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,OAAO;QACZ,MAAM,OAAO,GAAG,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QACnD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAA6B,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IACrF,CAAC;IAED;;;;;;OAMG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,QAA8B,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|