node-av 1.3.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +47 -40
  2. package/binding.gyp +12 -0
  3. package/dist/api/bitstream-filter.d.ts +134 -2
  4. package/dist/api/bitstream-filter.js +200 -2
  5. package/dist/api/bitstream-filter.js.map +1 -1
  6. package/dist/api/decoder.d.ts +261 -105
  7. package/dist/api/decoder.js +384 -171
  8. package/dist/api/decoder.js.map +1 -1
  9. package/dist/api/encoder.d.ts +338 -74
  10. package/dist/api/encoder.js +546 -188
  11. package/dist/api/encoder.js.map +1 -1
  12. package/dist/api/filter-presets.d.ts +479 -1513
  13. package/dist/api/filter-presets.js +1044 -2005
  14. package/dist/api/filter-presets.js.map +1 -1
  15. package/dist/api/filter.d.ts +370 -150
  16. package/dist/api/filter.js +647 -364
  17. package/dist/api/filter.js.map +1 -1
  18. package/dist/api/hardware.d.ts +25 -31
  19. package/dist/api/hardware.js +36 -70
  20. package/dist/api/hardware.js.map +1 -1
  21. package/dist/api/index.d.ts +1 -1
  22. package/dist/api/index.js +1 -1
  23. package/dist/api/index.js.map +1 -1
  24. package/dist/api/io-stream.d.ts +6 -0
  25. package/dist/api/io-stream.js +2 -0
  26. package/dist/api/io-stream.js.map +1 -1
  27. package/dist/api/media-input.d.ts +208 -2
  28. package/dist/api/media-input.js +356 -8
  29. package/dist/api/media-input.js.map +1 -1
  30. package/dist/api/media-output.d.ts +142 -104
  31. package/dist/api/media-output.js +446 -179
  32. package/dist/api/media-output.js.map +1 -1
  33. package/dist/api/pipeline.d.ts +82 -17
  34. package/dist/api/pipeline.js +80 -42
  35. package/dist/api/pipeline.js.map +1 -1
  36. package/dist/api/types.d.ts +24 -57
  37. package/dist/api/utils.js +2 -0
  38. package/dist/api/utils.js.map +1 -1
  39. package/dist/lib/audio-fifo.d.ts +103 -0
  40. package/dist/lib/audio-fifo.js +109 -0
  41. package/dist/lib/audio-fifo.js.map +1 -1
  42. package/dist/lib/binding.d.ts +1 -0
  43. package/dist/lib/binding.js.map +1 -1
  44. package/dist/lib/bitstream-filter-context.d.ts +79 -0
  45. package/dist/lib/bitstream-filter-context.js +83 -0
  46. package/dist/lib/bitstream-filter-context.js.map +1 -1
  47. package/dist/lib/bitstream-filter.d.ts +2 -0
  48. package/dist/lib/bitstream-filter.js +2 -0
  49. package/dist/lib/bitstream-filter.js.map +1 -1
  50. package/dist/lib/codec-context.d.ts +168 -0
  51. package/dist/lib/codec-context.js +178 -0
  52. package/dist/lib/codec-context.js.map +1 -1
  53. package/dist/lib/codec-parameters.d.ts +3 -0
  54. package/dist/lib/codec-parameters.js +3 -0
  55. package/dist/lib/codec-parameters.js.map +1 -1
  56. package/dist/lib/codec-parser.d.ts +6 -0
  57. package/dist/lib/codec-parser.js +6 -0
  58. package/dist/lib/codec-parser.js.map +1 -1
  59. package/dist/lib/codec.d.ts +12 -0
  60. package/dist/lib/codec.js +12 -0
  61. package/dist/lib/codec.js.map +1 -1
  62. package/dist/lib/dictionary.d.ts +18 -2
  63. package/dist/lib/dictionary.js +18 -2
  64. package/dist/lib/dictionary.js.map +1 -1
  65. package/dist/lib/error.d.ts +8 -0
  66. package/dist/lib/error.js +9 -0
  67. package/dist/lib/error.js.map +1 -1
  68. package/dist/lib/filter-context.d.ts +119 -2
  69. package/dist/lib/filter-context.js +119 -0
  70. package/dist/lib/filter-context.js.map +1 -1
  71. package/dist/lib/filter-graph.d.ts +80 -0
  72. package/dist/lib/filter-graph.js +84 -0
  73. package/dist/lib/filter-graph.js.map +1 -1
  74. package/dist/lib/filter-inout.d.ts +1 -0
  75. package/dist/lib/filter-inout.js +1 -0
  76. package/dist/lib/filter-inout.js.map +1 -1
  77. package/dist/lib/filter.d.ts +2 -0
  78. package/dist/lib/filter.js +2 -0
  79. package/dist/lib/filter.js.map +1 -1
  80. package/dist/lib/format-context.d.ts +356 -20
  81. package/dist/lib/format-context.js +375 -23
  82. package/dist/lib/format-context.js.map +1 -1
  83. package/dist/lib/frame.d.ts +84 -1
  84. package/dist/lib/frame.js +96 -0
  85. package/dist/lib/frame.js.map +1 -1
  86. package/dist/lib/hardware-device-context.d.ts +8 -0
  87. package/dist/lib/hardware-device-context.js +8 -0
  88. package/dist/lib/hardware-device-context.js.map +1 -1
  89. package/dist/lib/hardware-frames-context.d.ts +55 -0
  90. package/dist/lib/hardware-frames-context.js +57 -0
  91. package/dist/lib/hardware-frames-context.js.map +1 -1
  92. package/dist/lib/input-format.d.ts +43 -3
  93. package/dist/lib/input-format.js +48 -0
  94. package/dist/lib/input-format.js.map +1 -1
  95. package/dist/lib/io-context.d.ts +212 -0
  96. package/dist/lib/io-context.js +228 -0
  97. package/dist/lib/io-context.js.map +1 -1
  98. package/dist/lib/log.d.ts +2 -0
  99. package/dist/lib/log.js +2 -0
  100. package/dist/lib/log.js.map +1 -1
  101. package/dist/lib/native-types.d.ts +39 -1
  102. package/dist/lib/option.d.ts +90 -0
  103. package/dist/lib/option.js +97 -0
  104. package/dist/lib/option.js.map +1 -1
  105. package/dist/lib/output-format.d.ts +4 -0
  106. package/dist/lib/output-format.js +4 -0
  107. package/dist/lib/output-format.js.map +1 -1
  108. package/dist/lib/packet.d.ts +7 -0
  109. package/dist/lib/packet.js +7 -0
  110. package/dist/lib/packet.js.map +1 -1
  111. package/dist/lib/rational.d.ts +1 -0
  112. package/dist/lib/rational.js +1 -0
  113. package/dist/lib/rational.js.map +1 -1
  114. package/dist/lib/software-resample-context.d.ts +64 -0
  115. package/dist/lib/software-resample-context.js +66 -0
  116. package/dist/lib/software-resample-context.js.map +1 -1
  117. package/dist/lib/software-scale-context.d.ts +98 -0
  118. package/dist/lib/software-scale-context.js +102 -0
  119. package/dist/lib/software-scale-context.js.map +1 -1
  120. package/dist/lib/stream.d.ts +1 -0
  121. package/dist/lib/stream.js +1 -0
  122. package/dist/lib/stream.js.map +1 -1
  123. package/dist/lib/utilities.d.ts +60 -0
  124. package/dist/lib/utilities.js +60 -0
  125. package/dist/lib/utilities.js.map +1 -1
  126. package/package.json +18 -18
  127. package/release_notes.md +0 -29
