node-av 2.5.2 → 2.6.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.
@@ -1,2 +1,85 @@
1
- export declare const ffmpegPath: () => string;
2
- export declare const isFfmpegAvailable: () => boolean;
1
+ /**
2
+ * Get the absolute path to the FFmpeg binary.
3
+ *
4
+ * Returns the path to the FFmpeg executable that was automatically downloaded
5
+ * during package installation. The binary is platform-specific and matches
6
+ * the FFmpeg version used by the native bindings.
7
+ *
8
+ * @returns {string} Absolute path to the FFmpeg binary
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { ffmpegPath } from 'node-av/ffmpeg';
13
+ *
14
+ * const path = ffmpegPath();
15
+ * console.log('FFmpeg binary at:', path);
16
+ * // On Windows: C:\path\to\node_modules\node-av\binary\ffmpeg.exe
17
+ * // On Unix: /path/to/node_modules/node-av/binary/ffmpeg
18
+ * ```
19
+ *
20
+ * @example Convert video using FFmpeg binary
21
+ * ```typescript
22
+ * import { ffmpegPath } from 'node-av/ffmpeg';
23
+ * import { execFile } from 'node:child_process';
24
+ * import { promisify } from 'node:util';
25
+ *
26
+ * const execFileAsync = promisify(execFile);
27
+ *
28
+ * async function convertVideo(input: string, output: string) {
29
+ * const args = [
30
+ * '-i', input,
31
+ * '-c:v', 'libx264',
32
+ * '-crf', '23',
33
+ * '-c:a', 'aac',
34
+ * output
35
+ * ];
36
+ *
37
+ * await execFileAsync(ffmpegPath(), args);
38
+ * }
39
+ * ```
40
+ */
41
+ export declare function ffmpegPath(): string;
42
+ /**
43
+ * Check if the FFmpeg binary is available and executable.
44
+ *
45
+ * Verifies that the FFmpeg binary exists at the expected location.
46
+ * This is useful for checking if the installation was successful
47
+ * before attempting to use the binary.
48
+ *
49
+ * @returns {boolean} `true` if FFmpeg binary exists, `false` otherwise
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * import { isFfmpegAvailable, ffmpegPath } from 'node-av/ffmpeg';
54
+ *
55
+ * if (isFfmpegAvailable()) {
56
+ * console.log('FFmpeg is ready to use');
57
+ * // Safe to use ffmpegPath() and execute FFmpeg commands
58
+ * } else {
59
+ * console.log('FFmpeg binary not found');
60
+ * console.log('Expected location:', ffmpegPath());
61
+ * console.log('Try running: npm install node-av');
62
+ * }
63
+ * ```
64
+ *
65
+ * @example Conditional FFmpeg usage
66
+ * ```typescript
67
+ * import { isFfmpegAvailable, ffmpegPath } from 'node-av/ffmpeg';
68
+ * import { execFile } from 'node:child_process';
69
+ *
70
+ * async function getFFmpegVersion(): Promise<string | null> {
71
+ * if (!isFfmpegAvailable()) {
72
+ * return null;
73
+ * }
74
+ *
75
+ * try {
76
+ * const { stdout } = await execFile(ffmpegPath(), ['-version']);
77
+ * return stdout;
78
+ * } catch (error) {
79
+ * console.error('Failed to execute FFmpeg:', error);
80
+ * return null;
81
+ * }
82
+ * }
83
+ * ```
84
+ */
85
+ export declare function isFfmpegAvailable(): boolean;
@@ -7,8 +7,93 @@ const __dirname = dirname(__filename);
7
7
  const ffmpegBinaryPath = resolve(__dirname, '../../binary');
8
8
  const ffmpegFile = 'ffmpeg' + (getPlatform() === 'win32' ? '.exe' : '');
9
9
  const ffmpegExtractedFilePath = resolve(ffmpegBinaryPath, ffmpegFile);