@@ -242,8 +242,11 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
242
242
  * Direct mapping to avformat_alloc_output_context2().
243
243
  *
244
244
  * @param oformat - Specific output format to use
245
+ *
245
246
  * @param formatName - Format name (e.g., 'mp4', 'mkv')
247
+ *
246
248
  * @param filename - Filename to guess format from extension
249
+ *
247
250
  * @returns 0 on success, negative AVERROR on error:
248
251
  * - AVERROR_ENOMEM: Memory allocation failure
249
252
  * - AVERROR_EINVAL: Invalid parameters
@@ -277,24 +280,6 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
277
280
  * @see {@link Symbol.asyncDispose} For automatic cleanup
278
281
  */
279
282
  freeContext(): void;
280
- /**
281
- * Close an input format context.
282
- *
283
- * Closes input file and releases resources.
284
- *
285
- * Direct mapping to avformat_close_input().
286
- *
287
- * @returns Promise that resolves when closed
288
- *
289
- * @example
290
- * ```typescript
291
- * await ctx.closeInput();
292
- * // Input closed and context freed
293
- * ```
294
- *
295
- * @see {@link openInput} To open input
296
- */
297
- closeInput(): Promise<void>;
298
283
  /**
299
284
  * Open output file for writing.
300
285
  *
@@ -320,6 +305,30 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
320
305
  * @see {@link closeOutput} To close output
321
306
  */