10
- export const ffmpegPath = () => ffmpegExtractedFilePath;
11
- export const isFfmpegAvailable = () => {
10
+ /**
11
+ * Get the absolute path to the FFmpeg binary.
12
+ *
13
+ * Returns the path to the FFmpeg executable that was automatically downloaded
14
+ * during package installation. The binary is platform-specific and matches
15
+ * the FFmpeg version used by the native bindings.
16
+ *
17
+ * @returns {string} Absolute path to the FFmpeg binary
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { ffmpegPath } from 'node-av/ffmpeg';
22
+ *
23
+ * const path = ffmpegPath();
24
+ * console.log('FFmpeg binary at:', path);
25
+ * // On Windows: C:\path\to\node_modules\node-av\binary\ffmpeg.exe
26
+ * // On Unix: /path/to/node_modules/node-av/binary/ffmpeg
27
+ * ```
28
+ *
29
+ * @example Convert video using FFmpeg binary
30
+ * ```typescript
31
+ * import { ffmpegPath } from 'node-av/ffmpeg';
32
+ * import { execFile } from 'node:child_process';
33
+ * import { promisify } from 'node:util';
34
+ *
35
+ * const execFileAsync = promisify(execFile);
36
+ *
37
+ * async function convertVideo(input: string, output: string) {
38
+ * const args = [
39
+ * '-i', input,
40
+ * '-c:v', 'libx264',
41
+ * '-crf', '23',
42
+ * '-c:a', 'aac',
43
+ * output
44
+ * ];
45
+ *
46
+ * await execFileAsync(ffmpegPath(), args);
47
+ * }
48
+ * ```
49
+ */
50
+ export function ffmpegPath() {
51
+ return ffmpegExtractedFilePath;
52
+ }
53
+ /**
54
+ * Check if the FFmpeg binary is available and executable.
55
+ *
56
+ * Verifies that the FFmpeg binary exists at the expected location.
57
+ * This is useful for checking if the installation was successful
58
+ * before attempting to use the binary.
59
+ *
60
+ * @returns {boolean} `true` if FFmpeg binary exists, `false` otherwise
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * import { isFfmpegAvailable, ffmpegPath } from 'node-av/ffmpeg';
65
+ *
66
+ * if (isFfmpegAvailable()) {
67
+ * console.log('FFmpeg is ready to use');
68
+ * // Safe to use ffmpegPath() and execute FFmpeg commands
69
+ * } else {
70
+ * console.log('FFmpeg binary not found');
71
+ * console.log('Expected location:', ffmpegPath());
72
+ * console.log('Try running: npm install node-av');
73
+ * }
74
+ * ```
75
+ *
76
+ * @example Conditional FFmpeg usage
77
+ * ```typescript
78
+ * import { isFfmpegAvailable, ffmpegPath } from 'node-av/ffmpeg';
79
+ * import { execFile } from 'node:child_process';
80
+ *
81
+ * async function getFFmpegVersion(): Promise<string | null> {
82
+ * if (!isFfmpegAvailable()) {
83
+ * return null;
84
+ * }
85
+ *
86
+ * try {
87
+ * const { stdout } = await execFile(ffmpegPath(), ['-version']);
88
+ * return stdout;
89
+ * } catch (error) {
90
+ * console.error('Failed to execute FFmpeg:', error);
91
+ * return null;
92
+ * }
93
+ * }
94
+ * ```
95
+ */
96
+ export function isFfmpegAvailable() {
12
97
  return existsSync(ffmpegExtractedFilePath);
13
- };
98
+ }
14
99
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffmpeg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AAC5D,MAAM,UAAU,GAAG,QAAQ,GAAG,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACxE,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAW,EAAE,CAAC,uBAAuB,CAAC;AAEhE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAY,EAAE;IAC7C,OAAO,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC7C,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ffmpeg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AAC5D,MAAM,UAAU,GAAG,QAAQ,GAAG,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACxE,MAAM,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC7C,CAAC"}
@@ -8,7 +8,7 @@ import type { AVCodecID, AVError, AVHWDeviceType, AVLogLevel, AVMediaType, AVOpt
8
8
  import type { FFDecoderCodec } from '../constants/decoders.js';
9
9
  import type { FFEncoderCodec } from '../constants/encoders.js';
10
10
  import type { PosixError } from './error.js';
11
- import type { NativeAudioFifo, NativeBitStreamFilter, NativeBitStreamFilterContext, NativeCodec, NativeCodecContext, NativeCodecParameters, NativeCodecParser, NativeDictionary, NativeFFmpegError, NativeFilter, NativeFilterContext, NativeFilterGraph, NativeFilterInOut, NativeFormatContext, NativeFrame, NativeHardwareDeviceContext, NativeHardwareFramesContext, NativeInputFormat, NativeIOContext, NativeLog, NativeOption, NativeOutputFormat, NativePacket, NativeSoftwareResampleContext, NativeSoftwareScaleContext, NativeStream } from './native-types.js';
11
+ import type { NativeAudioFifo, NativeBitStreamFilter, NativeBitStreamFilterContext, NativeCodec, NativeCodecContext, NativeCodecParameters, NativeCodecParser, NativeDictionary, NativeFFmpegError, NativeFilter, NativeFilterContext, NativeFilterGraph, NativeFilterInOut, NativeFormatContext, NativeFrame, NativeFrameUtils, NativeHardwareDeviceContext, NativeHardwareFramesContext, NativeInputFormat, NativeIOContext, NativeLog, NativeOption, NativeOutputFormat, NativePacket, NativeSoftwareResampleContext, NativeSoftwareScaleContext, NativeStream } from './native-types.js';
12
12
  import type { ChannelLayout, IRational } from './types.js';
13
13
  type NativePacketConstructor = new () => NativePacket;
14
14
  type NativeFrameConstructor = new () => NativeFrame;
@@ -64,6 +64,7 @@ type NativeBitStreamFilterContextConstructor = new () => NativeBitStreamFilterCo
64
64
  type NativeAudioFifoConstructor = new () => NativeAudioFifo;
65
65
  type NativeSoftwareScaleContextConstructor = new () => NativeSoftwareScaleContext;
66
66
  type NativeSoftwareResampleContextConstructor = new () => NativeSoftwareResampleContext;
67
+ type NativeFrameUtilsConstructor = new (width: number, height: number) => NativeFrameUtils;
67
68
  interface NativeHardwareDeviceContextConstructor {
68
69
  new (): NativeHardwareDeviceContext;
69
70
  getTypeName(type: AVHWDeviceType): string | null;
@@ -142,13 +143,26 @@ export interface NativeBinding {
142
143
  AudioFifo: NativeAudioFifoConstructor;
143
144
  SoftwareScaleContext: NativeSoftwareScaleContextConstructor;
144
145
  SoftwareResampleContext: NativeSoftwareResampleContextConstructor;
146
+ FrameUtils: NativeFrameUtilsConstructor;
145
147
  HardwareDeviceContext: NativeHardwareDeviceContextConstructor;
146
148
  HardwareFramesContext: NativeHardwareFramesContextConstructor;
147
149
  Dictionary: NativeDictionaryConstructor;
148
150
  FFmpegError: NativeFFmpegErrorConstructor;
149
151
  Log: NativeLogConstructor;
150
152
  Option: NativeOptionStatic;
151
- getVersion: () => string;
153
+ getFFmpegInfo: () => {
154
+ version: string;
155
+ configuration: string;
156
+ libraries: {
157
+ avutil: string;
158
+ avcodec: string;
159
+ avformat: string;
160
+ avfilter: string;
161
+ avdevice: string;
162
+ swscale: string;
163
+ swresample: string;
164
+ };
165
+ };
152
166
  avGetBytesPerSample: (sampleFmt: AVSampleFormat) => number;
153
167
  avGetSampleFmtName: (sampleFmt: AVSampleFormat) => string | null;
154
168
  avGetPackedSampleFmt: (sampleFmt: AVSampleFormat) => AVSampleFormat;
@@ -167,6 +181,7 @@ export interface NativeBinding {
167
181
  avImageCopy2: (dstData: Buffer[], dstLinesizes: number[], srcData: Buffer[], srcLinesizes: number[], pixFmt: AVPixelFormat, width: number, height: number) => void;
168
182
  avImageGetBufferSize: (pixFmt: AVPixelFormat, width: number, height: number, align: number) => number;
169
183
  avImageCopyToBuffer: (dst: Buffer, dstSize: number, srcData: Buffer[] | null, srcLinesize: number[] | null, pixFmt: AVPixelFormat, width: number, height: number, align: number) => number;
184
+ avImageCrop: (dstBuffer: Buffer, srcBuffer: Buffer, pixFmt: AVPixelFormat, srcWidth: number, srcHeight: number, cropX: number, cropY: number, cropWidth: number, cropHeight: number) => number;
170
185
  avTs2Str: (ts: bigint | number | null) => string;
171
186
  avTs2TimeStr: (ts: bigint | number | null, timeBase: IRational) => string;
172
187
  avCompareTs: (tsA: bigint | number | null, tbA: IRational, tsB: bigint | number | null, tbB: IRational) => number;
@@ -1 +1 @@
1
- {"version":3,"file":"binding.js","sourceRoot":"","sources":["../../src/lib/binding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAoCzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAA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G,EAAE,CAAC,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAED,sBAAsB;IACtB,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChE,kBAAkB;IAClB,MAAM,IAAI,KAAK,CACb,iDAAiD,YAAY,KAAK;QAClE,cAAc,aAAa,MAAM,CAClC,CAAC;AACJ,CAAC;AAED,8CAA8C;AAC9C,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,83 @@
1
+ import type { ImageOptions } from './types.js';
2
+ /**
3
+ * Frame processing utilities with persistent native frame pools.
4
+ *
5
+ * Provides efficient crop, scale, and format conversion operations
6
+ * with minimal JavaScript/C++ boundary crossings.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Create processor for 320x180 NV12 input
11
+ * const processor = new FrameUtils(320, 180);
12
+ *
13
+ * // Process frame with crop and resize
14
+ * const output = processor.process(inputBuffer, {
15
+ * crop: { left: 10, top: 10, width: 100, height: 100 },
16
+ * resize: { width: 200, height: 200 },
17
+ * format: { to: 'rgba' }
18
+ * });
19
+ *
20
+ * // Clean up when done
21
+ * processor.close();
22
+ * ```
23
+ */
24
+ export declare class FrameUtils implements Disposable {
25
+ private native;
26
+ private disposed;
27
+ /**
28
+ * Create a new FrameUtils processor.
29
+ *
30
+ * @param width - Input frame width (must be consistent for all frames)
31
+ *
32
+ * @param height - Input frame height (must be consistent for all frames)
33
+ */
34
+ constructor(width: number, height: number);
35
+ /**
36
+ * Process a frame with the specified options.
37
+ *
38
+ * @param buffer - Input buffer containing NV12 frame data
39
+ *
40
+ * @param options - Processing options
41
+ *
42
+ * @returns Processed frame as a Buffer
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * // Simple resize
47
+ * const resized = processor.process(input, {
48
+ * resize: { width: 640, height: 480 }
49
+ * });
50
+ *
51
+ * // Crop and convert to RGB
52
+ * const cropped = processor.process(input, {
53
+ * crop: { left: 100, top: 100, width: 200, height: 200 },
54
+ * format: { to: 'rgb' }
55
+ * });
56
+ * ```
57
+ */
58
+ process(buffer: Buffer, options?: ImageOptions): Buffer;
59
+ /**
60
+ * Close and release all resources.
61
+ *
62
+ * Frees all pooled frames and SWS contexts.
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * processor.close();
67
+ * ```
68
+ */
69
+ close(): void;
70
+ /**
71
+ * Dispose of the processor.
72
+ *
73
+ * Called automatically when using `using` statements.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * using processor = new FrameUtils(320, 180);
78
+ * // Use processor...
79
+ * // Automatically disposed at the end of the block
80
+ * ```
81
+ */
82
+ [Symbol.dispose](): void;
83
+ }
@@ -0,0 +1,98 @@
1
+ import { bindings } from './binding.js';
2
+ /**
3
+ * Frame processing utilities with persistent native frame pools.
4
+ *
5
+ * Provides efficient crop, scale, and format conversion operations
6
+ * with minimal JavaScript/C++ boundary crossings.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Create processor for 320x180 NV12 input
11
+ * const processor = new FrameUtils(320, 180);
12
+ *
13
+ * // Process frame with crop and resize
14
+ * const output = processor.process(inputBuffer, {
15
+ * crop: { left: 10, top: 10, width: 100, height: 100 },
16
+ * resize: { width: 200, height: 200 },
17
+ * format: { to: 'rgba' }
18
+ * });
19
+ *
20
+ * // Clean up when done
21
+ * processor.close();
22
+ * ```
23
+ */
24
+ export class FrameUtils {
25
+ native;
26
+ disposed = false;
27
+ /**
28
+ * Create a new FrameUtils processor.
29
+ *
30
+ * @param width - Input frame width (must be consistent for all frames)
31
+ *
32
+ * @param height - Input frame height (must be consistent for all frames)
33
+ */
34
+ constructor(width, height) {
35
+ this.native = new bindings.FrameUtils(width, height);
36
+ }
37
+ /**
38
+ * Process a frame with the specified options.
39
+ *
40
+ * @param buffer - Input buffer containing NV12 frame data
41
+ *
42
+ * @param options - Processing options
43
+ *
44
+ * @returns Processed frame as a Buffer
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * // Simple resize
49
+ * const resized = processor.process(input, {
50
+ * resize: { width: 640, height: 480 }
51
+ * });
52
+ *
53
+ * // Crop and convert to RGB
54
+ * const cropped = processor.process(input, {
55
+ * crop: { left: 100, top: 100, width: 200, height: 200 },
56
+ * format: { to: 'rgb' }
57
+ * });
58
+ * ```
59
+ */
60
+ process(buffer, options = {}) {
61
+ if (this.disposed) {
62
+ throw new Error('FrameUtils instance has been disposed');
63
+ }
64
+ return this.native.process(buffer, options);
65
+ }
66
+ /**
67
+ * Close and release all resources.
68
+ *
69
+ * Frees all pooled frames and SWS contexts.
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * processor.close();
74
+ * ```
75
+ */
76
+ close() {
77
+ if (!this.disposed) {
78
+ this.native.close();
79
+ this.disposed = true;
80
+ }
81
+ }
82
+ /**
83
+ * Dispose of the processor.
84
+ *
85
+ * Called automatically when using `using` statements.
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * using processor = new FrameUtils(320, 180);
90
+ * // Use processor...
91
+ * // Automatically disposed at the end of the block
92
+ * ```
93
+ */
94
+ [Symbol.dispose]() {
95
+ this.close();
96
+ }
97
+ }
98
+ //# sourceMappingURL=frame-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-utils.js","sourceRoot":"","sources":["../../src/lib/frame-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAKxC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,UAAU;IACb,MAAM,CAAmB;IACzB,QAAQ,GAAG,KAAK,CAAC;IAEzB;;;;;;OAMG;IACH,YAAY,KAAa,EAAE,MAAc;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,CAAC,MAAc,EAAE,UAAwB,EAAE;QAChD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF"}
@@ -555,6 +555,57 @@ export declare class Frame implements Disposable, NativeWrapper<NativeFrame> {
555
555
  * ```
556
556
  */
557
557
  fromBuffer(buffer: Buffer): number;
558
+ /**
559
+ * Convert frame data to buffer.
560
+ *
561
+ * Copies frame data into a single contiguous buffer.
562
+ * For video frames, converts all planes into packed format.
563
+ * For audio frames, handles both planar and interleaved formats.
564
+ * Cannot be used with hardware frames - use hwframeTransferData first.
565
+ *
566
+ * @returns Buffer containing frame data
567
+ *
568
+ * @throws {Error} If frame is not allocated, has no data, or is a hardware frame
569
+ *
570
+ * @example Video frame to buffer
571
+ * ```typescript
572
+ * // Get YUV420P video frame as buffer
573
+ * const buffer = frame.toBuffer();
574
+ * console.log(`Frame buffer size: ${buffer.length} bytes`);
575
+ * // Buffer contains Y plane, then U plane, then V plane
576
+ * ```
577
+ *
578
+ * @example Audio frame to buffer
579
+ * ```typescript
580
+ * // Get audio samples as buffer
581
+ * const audioBuffer = frame.toBuffer();
582
+ * console.log(`Audio buffer size: ${audioBuffer.length} bytes`);
583
+ * // For planar audio: channel 0 samples, then channel 1 samples, etc.
584
+ * // For interleaved audio: sample0_ch0, sample0_ch1, sample1_ch0, sample1_ch1, etc.
585
+ * ```
586
+ *
587
+ * @example Error handling
588
+ * ```typescript
589
+ * try {
590
+ * const buffer = frame.toBuffer();
591
+ * // Process buffer...
592
+ * } catch (error) {
593
+ * if (frame.isHwFrame()) {
594
+ * // Transfer to software first
595
+ * const swFrame = new Frame();
596
+ * swFrame.alloc();
597
+ * await frame.hwframeTransferData(swFrame);
598
+ * const buffer = swFrame.toBuffer();
599
+ * }
600
+ * }
601
+ * ```
602
+ *
603
+ * @see {@link fromBuffer} To create frame from buffer
604
+ * @see {@link hwframeTransferData} To transfer hardware frames to software
605
+ * @see {@link isHwFrame} To check if frame is hardware
606
+ * @see {@link data} To access individual planes
607
+ */
608
+ toBuffer(): Buffer;
558
609
  /**
559
610
  * Transfer data between hardware and software frames.
560
611
  *
package/dist/lib/frame.js CHANGED
@@ -698,6 +698,59 @@ export class Frame {
698
698
  fromBuffer(buffer) {
699
699
  return this.native.fromBuffer(buffer);
700
700
  }
701
+ /**
702
+ * Convert frame data to buffer.
703
+ *
704
+ * Copies frame data into a single contiguous buffer.
705
+ * For video frames, converts all planes into packed format.
706
+ * For audio frames, handles both planar and interleaved formats.
707
+ * Cannot be used with hardware frames - use hwframeTransferData first.
708
+ *
709
+ * @returns Buffer containing frame data
710
+ *
711
+ * @throws {Error} If frame is not allocated, has no data, or is a hardware frame
712
+ *
713
+ * @example Video frame to buffer
714
+ * ```typescript
715
+ * // Get YUV420P video frame as buffer
716
+ * const buffer = frame.toBuffer();
717
+ * console.log(`Frame buffer size: ${buffer.length} bytes`);
718
+ * // Buffer contains Y plane, then U plane, then V plane
719
+ * ```
720
+ *
721
+ * @example Audio frame to buffer
722
+ * ```typescript
723
+ * // Get audio samples as buffer
724
+ * const audioBuffer = frame.toBuffer();
725
+ * console.log(`Audio buffer size: ${audioBuffer.length} bytes`);
726
+ * // For planar audio: channel 0 samples, then channel 1 samples, etc.
727
+ * // For interleaved audio: sample0_ch0, sample0_ch1, sample1_ch0, sample1_ch1, etc.
728
+ * ```
729
+ *
730
+ * @example Error handling
731
+ * ```typescript
732
+ * try {
733
+ * const buffer = frame.toBuffer();
734
+ * // Process buffer...
735
+ * } catch (error) {
736
+ * if (frame.isHwFrame()) {
737
+ * // Transfer to software first
738
+ * const swFrame = new Frame();
739
+ * swFrame.alloc();
740
+ * await frame.hwframeTransferData(swFrame);
741
+ * const buffer = swFrame.toBuffer();
742
+ * }
743
+ * }
744
+ * ```
745
+ *
746
+ * @see {@link fromBuffer} To create frame from buffer
747
+ * @see {@link hwframeTransferData} To transfer hardware frames to software
748
+ * @see {@link isHwFrame} To check if frame is hardware
749
+ * @see {@link data} To access individual planes
750
+ */
751
+ toBuffer() {
752
+ return this.native.toBuffer();
753
+ }
701
754
  /**
702
755
  * Transfer data between hardware and software frames.
703
756
  *
@@ -1 +1 @@
1
- {"version":3,"file":"frame.js","sourceRoot":"","sources":["../../src/lib/frame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACzG,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAiBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,OAAO,KAAK;IACR,MAAM,CAAc;IACpB,YAAY,CAAgC,CAAC,4CAA4C;IAEjG;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED,IAAI,MAAM,CAAC,KAAqC;QAC9C,IAAI,C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I,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAChC,CAAC;CACF"}
@@ -14,6 +14,7 @@ export { HardwareFramesContext } from './hardware-frames-context.js';
14
14
  export { SoftwareScaleContext } from './software-scale-context.js';
15
15
  export { SoftwareResampleContext } from './software-resample-context.js';
16
16
  export { AudioFifo } from './audio-fifo.js';
17
+ export { FrameUtils } from './frame-utils.js';
17
18
  export { IOContext } from './io-context.js';
18
19
  export { Dictionary } from './dictionary.js';
19
20
  export { Option, OptionInfo, type OptionMember } from './option.js';
package/dist/lib/index.js CHANGED
@@ -26,6 +26,8 @@ export { SoftwareScaleContext } from './software-scale-context.js';
26
26
  export { SoftwareResampleContext } from './software-resample-context.js';
27
27
  // Audio FIFO
28
28
  export { AudioFifo } from './audio-fifo.js';
29
+ // Frame Utils
30
+ export { FrameUtils } from './frame-utils.js';
29
31
  // I/O Context
30
32
  export { IOContext } from './io-context.js';
31
33
  // Dictionary
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAEA,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,SAAS;AACT,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,SAA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AO,EAAE,MAAM,EAAE,UAAU,EAAqB,MAAM,aAAa,CAAC;AAEpE,yBAAyB;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,mCAAmC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,QAAQ;AACR,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,UAAU;AACV,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,iBAAiB;AACjB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD,YAAY;AACZ,cAAc,gBAAgB,CAAC"}
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import type { AVDictFlag, AVFilterCmdFlag, AVFilterConstants, AVFilterFlag, AVFrameSideDataType, AVHWDeviceType, AVHWFrameTransferDirection, AVIOFlag, AVOptionFlag, AVOptionType, AVPacketSideDataType, AVPixelFormat, AVSeekFlag, AVSeekWhence, SWSFlag } from '../constants/constants.js';
11
11
  import type { AVChromaLocation, AVCodecCap, AVCodecFlag, AVCodecFlag2, AVCodecID, AVColorPrimaries, AVColorRange, AVColorSpace, AVColorTransferCharacteristic, AVDiscard, AVDisposition, AVFormatFlag, AVMediaType, AVPacketFlag, AVPictureType, AVProfile, AVSampleFormat, AVStreamEventFlag } from '../constants/index.js';
12
- import type { ChannelLayout, CodecProfile, FilterPad, IRational } from './types.js';
12
+ import type { ChannelLayout, CodecProfile, FilterPad, ImageOptions, IRational } from './types.js';
13
13
  /**
14
14
  * Native AVPacket binding interface
15
15
  *
@@ -88,6 +88,7 @@ export interface NativeFrame extends Disposable {
88
88
  copyProps(src: NativeFrame): number;
89
89
  copy(src: NativeFrame): number;
90
90
  fromBuffer(buffer: Buffer): number;
91
+ toBuffer(): Buffer;
91
92
  hwframeTransferData(dst: NativeFrame, flags?: number): Promise<number>;
92
93
  hwframeTransferDataSync(dst: NativeFrame, flags?: number): number;
93
94
  isHwFrame(): boolean;
@@ -496,6 +497,19 @@ export interface NativeSoftwareScaleContext extends Disposable {
496
497
  scaleFrameSync(dst: NativeFrame, src: NativeFrame): number;
497
498
  [Symbol.dispose](): void;
498
499
  }
500
+ /**
501
+ * Native FrameUtils binding interface
502
+ *
503
+ * Frame processing utilities with persistent frame pools.
504
+ * Provides crop, scale, and format conversion operations.
505
+ *
506
+ * @internal
507
+ */
508
+ export interface NativeFrameUtils extends Disposable {
509
+ readonly __brand: 'NativeFrameUtils';
510
+ process(buffer: Buffer, options: ImageOptions): Buffer;
511
+ close(): void;
512
+ }
499
513
  /**
500
514
  * Native SwrContext binding interface
501
515
  *