322
307
  openOutput(): Promise<number>;
308
+ /**
309
+ * Open output file synchronously.
310
+ * Synchronous version of openOutput.
311
+ *
312
+ * Opens output file for writing.
313
+ * I/O context must be set before calling.
314
+ *
315
+ * Direct mapping to avio_open2().
316
+ *
317
+ * @returns 0 on success, negative AVERROR on error:
318
+ * - AVERROR(EIO): I/O error
319
+ * - AVERROR(ENOMEM): Memory allocation failure
320
+ *
321
+ * @example
322
+ * ```typescript
323
+ * import { FFmpegError } from 'node-av';
324
+ *
325
+ * const ret = ctx.openOutputSync();
326
+ * FFmpegError.throwIfError(ret, 'openOutputSync');
327
+ * ```
328
+ *
329
+ * @see {@link openOutput} For async version
330
+ */
331
+ openOutputSync(): number;
323
332
  /**
324
333
  * Close output file.
325
334
  *
@@ -338,6 +347,23 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
338
347
  * @see {@link openOutput} To open output
339
348
  */
340
349
  closeOutput(): Promise<void>;
350
+ /**
351
+ * Close output file synchronously.
352
+ * Synchronous version of closeOutput.
353
+ *
354
+ * Closes the output file and releases I/O resources.
355
+ *
356
+ * Direct mapping to avio_closep().
357
+ *
358
+ * @example
359
+ * ```typescript
360
+ * ctx.closeOutputSync();
361
+ * // Output file closed
362
+ * ```
363
+ *
364
+ * @see {@link closeOutput} For async version
365
+ */
366
+ closeOutputSync(): void;
341
367
  /**
342
368
  * Open input file for reading.
343
369
  *
@@ -347,8 +373,11 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
347
373
  * Direct mapping to avformat_open_input().
348
374
  *
349
375
  * @param url - URL or file path to open
376
+ *
350
377
  * @param fmt - Force specific input format (null for auto-detect)
378
+ *
351
379
  * @param options - Format-specific options
380
+ *
352
381
  * @returns 0 on success, negative AVERROR on error:
353
382
  * - AVERROR_ENOENT: File not found
354
383
  * - AVERROR_INVALIDDATA: Invalid file format
@@ -366,6 +395,72 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
366
395
  * @see {@link closeInput} To close input
367
396
  */
368
397
  openInput(url: string, fmt?: InputFormat | null, options?: Dictionary | null): Promise<number>;
398
+ /**
399
+ * Open an input file or URL synchronously.
400
+ * Synchronous version of openInput.
401
+ *
402
+ * Opens a media file or stream for reading.
403
+ * The format is auto-detected if not specified.
404
+ *
405
+ * Direct mapping to avformat_open_input().
406
+ *
407
+ * @param url - File path or URL to open
408
+ *
409
+ * @param fmt - Force specific format (null for auto-detect)
410
+ *
411
+ * @param options - Format-specific options
412
+ *
413
+ * @returns 0 on success, negative AVERROR on error:
414
+ * - AVERROR_EINVAL: Invalid arguments
415
+ * - AVERROR(EIO): I/O error
416
+ * - AVERROR(ENOMEM): Memory allocation failure
417
+ *
418
+ * @example
419
+ * ```typescript
420
+ * import { FFmpegError } from 'node-av';
421
+ *
422
+ * const ret = ctx.openInputSync('input.mp4');
423
+ * FFmpegError.throwIfError(ret, 'openInputSync');
424
+ * ```
425
+ *
426
+ * @see {@link openInput} For async version
427
+ */
428
+ openInputSync(url: string, fmt?: InputFormat | null, options?: Dictionary | null): number;
429
+ /**
430
+ * Close an input format context.
431
+ *
432
+ * Closes input file and releases resources.
433
+ *
434
+ * Direct mapping to avformat_close_input().
435
+ *
436
+ * @returns Promise that resolves when closed
437
+ *
438
+ * @example
439
+ * ```typescript
440
+ * await ctx.closeInput();
441
+ * // Input closed and context freed
442
+ * ```
443
+ *
444
+ * @see {@link openInput} To open input
445
+ */
446
+ closeInput(): Promise<void>;
447
+ /**
448
+ * Close an input format context synchronously.
449
+ * Synchronous version of closeInput.
450
+ *
451
+ * Closes input file and releases resources.
452
+ *
453
+ * Direct mapping to avformat_close_input().
454
+ *
455
+ * @example
456
+ * ```typescript
457
+ * ctx.closeInputSync();
458
+ * // Input closed and context freed
459
+ * ```
460
+ *
461
+ * @see {@link closeInput} For async version
462
+ */
463
+ closeInputSync(): void;
369
464
  /**
370
465
  * Analyze streams to get stream info.
371
466
  *
@@ -375,6 +470,7 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
375
470
  * Direct mapping to avformat_find_stream_info().
376
471
  *
377
472
  * @param options - Per-stream options array
473
+ *
378
474
  * @returns >=0 on success, negative AVERROR on error:
379
475
  * - AVERROR_EOF: End of file reached
380
476
  * - AVERROR_ENOMEM: Memory allocation failure
@@ -391,6 +487,33 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
391
487
  * @see {@link openInput} Must be called first
392
488
  */
393
489
  findStreamInfo(options?: Dictionary[] | null): Promise<number>;
490
+ /**
491
+ * Analyze streams to get stream info synchronously.
492
+ * Synchronous version of findStreamInfo.
493
+ *
494
+ * Reads packet headers to fill in stream information.
495
+ * Should be called after openInputSync for accurate stream data.
496
+ *
497
+ * Direct mapping to avformat_find_stream_info().
498
+ *
499
+ * @param options - Options dictionary (single, not array for sync version)
500
+ *
501
+ * @returns >=0 on success, negative AVERROR on error:
502
+ * - AVERROR_EOF: End of file reached
503
+ * - AVERROR_ENOMEM: Memory allocation failure
504
+ *
505
+ * @example
506
+ * ```typescript
507
+ * import { FFmpegError } from 'node-av';
508
+ *
509
+ * const ret = ctx.findStreamInfoSync();
510
+ * FFmpegError.throwIfError(ret, 'findStreamInfoSync');
511
+ * console.log(`Found ${ctx.nbStreams} streams`);
512
+ * ```
513
+ *
514
+ * @see {@link findStreamInfo} For async version
515
+ */
516
+ findStreamInfoSync(options?: Dictionary | null): number;
394
517
  /**
395
518
  * Read next packet from the input.
396
519
  *
@@ -400,6 +523,7 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
400
523
  * Direct mapping to av_read_frame().
401
524
  *
402
525
  * @param pkt - Packet to read into
526
+ *
403
527
  * @returns 0 on success, negative AVERROR on error:
404
528
  * - AVERROR_EOF: End of file
405
529
  * - AVERROR_EAGAIN: Temporarily unavailable
@@ -427,6 +551,44 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
427
551
  * @see {@link seekFrame} To seek before reading
428
552
  */
429
553
  readFrame(pkt: Packet): Promise<number>;
554
+ /**
555
+ * Read next packet from the input synchronously.
556
+ * Synchronous version of readFrame.
557
+ *
558
+ * Reads and returns the next packet in the stream.
559
+ * Packet must be unreferenced after use.
560
+ *
561
+ * Direct mapping to av_read_frame().
562
+ *
563
+ * @param pkt - Packet to read into
564
+ *
565
+ * @returns 0 on success, negative AVERROR on error:
566
+ * - AVERROR_EOF: End of file
567
+ * - AVERROR_EAGAIN: Temporarily unavailable
568
+ *
569
+ * @example
570
+ * ```typescript
571
+ * import { FFmpegError } from 'node-av';
572
+ * import { AVERROR_EOF } from 'node-av';
573
+ *
574
+ * const packet = new Packet();
575
+ * packet.alloc();
576
+ *
577
+ * let ret;
578
+ * while ((ret = ctx.readFrameSync(packet)) >= 0) {
579
+ * // Process packet
580
+ * console.log(`Stream ${packet.streamIndex}, PTS: ${packet.pts}`);
581
+ * packet.unref();
582
+ * }
583
+ *
584
+ * if (ret !== AVERROR_EOF) {
585
+ * FFmpegError.throwIfError(ret, 'readFrameSync');
586
+ * }
587
+ * ```
588
+ *
589
+ * @see {@link readFrame} For async version
590
+ */
591
+ readFrameSync(pkt: Packet): number;
430
592
  /**
431
593
  * Seek to timestamp in stream.
432
594
  *
@@ -435,8 +597,11 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
435
597
  * Direct mapping to av_seek_frame().
436
598
  *
437
599
  * @param streamIndex - Stream to seek in (-1 for default)
600
+ *
438
601
  * @param timestamp - Target timestamp in stream time base
602
+ *
439
603
  * @param flags - Seek flags (AVSEEK_FLAG_*)
604
+ *
440
605
  * @returns >=0 on success, negative AVERROR on error:
441
606
  * - AVERROR_EINVAL: Invalid parameters
442
607
  * - AVERROR_EOF: Seek beyond file
@@ -454,6 +619,39 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
454
619
  * @see {@link seekFile} For more precise seeking
455
620
  */
456
621
  seekFrame(streamIndex: number, timestamp: bigint, flags?: AVSeekFlag): Promise<number>;
622
+ /**
623
+ * Seek to timestamp in stream synchronously.
624
+ * Synchronous version of seekFrame.
625
+ *
626
+ * Seeks to closest keyframe at or before timestamp.
627
+ * Timestamp is in stream timebase units.
628
+ *
629
+ * Direct mapping to av_seek_frame().
630
+ *
631
+ * @param streamIndex - Stream to seek in (-1 for default)
632
+ *
633
+ * @param timestamp - Target timestamp in stream timebase
634
+ *
635
+ * @param flags - Seek flags (AVSEEK_FLAG_*)
636
+ *
637
+ * @returns >=0 on success, negative AVERROR on error:
638
+ * - AVERROR_EINVAL: Invalid arguments
639
+ * - AVERROR(EIO): I/O error
640
+ *
641
+ * @example
642
+ * ```typescript
643
+ * import { FFmpegError } from 'node-av';
644
+ * import { AVSEEK_FLAG_BACKWARD } from 'node-av/constants';
645
+ *
646
+ * // Seek to 10 seconds
647
+ * const timestamp = 10n * 1000000n; // Assuming microsecond timebase
648
+ * const ret = ctx.seekFrameSync(-1, timestamp, AVSEEK_FLAG_BACKWARD);
649
+ * FFmpegError.throwIfError(ret, 'seekFrameSync');
650
+ * ```
651
+ *
652
+ * @see {@link seekFrame} For async version
653
+ */
654
+ seekFrameSync(streamIndex: number, timestamp: bigint, flags?: AVSeekFlag): number;
457
655
  /**
458
656
  * Seek to timestamp with bounds.
459
657
  *
@@ -462,10 +660,15 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
462
660
  * Direct mapping to avformat_seek_file().
463
661
  *
464
662
  * @param streamIndex - Stream to seek in (-1 for default)
663
+ *
465
664
  * @param minTs - Minimum acceptable timestamp
665
+ *
466
666
  * @param ts - Target timestamp
667
+ *
467
668
  * @param maxTs - Maximum acceptable timestamp
669
+ *
468
670
  * @param flags - Seek flags
671
+ *
469
672
  * @returns >=0 on success, negative AVERROR on error
470
673
  *
471
674
  * @example
@@ -495,6 +698,7 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
495
698
  * Direct mapping to avformat_write_header().
496
699
  *
497
700
  * @param options - Muxer-specific options
701
+ *
498
702
  * @returns 0 on success, negative AVERROR on error:
499
703
  * - AVERROR_EINVAL: Invalid parameters
500
704
  * - AVERROR_EIO: I/O error
@@ -512,6 +716,31 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
512
716
  * @see {@link writeFrame} To write packets
513
717
  */
514
718
  writeHeader(options?: Dictionary | null): Promise<number>;
719
+ /**
720
+ * Write file header synchronously.
721
+ * Synchronous version of writeHeader.
722
+ *
723
+ * Writes format header to output file.
724
+ * Must be called before writing packets.
725
+ *
726
+ * Direct mapping to avformat_write_header().
727
+ *
728
+ * @param options - Muxer-specific options
729
+ *
730
+ * @returns 0 on success, negative AVERROR on error:
731
+ * - AVERROR_EINVAL: Invalid parameters
732
+ *
733
+ * @example
734
+ * ```typescript
735
+ * import { FFmpegError } from 'node-av';
736
+ *
737
+ * const ret = ctx.writeHeaderSync();
738
+ * FFmpegError.throwIfError(ret, 'writeHeaderSync');
739
+ * ```
740
+ *
741
+ * @see {@link writeHeader} For async version
742
+ */
743
+ writeHeaderSync(options?: Dictionary | null): number;
515
744
  /**
516
745
  * Write packet to output.
517
746
  *
@@ -521,6 +750,7 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
521
750
  * Direct mapping to av_write_frame().
522
751
  *
523
752
  * @param pkt - Packet to write (null to flush)
753
+ *
524
754
  * @returns 0 on success, negative AVERROR on error:
525
755
  * - AVERROR_EINVAL: Invalid packet
526
756
  * - AVERROR_EIO: I/O error
@@ -536,6 +766,30 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
536
766
  * @see {@link interleavedWriteFrame} For automatic interleaving
537
767
  */
538
768
  writeFrame(pkt: Packet | null): Promise<number>;
769
+ /**
770
+ * Write packet to output synchronously.
771
+ * Synchronous version of writeFrame.
772
+ *
773
+ * Writes a packet directly without interleaving.
774
+ * Caller must handle correct interleaving.
775
+ *
776
+ * Direct mapping to av_write_frame().
777
+ *
778
+ * @param pkt - Packet to write (null to flush)
779
+ *
780
+ * @returns 0 on success, negative AVERROR on error
781
+ *
782
+ * @example
783
+ * ```typescript
784
+ * import { FFmpegError } from 'node-av';
785
+ *
786
+ * const ret = ctx.writeFrameSync(packet);
787
+ * FFmpegError.throwIfError(ret, 'writeFrameSync');
788
+ * ```
789
+ *
790
+ * @see {@link writeFrame} For async version
791
+ */
792
+ writeFrameSync(pkt: Packet | null): number;
539
793
  /**
540
794
  * Write packet with automatic interleaving.
541
795
  *
@@ -545,6 +799,7 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
545
799
  * Direct mapping to av_interleaved_write_frame().
546
800
  *
547
801
  * @param pkt - Packet to write (null to flush)
802
+ *
548
803
  * @returns 0 on success, negative AVERROR on error:
549
804
  * - AVERROR_EINVAL: Invalid packet
550
805
  * - AVERROR_EIO: I/O error
@@ -564,6 +819,36 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
564
819
  * @see {@link writeFrame} For direct writing
565
820
  */
566
821
  interleavedWriteFrame(pkt: Packet | null): Promise<number>;
822
+ /**
823
+ * Write packet with automatic interleaving synchronously.
824
+ * Synchronous version of interleavedWriteFrame.
825
+ *
826
+ * Writes packet with proper interleaving for muxing.
827
+ * Preferred method for writing packets.
828
+ *
829
+ * Direct mapping to av_interleaved_write_frame().
830
+ *
831
+ * @param pkt - Packet to write (null to flush)
832
+ *
833
+ * @returns 0 on success, negative AVERROR on error:
834
+ * - AVERROR_EINVAL: Invalid parameters
835
+ * - AVERROR(EIO): I/O error
836
+ *
837
+ * @example
838
+ * ```typescript
839
+ * import { FFmpegError } from 'node-av';
840
+ *
841
+ * // Write packet
842
+ * const ret = ctx.interleavedWriteFrameSync(packet);
843
+ * FFmpegError.throwIfError(ret, 'interleavedWriteFrameSync');
844
+ *
845
+ * // Flush interleaved packets
846
+ * ctx.interleavedWriteFrameSync(null);
847
+ * ```
848
+ *
849
+ * @see {@link interleavedWriteFrame} For async version
850
+ */
851
+ interleavedWriteFrameSync(pkt: Packet | null): number;
567
852
  /**
568
853
  * Write file trailer.
569
854
  *
@@ -587,6 +872,29 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
587
872
  * @see {@link writeHeader} Must be called first
588
873
  */
589
874
  writeTrailer(): Promise<number>;
875
+ /**
876
+ * Write file trailer synchronously.
877
+ * Synchronous version of writeTrailer.
878
+ *
879
+ * Finalizes the output file, writing index and metadata.
880
+ * Must be called to properly close output files.
881
+ *
882
+ * Direct mapping to av_write_trailer().
883
+ *
884
+ * @returns 0 on success, negative AVERROR on error
885
+ *
886
+ * @example
887
+ * ```typescript
888
+ * import { FFmpegError } from 'node-av';
889
+ *
890
+ * const ret = ctx.writeTrailerSync();
891
+ * FFmpegError.throwIfError(ret, 'writeTrailerSync');
892
+ * // File is now finalized
893
+ * ```
894
+ *
895
+ * @see {@link writeTrailer} For async version
896
+ */
897
+ writeTrailerSync(): number;
590
898
  /**
591
899
  * Flush buffered data.
592
900
  *
@@ -596,11 +904,28 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
596
904
  *
597
905
  * @example
598
906
  * ```typescript
599
- * ctx.flush();
907
+ * await ctx.flush();
908
+ * // Buffered data written to output
909
+ * ```
910
+ */
911
+ flush(): Promise<void>;
912
+ /**
913
+ * Flush buffered data synchronously.
914
+ * Synchronous version of flush.
915
+ *
916
+ * Flushes any buffered packets in muxers.
917
+ *
918
+ * Direct mapping to avio_flush().
919
+ *
920
+ * @example
921
+ * ```typescript
922
+ * ctx.flushSync();
600
923
  * // Buffered data written to output
601
924
  * ```
925
+ *
926
+ * @see {@link flush} For async version
602
927
  */
603
- flush(): void;
928
+ flushSync(): void;
604
929
  /**
605
930
  * Print format information.
606
931
  *
@@ -610,7 +935,9 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
610
935
  * Direct mapping to av_dump_format().
611
936
  *
612
937
  * @param index - Stream index to highlight (-1 for none)
938
+ *
613
939
  * @param url - URL to display
940
+ *
614
941
  * @param isOutput - True for output format, false for input
615
942
  *
616
943
  * @example
@@ -631,8 +958,11 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
631
958
  * Direct mapping to av_find_best_stream().
632
959
  *
633
960
  * @param type - Media type to find (AVMEDIA_TYPE_*)
961
+ *
634
962
  * @param wantedStreamNb - Preferred stream index (-1 for auto)
963
+ *
635
964
  * @param relatedStream - Related stream for audio/video sync (-1 for none)
965
+ *
636
966
  * @returns Stream index, or negative AVERROR if not found
637
967
  *
638
968
  * @example
@@ -655,10 +985,15 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
655
985
  * Find the best stream and its decoder.
656
986
  *
657
987
  * @param type - Media type to find
988
+ *
658
989
  * @param wantedStreamNb - Preferred stream index
990
+ *
659
991
  * @param relatedStream - Related stream index
992
+ *
660
993
  * @param wantDecoder - True to also find decoder
994
+ *
661
995
  * @param flags - Reserved flags
996
+ *
662
997
  * @returns Object with stream index and decoder
663
998
  */
664
999
  findBestStream(type: AVMediaType, wantedStreamNb: number, relatedStream: number, wantDecoder: true, flags?: number): {
@@ -673,6 +1008,7 @@ export declare class FormatContext extends OptionMember<NativeFormatContext> imp
673
1008
  * Direct mapping to avformat_new_stream().
674
1009
  *
675
1010
  * @param c - Codec for the stream (optional)
1011
+ *
676
1012
  * @returns New stream instance
677
1013
  *
678
1014
  * @example