@overwolf/ow-electron-packages-types 0.1.0-beta.2 → 0.1.0-beta.4

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,1177 +1,1177 @@
1
- import { GameInfo } from "../common/common";
2
-
3
- type Rect = { top: number; left: number; width: number; height: number };
4
-
5
- export type AudioDeviceType = 'input' | 'output';
6
-
7
- export declare type kSupportedEncodersTypes =
8
- | 'ffmpeg_svt_av1'
9
- | 'ffmpeg_aom_av1'
10
- | 'jim_nvenc'
11
- | 'jim_hevc_nvenc'
12
- | 'jim_av1_nvenc'
13
- | 'obs_x264'
14
- | 'h264_texture_amf'
15
- | 'h265_texture_amf'
16
- | 'av1_texture_amf'
17
- | 'obs_qsv11_v2'
18
- | 'obs_qsv11_hevc'
19
- | 'obs_qsv11_av1';
20
-
21
- export declare type kKnownAudioEncodersTypes =
22
- | 'ffmpeg_aac'
23
- | 'ffmpeg_opus'
24
- | 'ffmpeg_pcm_s16le'
25
- | 'ffmpeg_pcm_s24le'
26
- | 'ffmpeg_pcm_f32le'
27
- | 'ffmpeg_alac'
28
- | 'ffmpeg_flac'
29
- | string;
30
-
31
- // Sample Rate
32
- export declare type kSampleRate48kHz = 48000;
33
- export declare type kSampleRate441kHz = 44100;
34
- export declare type kSpeakerLayout =
35
- | 'SPEAKERS_MONO'
36
- | 'SPEAKERS_STEREO'
37
- | 'SPEAKERS_2POINT1'
38
- | 'SPEAKERS_4POINT0'
39
- | 'SPEAKERS_4POINT1'
40
- | 'SPEAKERS_5POINT1'
41
- | 'SPEAKERS_7POINT1';
42
-
43
- export const enum AudioTracks {
44
- None = 0,
45
- Track1 = 1 << 0,
46
- Track2 = 1 << 1, // 0010
47
- Track3 = 1 << 2, // 0100
48
- Track4 = 1 << 3, // 1000
49
- Track5 = 1 << 4, // 1000
50
- Track6 = 1 << 5, // 1000
51
- All = 0xff,
52
- }
53
-
54
- export const enum DisplayCaptureType {
55
- Auto = 0,
56
-
57
- /** Direct Duplicator */
58
- DXGI = 1,
59
-
60
- /**
61
- * Windows 10 (1903 and up)
62
- */
63
- WGC = 2,
64
-
65
- /**
66
- * Compatibility mode
67
- */
68
- BitBlt = 3,
69
- }
70
-
71
- export declare type CaptureSourceType = 'Display' | 'Game' | 'Window';
72
-
73
- export interface AudioDevice {
74
- readonly type: AudioDeviceType;
75
- readonly id: string;
76
- readonly name: string;
77
- readonly isDefault: boolean;
78
- }
79
-
80
- export interface EncoderInfoBase {
81
- readonly codec: string;
82
- readonly name: string;
83
- }
84
-
85
- export interface EncoderProperty {
86
- readonly default: any;
87
- readonly description: string;
88
- readonly values?: Record<string | number, string>;
89
- }
90
-
91
- export interface AudioEncoderInfo extends EncoderInfoBase {
92
- readonly type: kKnownAudioEncodersTypes;
93
- }
94
-
95
- export interface VideoEncoderInfo extends EncoderInfoBase {
96
- readonly type: kSupportedEncodersTypes;
97
- readonly properties?: Record<string, EncoderProperty>;
98
- }
99
-
100
- export interface AdapterInfo {
101
- readonly index: 0;
102
- readonly name: string;
103
- readonly driver: string;
104
- readonly hagsEnabled: boolean;
105
- readonly hagsEnabledByDefault: boolean;
106
- }
107
-
108
- export interface AudioInformation {
109
- readonly inputDevices: AudioDevice[];
110
- readonly outputDevices: AudioDevice[];
111
- readonly encoders: AudioEncoderInfo[];
112
-
113
- readonly defaultEncoder: kKnownAudioEncodersTypes;
114
- }
115
-
116
- export interface MonitorInfo {
117
- readonly adapterIndex: number;
118
- readonly id: string;
119
- readonly altId: string;
120
- readonly dpi: number;
121
- readonly attachedToDesktop: boolean;
122
- readonly friendlyName: string;
123
- readonly refreshRate: number;
124
- readonly rect: Rect;
125
- readonly isPrimary: boolean;
126
- readonly displayIndex: number;
127
- }
128
-
129
- export interface VideoInformation {
130
- readonly encoders: VideoEncoderInfo[];
131
- readonly adapters: AdapterInfo[];
132
-
133
- readonly defaultEncoder: kSupportedEncodersTypes;
134
- }
135
-
136
- export interface RecordingInformation {
137
- audio: AudioInformation;
138
- video: VideoInformation;
139
- monitors: MonitorInfo[];
140
- }
141
-
142
- // Video settings
143
- export declare type kFileFormat =
144
- | 'fragmented_mp4'
145
- | 'fragmented_mov'
146
- | 'mp4'
147
- | 'flv'
148
- | 'mkv'
149
- | 'mov'
150
- | 'mpegts'
151
- | 'hls';
152
-
153
- export declare type kVideoColorFormat =
154
- | 'NV12'
155
- | 'I420'
156
- | 'I444'
157
- | 'P010'
158
- | 'I010'
159
- | 'P216'
160
- | 'P416'
161
- | 'BGRA';
162
-
163
- export declare type kVideoColorSpec =
164
- | 'sRGB'
165
- | '709'
166
- | '601'
167
- | '2100PQ'
168
- | '2100HLG';
169
-
170
- export declare type kVideoColorRange = 'Partial' | 'Full';
171
-
172
- // encoder AMD
173
- export declare type kAMDEncoderRateControl =
174
- | 'CBR'
175
- | 'CQP'
176
- | 'VBR'
177
- | 'VBR_LAT'
178
- | 'QVBR'
179
- | 'HQVBR'
180
- | 'HQCBR';
181
-
182
- export declare type kAMDEncoderPreset = 'quality' | 'balanced' | 'speed';
183
- export declare type kAMDEncoderPresetAV1 = kAMDEncoderPreset | 'highQuality';
184
- export declare type kAMDEncoderProfileAV1 = 'main';
185
- export declare type kAMDEncoderProfile264 =
186
- | kAMDEncoderProfileAV1
187
- | 'high'
188
- | 'baseline';
189
-
190
- // encoder NVENC
191
- export declare type kNVENCEncoderRateControl =
192
- | 'CBR'
193
- | 'CQP'
194
- | 'VBR'
195
- | 'Lossless';
196
- export declare type kNVENCEncoderMultipass = 'qres' | 'fullres' | 'disabled';
197
- export declare type kNVENCEncoderTuning = 'hq' | 'll' | 'ull';
198
- export declare type kNVENCEncoderProfile = 'main';
199
- export declare type kNVENCEncoderProfile264 =
200
- | kNVENCEncoderProfile
201
- | 'high'
202
- | 'baseline';
203
- export declare type kNVENCEncoderProfileHEVC = kNVENCEncoderProfile | 'main10';
204
-
205
- // encoder X264
206
- export declare type kX264EncoderRateControl = 'CBR' | 'ABR' | 'VBR' | 'CRF';
207
-
208
- export declare type kX264EncoderProfile = '' | 'baseline' | 'main' | 'high';
209
- export declare type kX264EncoderTune =
210
- | ''
211
- | 'film'
212
- | 'animation'
213
- | 'grain'
214
- | 'stillimage'
215
- | 'psnr'
216
- | 'ssim'
217
- | 'fastdecode'
218
- | 'zerolatency';
219
-
220
- export declare type kX264EncoderPreset =
221
- | 'ultrafast'
222
- | 'superfast'
223
- | 'veryfast' // default
224
- | 'faster'
225
- | 'fast'
226
- | 'medium'
227
- | 'slow'
228
- | 'slower'
229
- | 'veryslow'
230
- | 'placebo';
231
-
232
- // QuickSync
233
-
234
- export declare type kQuickSyncEncoderProfileHEVC = kNVENCEncoderProfileHEVC;
235
- export declare type kQuickSyncEncoderProfile264 = kNVENCEncoderProfile264;
236
- export declare type kQuickSyncTargetUsage =
237
- | 'TU1' // Slowest (Best Quality)
238
- | 'TU2' // Slower
239
- | 'TU3' // Slow
240
- | 'TU4' // Balanced (Medium Quality)
241
- | 'TU5' // Fast
242
- | 'TU6' // Faster
243
- | 'TU7'; // Fastest (Best Speed)
244
-
245
- export declare type kQuickSyncEncoderRateControl =
246
- | 'CBR'
247
- | 'CQP'
248
- | 'VBR'
249
- | 'ICQ';
250
-
251
- export declare type VideoRecordingSplitType = 'byTime' | 'bySize' | 'manual';
252
-
253
- export interface VideoSettings {
254
- /*
255
- Base width resolution. Default Half HD (main monitor ratio)
256
- */
257
- baseWidth: number;
258
-
259
- /*
260
- Base height resolution. Default Half HD (main monitor ratio)
261
- */
262
- baseHeight: number;
263
-
264
- /**
265
- * Video FPS.
266
- *
267
- * Default is 30.
268
- */
269
- fps?: number;
270
-
271
- /**
272
- * Output (scaled) resolution. Default is same as baseWidth
273
- */
274
- outputWidth?: number;
275
-
276
- /**
277
- * Output (scaled) resolution. Default is same as baseHeight
278
- */
279
- outputHeight?: number;
280
-
281
- /** Default is 'NV12' */
282
- colorFormat?: kVideoColorFormat;
283
-
284
- /**
285
- * Default is '709'
286
- */
287
- colorRange?: kVideoColorRange;
288
-
289
- /**
290
- * Default is Partial
291
- */
292
- colorSpec?: kVideoColorSpec;
293
-
294
- /**
295
- * Default is 300 nits
296
- */
297
- sdrWhite?: number;
298
-
299
- /*
300
- *Default is 1000 nits
301
- */
302
- hdrPeak?: number;
303
- }
304
-
305
- export interface AudioDeviceSettings {
306
- /**
307
- * 0.0 - 20.0, default is 1.0 (100%)
308
- */
309
- volume?: number;
310
-
311
- /**
312
- * Default is False
313
- */
314
- mono?: boolean;
315
-
316
- /**
317
- * 0.0. - 1.0. Default is 0.5
318
- * */
319
- balance?: number;
320
-
321
- /**
322
- * include Device tracks. default is include to all
323
- */
324
- tracks?: AudioTracks;
325
-
326
- /**
327
- *
328
- */
329
- use_device_timing?: boolean;
330
- }
331
-
332
- export interface AudioDeviceSettingsInfo extends AudioDeviceSettings {
333
- readonly type: AudioDeviceType;
334
-
335
- /**
336
- * Device Id
337
- */
338
- readonly id: string;
339
-
340
- /**
341
- * Audio device unique name or Process name for application
342
- */
343
- readonly name: string;
344
- }
345
-
346
- export interface ApplicationAudioDeviceSettingsInfo extends AudioDeviceSettingsInfo {
347
- readonly type: 'output';
348
- }
349
-
350
- export interface DefaultAudioDeviceParams {
351
- /**
352
- * Auto Separate audio tracks
353
- * when using the default audio sources, the Input and the Output audio sources
354
- * will use dedicate tracks (2, 3).
355
- * and track number 1 include both
356
- */
357
- separateAudioTracks?: boolean;
358
- }
359
-
360
- export interface AudioDeviceParams extends DefaultAudioDeviceParams {
361
- /**
362
- * Device Id
363
- */
364
- id: string;
365
-
366
- /**
367
- * Audio device unique name
368
- */
369
- name: string;
370
- }
371
-
372
- export interface ApplicationAudioCaptureParams
373
- extends DefaultAudioDeviceParams {
374
- /**
375
- * Process name to capture (i.e Discord.exe or minecraft.exe)
376
- */
377
- processName: string;
378
- }
379
-
380
- export interface AudioGeneralSettings {
381
- /**
382
- * Audio sample rate.
383
- * Default is 48000
384
- */
385
- sampleRate?: kSampleRate48kHz | kSampleRate441kHz;
386
-
387
- /**
388
- * Speaker layout.
389
- * Default is Stereo
390
- */
391
- speakerLayer?: kSpeakerLayout;
392
-
393
- /**
394
- * Win32 only. Default it True
395
- */
396
- disableAudioDucking?: boolean;
397
-
398
- /**
399
- *
400
- */
401
- lowLatencyAudioBuffering?: boolean;
402
- }
403
-
404
- export interface CaptureSourceSettings {
405
- /**
406
- * Source will be center and stretch (if needed) to video output size
407
- * (Default is True)
408
- */
409
- stretchToOutputSize?: boolean;
410
- }
411
-
412
- export interface MonitorCaptureSourceSettings extends CaptureSourceSettings {
413
- monitorId: string;
414
-
415
- /**
416
- * Default is Auto
417
- */
418
- type?: DisplayCaptureType;
419
-
420
- /**
421
- *Capture mouse cursor. Default is true.
422
- */
423
- captureCursor?: boolean;
424
-
425
- /**
426
- *
427
- */
428
- forceSDR?: boolean;
429
- }
430
-
431
- export interface GameCaptureSourceSettings extends CaptureSourceSettings {
432
- /**
433
- * Game Process to capture, may contain the process name or process Id.
434
- */
435
- gameProcess: string | number;
436
-
437
- /**
438
- * Slow capture. using shared memory
439
- */
440
- sliCompatibility?: boolean;
441
-
442
- /**
443
- *Capture mouse cursor. Default is true.
444
- */
445
- captureCursor?: boolean;
446
-
447
- /**
448
- *
449
- */
450
- allowTransparency?: boolean;
451
-
452
- /**
453
- *
454
- */
455
- premultipliedAlpha?: boolean;
456
-
457
- /**
458
- *Capture third-party overlays
459
- */
460
- captureOverlays?: boolean;
461
-
462
- /**
463
- * Limit capture framerate
464
- */
465
- limitFramerate?: boolean;
466
-
467
- /**
468
- *Use Rec.2100 (PQ) instead sRGB
469
- */
470
- rgb10a2Space?: boolean;
471
- }
472
-
473
- export interface CaptureSource {
474
- readonly type: CaptureSourceType;
475
- readonly properties: any;
476
- }
477
-
478
- export interface GameCaptureSource extends CaptureSource {
479
- readonly type: 'Game';
480
- readonly properties: GameCaptureSourceSettings;
481
- }
482
-
483
- export interface MonitorCaptureSource extends CaptureSource {
484
- readonly type: 'Display';
485
- readonly properties: MonitorCaptureSourceSettings;
486
- }
487
-
488
- export interface AudioSettings extends AudioGeneralSettings {
489
- inputs: AudioDeviceSettingsInfo[];
490
- outputs: AudioDeviceSettingsInfo[];
491
- applications: ApplicationAudioDeviceSettingsInfo[];
492
- }
493
-
494
- export interface VideoEncoderSettingsBase {
495
- type: kSupportedEncodersTypes;
496
-
497
- /**
498
- * Bitrate.
499
- *
500
- * Default is 8000
501
- */
502
- bitrate?: number;
503
-
504
- /**
505
- * Key frame in second.
506
- *
507
- * Default is 0 (i.e auto)
508
- */
509
- keyint_sec?: number;
510
-
511
- /**
512
- * Max bitrate
513
- */
514
- max_bitrate?: number;
515
- }
516
-
517
- /**
518
- * NVENC encoder setting
519
- */
520
- export interface EncoderSettingsNVENC extends VideoEncoderSettingsBase {
521
- /**
522
- * Rate Control. Default is 'CBR'
523
- */
524
- rate_control?: kNVENCEncoderRateControl;
525
-
526
- /**
527
- * Default is p5.
528
- *
529
- * 'p1' - Fastest (Lowest Quality)
530
- *
531
- * 'p2' - Faster (Lower Quality)
532
- *
533
- * 'p3' - Fast (Low Quality)
534
- *
535
- * 'p4' - Medium (Medium Quality)
536
- *
537
- * 'p5' - Slow (Good Quality) - Default
538
- *
539
- * 'p6' - Slower (Better Quality)
540
- *
541
- * 'p7' - Slowest (Best Quality)
542
- */
543
- preset2?: 'p1' | 'p2' | 'p3' | 'p4' | 'p5' | 'p6' | 'p7';
544
-
545
- /**
546
- * 'qres' - Two Passes (Quarter Resolution) - Default
547
- *
548
- * 'disabled' - Single Pass
549
- *
550
- * 'fullres' - Two Passes (Full Resolution)
551
- */
552
- multipass?: kNVENCEncoderMultipass;
553
-
554
- /**
555
- * Default is 'hq'
556
- */
557
- tune?: kNVENCEncoderTuning;
558
-
559
- /**
560
- * Default is True
561
- */
562
- psycho_aq?: boolean;
563
-
564
- /**
565
- * B-Frame. Default is 2
566
- */
567
- bf?: number;
568
-
569
- /**
570
- * Enables dynamic B-frames.If disabled, the encoder will always use the number
571
- * of B-frames specified in the 'Max B-frames' setting.\n\nIf enabled,
572
- * it will increase visual quality by only using however many B-frames
573
- * are necessary, up to the maximum,\nat the cost of increased GPU utilization.
574
- * Default is False.
575
- */
576
- lookahead?: boolean;
577
-
578
- /**
579
- * Gpu index. Default is 0
580
- */
581
- gpu?: number;
582
-
583
- /**
584
- * Default is 'main'
585
- */
586
- profile?: kNVENCEncoderProfile | string;
587
- }
588
-
589
- export interface EncoderSettingsNVENC264 extends EncoderSettingsNVENC {
590
- /**
591
- * Profile (Default is 'high')
592
- */
593
- profile?: kNVENCEncoderProfile264;
594
- }
595
-
596
- export interface EncoderSettingsNVENCHEVC extends EncoderSettingsNVENC {
597
- /**
598
- * Profile (Default is 'main')
599
- */
600
- profile?: kNVENCEncoderProfileHEVC;
601
- }
602
-
603
- // AMD
604
- export interface EncoderSettingsAMF extends VideoEncoderSettingsBase {
605
- /**
606
- * Rate Control. Default is 'CBR'
607
- */
608
- rate_control?: kAMDEncoderRateControl;
609
-
610
- /**
611
- * Use to specify custom AMF or FFmpeg options.
612
- * For example, \"level=5.2 profile=main\". Check the AMF encoder docs for more details.
613
- */
614
- ffmpeg_opts?: string;
615
-
616
- /**
617
- * CPQ (Default is 20)
618
- */
619
- cpq?: number;
620
-
621
- /**
622
- * Max B-frames (Default is 3)
623
- */
624
- bf?: number;
625
- }
626
-
627
- export interface EncoderSettingsAMFAV1 extends EncoderSettingsAMF {
628
- /**
629
- * Preset (Default is main)
630
- */
631
- profile?: kAMDEncoderProfileAV1;
632
-
633
- /**
634
- * preset
635
- */
636
- preset?: kAMDEncoderPresetAV1;
637
- }
638
-
639
- export interface EncoderSettingsAMF264 extends EncoderSettingsAMF {
640
- /**
641
- * Preset (Default is high)
642
- */
643
- profile?: kAMDEncoderProfile264;
644
-
645
- /*
646
- * preset
647
- */
648
- preset?: kAMDEncoderPreset;
649
- }
650
-
651
- export interface EncoderSettingsAMFHVEC extends EncoderSettingsAMF {
652
- /*
653
- * preset
654
- */
655
- preset?: kAMDEncoderPreset;
656
- }
657
-
658
- export interface EncoderSettingsQuickSync extends VideoEncoderSettingsBase {
659
- /**
660
- * Rate Control (Default is 'CBR')
661
- */
662
- rate_control?: kQuickSyncEncoderRateControl;
663
-
664
- /**
665
- * Target Usage / Preset (Default is 'TU4' - Balanced (Medium Quality))
666
- */
667
- target_usage?: kQuickSyncTargetUsage;
668
-
669
- /**
670
- * bFrames (Default is 3)
671
- */
672
- bframes?: number;
673
-
674
- /**
675
- * Subjective Video Enhancements (Default is 'true')
676
- */
677
- enhancements?: boolean;
678
- }
679
-
680
- export interface EncoderSettingsQuickSync264 extends EncoderSettingsQuickSync {
681
- /**
682
- * Profile (Default 'high' for x264 and 'main' for 'HEVC' or 'AV1' )
683
- */
684
- profile?: kQuickSyncEncoderProfile264;
685
- }
686
-
687
- export interface EncoderSettingsQuickSyncHEVC extends EncoderSettingsQuickSync {
688
- /**
689
- * Profile (Default 'high' for x264 and 'main' for 'HEVC' or 'AV1' )
690
- */
691
- profile?: kQuickSyncEncoderProfileHEVC;
692
- }
693
-
694
- export interface EncoderSettingsX264 extends VideoEncoderSettingsBase {
695
- /**
696
- * Rate Control (Default is rate_control);
697
- */
698
- rate_control?: kX264EncoderRateControl;
699
-
700
- /**
701
- * Preset (Default is 'veryfast')
702
- */
703
- preset?: kX264EncoderPreset;
704
-
705
- /**
706
- * Profile (Default is None)
707
- */
708
- profile?: kX264EncoderProfile;
709
-
710
- /**
711
- * Tun (Default is None)
712
- */
713
- tune?: kX264EncoderTune;
714
-
715
- /**
716
- * x264 Options (separated by space)
717
- */
718
- x264opts?: string;
719
-
720
- /**
721
- * Use Custom buffer size
722
- */
723
- use_bufsize?: boolean;
724
-
725
- /**
726
- * Custom buffer size (Valid when 'use_bufsize' is true)
727
- */
728
- buffer_size?: number;
729
- }
730
-
731
- export interface EncoderSettingsQuickSyncH264 extends VideoEncoderSettingsBase {
732
- profile?: kQuickSyncEncoderProfile264;
733
- }
734
-
735
- export interface CaptureSettings {
736
- videoSettings: VideoSettings;
737
-
738
- audioSettings: AudioSettings;
739
-
740
- videoEncoderSettings: VideoEncoderSettingsBase;
741
-
742
- audioEncoder: AudioEncoderInfo;
743
-
744
- sources: CaptureSource[];
745
- }
746
-
747
- export interface CaptureSettingsBuilder extends CaptureSettings {
748
- /**
749
- * Add Screen video capture source
750
- * @param settings
751
- */
752
- addScreenSource(
753
- settings: MonitorCaptureSourceSettings
754
- ): CaptureSettingsBuilder;
755
-
756
- /**
757
- * Add Game video capture source
758
- * @param settings
759
- */
760
- addGameSource(settings: GameCaptureSourceSettings):
761
- CaptureSettingsBuilder;
762
-
763
- /**
764
- * Add Audio device capture
765
- */
766
- addAudioCapture(
767
- params: AudioDeviceParams,
768
- settings?: AudioDeviceSettings
769
- ): CaptureSettingsBuilder;
770
-
771
- /**
772
- * Add Default device (Input or Output) if not already added
773
- * @param type
774
- * @param params
775
- * @param settings
776
- */
777
- addAudioDefaultCapture(
778
- type: AudioDeviceType,
779
- params?: DefaultAudioDeviceParams,
780
- settings?: AudioDeviceSettings
781
- ): CaptureSettingsBuilder;
782
-
783
- /**
784
- *
785
- * @param param
786
- * @param settings
787
- */
788
- addApplicationAudioCapture(
789
- param: ApplicationAudioCaptureParams,
790
- settings?: AudioDeviceSettings
791
- ): CaptureSettingsBuilder;
792
-
793
- /**
794
- * Return CaptureSettings object
795
- */
796
- build(): CaptureSettings;
797
- }
798
-
799
- export interface CaptureSettingsOptions {
800
- /**
801
- * encoder type to create capture setting.
802
- * Default is the best default encoder detected (GPU -> x264)
803
- */
804
- videoEncoder?: kSupportedEncodersTypes;
805
-
806
- /**
807
- * Default is 'ffmpeg_aac' (FFmpeg AAC).
808
- * use queryInformation().encoders.audio gor supported encoders
809
- */
810
- audioEncoder?: kKnownAudioEncodersTypes;
811
-
812
- /**
813
- * Add Default Audio Devices (Default is True)
814
- */
815
- includeDefaultAudioSources?: boolean;
816
-
817
- /**
818
- * Auto Separate audio tracks
819
- * when using the default audio sources, the Input and the Output audio sources
820
- * will use dedicate tracks (2, 3).
821
- * and track number 1 include both
822
- */
823
- separateAudioTracks?: boolean;
824
- }
825
-
826
- // Obs Query Information types
827
- export interface GraphicsInformation {
828
- adapters: AdapterInfo[];
829
- monitors: MonitorInfo[];
830
- }
831
-
832
- export interface EncoderInformation {
833
- video: VideoEncoderInfo[];
834
- audio: AudioEncoderInfo[];
835
- }
836
-
837
- export interface RecordingAppOptions {
838
- /**
839
- * Show Recorder capture window
840
- */
841
- showDebugWindow?: boolean;
842
-
843
- /**
844
- * Enable recorder debug logs
845
- */
846
- enableDebugLogs?: boolean;
847
-
848
- /**
849
- * Custom command lines when launching recorder
850
- */
851
- customCommandLineArgs?: string[];
852
-
853
- /**
854
- * Override OBS binaries
855
- */
856
- overrideOBSFolder?: string;
857
-
858
- /**
859
- * Emit 'stats' event interval in milliseconds. Default is 2000 (2 second)
860
- * note: set 0 to disable stats emit
861
- */
862
- statsInterval?: number;
863
- }
864
-
865
- export const enum ErrorCode {
866
- /**
867
- * Generic Unknown error
868
- */
869
- Unknown = -1001,
870
-
871
- /**
872
- * Obs process crashed
873
- */
874
- ProcessTerminated = -1000,
875
-
876
- /**
877
- * Missing binaries
878
- */
879
- MissingBinaries = -999,
880
-
881
- /**
882
- * Connection to obs process error
883
- */
884
- ConnectionOBSError = -998,
885
-
886
- /**
887
- * Can't preform request while recording
888
- */
889
- AlreadyRunning = -997,
890
-
891
- /**
892
- *
893
- */
894
- SplitRecordingDisabled = -12,
895
-
896
- /**
897
- *
898
- */
899
- MissingOrInvalidParameters = -11,
900
-
901
- /**
902
- *
903
- */
904
- NoActiveRecording = -10,
905
-
906
- /**
907
- * Encoder error
908
- */
909
- EncoderError = -8,
910
-
911
- /**
912
- * Recording error
913
- */
914
- NoDiskSpaceError = -7,
915
-
916
- /**
917
- * Video file processing error
918
- */
919
- ProcessOutputError = -4,
920
-
921
- /**
922
- * Video bad path
923
- */
924
- BadPathError = -1,
925
-
926
- /**
927
- * Success
928
- */
929
- Success = 0,
930
-
931
- /**
932
- * Stop due to low disk space (less then 50NB left at output folder)
933
- */
934
- SuccessLowDiskSpace = 1,
935
-
936
- /**
937
- * Replay stopped while creating replay (partial video)
938
- */
939
- SuccessWithError = 2,
940
- }
941
-
942
- export interface RecordingBaseOptions {
943
- /**
944
- * Video file format. Default is 'fragmented_mp4'
945
- */
946
- fileFormat?: kFileFormat;
947
-
948
- /**
949
- * Video Audio tracks, default is 'Track1' or 'Track1'| 'Track2' |'Track3'
950
- * if |separateAudioTracks| is on.
951
- */
952
- audioTrack?: AudioTracks;
953
-
954
- /**
955
- * Auto shutdown recording when game exit
956
- * Note: valid when recording with game capture source
957
- */
958
- autoShutdownOnGameExit?: boolean;
959
- }
960
-
961
- /**
962
- *
963
- */
964
- export interface SplitOptions {
965
- //splitType: VideoRecordingSplitType;
966
-
967
- enableManual: boolean;
968
-
969
- /**
970
- * Split video by time (in seconds).
971
- */
972
- maxTimeSecond?: number;
973
-
974
- /**
975
- * Split video by size (MB).
976
- */
977
- maxBySizeMB?: number;
978
-
979
- /**
980
- * Full video will be recorded to disk
981
- * parallel to splits videos (when 'splitType' is bySize or byTime)
982
- */
983
- //includeFullVideo?: boolean;
984
- }
985
-
986
- export interface RecordingOptions extends RecordingBaseOptions {
987
- split?: SplitOptions;
988
-
989
- /**
990
- * Output file path (without file extension)
991
- */
992
- filePath: string;
993
- }
994
-
995
- export interface ReplayOptions extends RecordingBaseOptions {
996
- /**
997
- * Defines the length of the buffer to be recorded in seconds
998
- */
999
- bufferSecond: number;
1000
-
1001
- /**
1002
- * Set replay's root folder path
1003
- */
1004
- rootFolder: string;
1005
- }
1006
-
1007
- export declare type ReplayCallback = (replay: ReplayVideo) => void;
1008
- export declare type StopCallback = (args: RecordStopEventArgs) => void;
1009
- export declare type SplitCallback = (videoInfo: SplitRecordArgs) => void;
1010
- export declare type StartCallback = (args: RecordEventArgs) => void;
1011
- export declare type ReplayStopCallback = (args: RecordEventArgs) => void;
1012
-
1013
- export interface CaptureReplayOptions {
1014
- /**
1015
- * Replay file name (without extension)
1016
- */
1017
- fileName: string;
1018
-
1019
- /**
1020
- * The video length, in milliseconds to include prior to the time of this call.
1021
- */
1022
- pastDuration: number;
1023
-
1024
- /**
1025
- * Auto stop (optional) in milliseconds.
1026
- * When set to Zero, will create replay with pass duration only.
1027
- * if not set, use |ActiveReplay| to stop the replay
1028
- */
1029
- timeout?: number;
1030
- }
1031
-
1032
- export interface RecordEventArgs {
1033
- /**
1034
- * Video file path
1035
- */
1036
- filePath?: string | undefined;
1037
-
1038
- /**
1039
- * Recording error message when recording fail to record successfully.
1040
- */
1041
- error?: string;
1042
-
1043
- /**
1044
- * Recording stop reason
1045
- */
1046
- reason?: ErrorCode | number;
1047
-
1048
- /**
1049
- * Recording Stats
1050
- */
1051
- stats?: RecorderStats;
1052
- }
1053
-
1054
- export interface RecordStopEventArgs extends RecordEventArgs {
1055
- /**
1056
- * Video duration in milliseconds when recording ended successfully
1057
- */
1058
- duration?: number;
1059
-
1060
- /**
1061
- *
1062
- */
1063
- hasError: boolean;
1064
-
1065
- /**
1066
- * number of splits (if had any)
1067
- */
1068
- splitCount?: number;
1069
-
1070
- /**
1071
- * Video start time (Epoch)
1072
- */
1073
- startTimeEpoch?: number;
1074
- }
1075
-
1076
- export interface SplitRecordArgs extends RecordEventArgs {
1077
- /**
1078
- * Video duration in milliseconds when recording ended successfully
1079
- */
1080
- duration: number;
1081
-
1082
- /**
1083
- * number of split
1084
- */
1085
- splitCount: number;
1086
-
1087
- /** Next video file path */
1088
- nextFilePath: string;
1089
-
1090
- /**
1091
- * Video start time (Epoch)
1092
- */
1093
- startTimeEpoch?: number;
1094
- }
1095
-
1096
- export interface ReplayVideo extends RecordEventArgs {
1097
- /**
1098
- * Replay video duration in millisecond
1099
- */
1100
- duration: number;
1101
-
1102
- /**
1103
- * Video start time (Epoch UTC) (first frame)
1104
- */
1105
- startTimeEpoch: number;
1106
- }
1107
-
1108
- /**
1109
- * handling current ongoing active replay video.
1110
- */
1111
- export interface ActiveReplay {
1112
- callback?: ReplayCallback;
1113
-
1114
- /**
1115
- * current replay timeout in milliseconds (since was set, if was set)
1116
- */
1117
- readonly timeout?: number;
1118
-
1119
- /**
1120
- * Stop replay now.
1121
- * @param callback (optional) set or override exiting complete callback
1122
- */
1123
- stop(callback?: ReplayCallback);
1124
-
1125
- /**
1126
- * Stop after |timeout| in milliseconds
1127
- * @param callback (optional) set or override exiting complete callback
1128
- */
1129
- stopAfter(timeout: number, callback?: ReplayCallback);
1130
- }
1131
-
1132
- export interface RecorderStats {
1133
- /**
1134
- * Current CPU usage in percent
1135
- */
1136
- cpuUsage: number;
1137
- /**
1138
- * Amount of memory in MB currently being used by Recorder
1139
- */
1140
- memoryUsage: number;
1141
- /**
1142
- * Available disk space on the device being used for recording storage
1143
- */
1144
- availableDiskSpace: number;
1145
- /**
1146
- * Current FPS being rendered
1147
- */
1148
- activeFps: number;
1149
- /**
1150
- * Average time in milliseconds that Recorder is taking to render a frame
1151
- */
1152
- averageFrameRenderTime: number;
1153
- /**
1154
- * Number of frames skipped by Recorder in the render thread
1155
- */
1156
- renderSkippedFrames: number;
1157
- /**
1158
- * Total number of frames outputted by the render thread
1159
- */
1160
- renderTotalFrames: number;
1161
- /**
1162
- * Number of frames skipped by Recorder in the output thread
1163
- */
1164
- outputSkippedFrames: number;
1165
- /**
1166
- * Total number of frames outputted by the output thread
1167
- */
1168
- outputTotalFrames: number;
1169
- }
1170
-
1171
- /**
1172
- * Recorder Error object
1173
- */
1174
- export class RecorderError extends Error {
1175
- code: ErrorCode;
1176
- internalError?: Error;
1177
- }
1
+ import { GameInfo } from "../common/common";
2
+
3
+ type Rect = { top: number; left: number; width: number; height: number };
4
+
5
+ export type AudioDeviceType = 'input' | 'output';
6
+
7
+ export declare type kSupportedEncodersTypes =
8
+ | 'ffmpeg_svt_av1'
9
+ | 'ffmpeg_aom_av1'
10
+ | 'jim_nvenc'
11
+ | 'jim_hevc_nvenc'
12
+ | 'jim_av1_nvenc'
13
+ | 'obs_x264'
14
+ | 'h264_texture_amf'
15
+ | 'h265_texture_amf'
16
+ | 'av1_texture_amf'
17
+ | 'obs_qsv11_v2'
18
+ | 'obs_qsv11_hevc'
19
+ | 'obs_qsv11_av1';
20
+
21
+ export declare type kKnownAudioEncodersTypes =
22
+ | 'ffmpeg_aac'
23
+ | 'ffmpeg_opus'
24
+ | 'ffmpeg_pcm_s16le'
25
+ | 'ffmpeg_pcm_s24le'
26
+ | 'ffmpeg_pcm_f32le'
27
+ | 'ffmpeg_alac'
28
+ | 'ffmpeg_flac'
29
+ | string;
30
+
31
+ // Sample Rate
32
+ export declare type kSampleRate48kHz = 48000;
33
+ export declare type kSampleRate441kHz = 44100;
34
+ export declare type kSpeakerLayout =
35
+ | 'SPEAKERS_MONO'
36
+ | 'SPEAKERS_STEREO'
37
+ | 'SPEAKERS_2POINT1'
38
+ | 'SPEAKERS_4POINT0'
39
+ | 'SPEAKERS_4POINT1'
40
+ | 'SPEAKERS_5POINT1'
41
+ | 'SPEAKERS_7POINT1';
42
+
43
+ export const enum AudioTracks {
44
+ None = 0,
45
+ Track1 = 1 << 0,
46
+ Track2 = 1 << 1, // 0010
47
+ Track3 = 1 << 2, // 0100
48
+ Track4 = 1 << 3, // 1000
49
+ Track5 = 1 << 4, // 1000
50
+ Track6 = 1 << 5, // 1000
51
+ All = 0xff,
52
+ }
53
+
54
+ export const enum DisplayCaptureType {
55
+ Auto = 0,
56
+
57
+ /** Direct Duplicator */
58
+ DXGI = 1,
59
+
60
+ /**
61
+ * Windows 10 (1903 and up)
62
+ */
63
+ WGC = 2,
64
+
65
+ /**
66
+ * Compatibility mode
67
+ */
68
+ BitBlt = 3,
69
+ }
70
+
71
+ export declare type CaptureSourceType = 'Display' | 'Game' | 'Window';
72
+
73
+ export interface AudioDevice {
74
+ readonly type: AudioDeviceType;
75
+ readonly id: string;
76
+ readonly name: string;
77
+ readonly isDefault: boolean;
78
+ }
79
+
80
+ export interface EncoderInfoBase {
81
+ readonly codec: string;
82
+ readonly name: string;
83
+ }
84
+
85
+ export interface EncoderProperty {
86
+ readonly default: any;
87
+ readonly description: string;
88
+ readonly values?: Record<string | number, string>;
89
+ }
90
+
91
+ export interface AudioEncoderInfo extends EncoderInfoBase {
92
+ readonly type: kKnownAudioEncodersTypes;
93
+ }
94
+
95
+ export interface VideoEncoderInfo extends EncoderInfoBase {
96
+ readonly type: kSupportedEncodersTypes;
97
+ readonly properties?: Record<string, EncoderProperty>;
98
+ }
99
+
100
+ export interface AdapterInfo {
101
+ readonly index: 0;
102
+ readonly name: string;
103
+ readonly driver: string;
104
+ readonly hagsEnabled: boolean;
105
+ readonly hagsEnabledByDefault: boolean;
106
+ }
107
+
108
+ export interface AudioInformation {
109
+ readonly inputDevices: AudioDevice[];
110
+ readonly outputDevices: AudioDevice[];
111
+ readonly encoders: AudioEncoderInfo[];
112
+
113
+ readonly defaultEncoder: kKnownAudioEncodersTypes;
114
+ }
115
+
116
+ export interface MonitorInfo {
117
+ readonly adapterIndex: number;
118
+ readonly id: string;
119
+ readonly altId: string;
120
+ readonly dpi: number;
121
+ readonly attachedToDesktop: boolean;
122
+ readonly friendlyName: string;
123
+ readonly refreshRate: number;
124
+ readonly rect: Rect;
125
+ readonly isPrimary: boolean;
126
+ readonly displayIndex: number;
127
+ }
128
+
129
+ export interface VideoInformation {
130
+ readonly encoders: VideoEncoderInfo[];
131
+ readonly adapters: AdapterInfo[];
132
+
133
+ readonly defaultEncoder: kSupportedEncodersTypes;
134
+ }
135
+
136
+ export interface RecordingInformation {
137
+ audio: AudioInformation;
138
+ video: VideoInformation;
139
+ monitors: MonitorInfo[];
140
+ }
141
+
142
+ // Video settings
143
+ export declare type kFileFormat =
144
+ | 'fragmented_mp4'
145
+ | 'fragmented_mov'
146
+ | 'mp4'
147
+ | 'flv'
148
+ | 'mkv'
149
+ | 'mov'
150
+ | 'mpegts'
151
+ | 'hls';
152
+
153
+ export declare type kVideoColorFormat =
154
+ | 'NV12'
155
+ | 'I420'
156
+ | 'I444'
157
+ | 'P010'
158
+ | 'I010'
159
+ | 'P216'
160
+ | 'P416'
161
+ | 'BGRA';
162
+
163
+ export declare type kVideoColorSpec =
164
+ | 'sRGB'
165
+ | '709'
166
+ | '601'
167
+ | '2100PQ'
168
+ | '2100HLG';
169
+
170
+ export declare type kVideoColorRange = 'Partial' | 'Full';
171
+
172
+ // encoder AMD
173
+ export declare type kAMDEncoderRateControl =
174
+ | 'CBR'
175
+ | 'CQP'
176
+ | 'VBR'
177
+ | 'VBR_LAT'
178
+ | 'QVBR'
179
+ | 'HQVBR'
180
+ | 'HQCBR';
181
+
182
+ export declare type kAMDEncoderPreset = 'quality' | 'balanced' | 'speed';
183
+ export declare type kAMDEncoderPresetAV1 = kAMDEncoderPreset | 'highQuality';
184
+ export declare type kAMDEncoderProfileAV1 = 'main';
185
+ export declare type kAMDEncoderProfile264 =
186
+ | kAMDEncoderProfileAV1
187
+ | 'high'
188
+ | 'baseline';
189
+
190
+ // encoder NVENC
191
+ export declare type kNVENCEncoderRateControl =
192
+ | 'CBR'
193
+ | 'CQP'
194
+ | 'VBR'
195
+ | 'Lossless';
196
+ export declare type kNVENCEncoderMultipass = 'qres' | 'fullres' | 'disabled';
197
+ export declare type kNVENCEncoderTuning = 'hq' | 'll' | 'ull';
198
+ export declare type kNVENCEncoderProfile = 'main';
199
+ export declare type kNVENCEncoderProfile264 =
200
+ | kNVENCEncoderProfile
201
+ | 'high'
202
+ | 'baseline';
203
+ export declare type kNVENCEncoderProfileHEVC = kNVENCEncoderProfile | 'main10';
204
+
205
+ // encoder X264
206
+ export declare type kX264EncoderRateControl = 'CBR' | 'ABR' | 'VBR' | 'CRF';
207
+
208
+ export declare type kX264EncoderProfile = '' | 'baseline' | 'main' | 'high';
209
+ export declare type kX264EncoderTune =
210
+ | ''
211
+ | 'film'
212
+ | 'animation'
213
+ | 'grain'
214
+ | 'stillimage'
215
+ | 'psnr'
216
+ | 'ssim'
217
+ | 'fastdecode'
218
+ | 'zerolatency';
219
+
220
+ export declare type kX264EncoderPreset =
221
+ | 'ultrafast'
222
+ | 'superfast'
223
+ | 'veryfast' // default
224
+ | 'faster'
225
+ | 'fast'
226
+ | 'medium'
227
+ | 'slow'
228
+ | 'slower'
229
+ | 'veryslow'
230
+ | 'placebo';
231
+
232
+ // QuickSync
233
+
234
+ export declare type kQuickSyncEncoderProfileHEVC = kNVENCEncoderProfileHEVC;
235
+ export declare type kQuickSyncEncoderProfile264 = kNVENCEncoderProfile264;
236
+ export declare type kQuickSyncTargetUsage =
237
+ | 'TU1' // Slowest (Best Quality)
238
+ | 'TU2' // Slower
239
+ | 'TU3' // Slow
240
+ | 'TU4' // Balanced (Medium Quality)
241
+ | 'TU5' // Fast
242
+ | 'TU6' // Faster
243
+ | 'TU7'; // Fastest (Best Speed)
244
+
245
+ export declare type kQuickSyncEncoderRateControl =
246
+ | 'CBR'
247
+ | 'CQP'
248
+ | 'VBR'
249
+ | 'ICQ';
250
+
251
+ export declare type VideoRecordingSplitType = 'byTime' | 'bySize' | 'manual';
252
+
253
+ export interface VideoSettings {
254
+ /*
255
+ Base width resolution. Default Half HD (main monitor ratio)
256
+ */
257
+ baseWidth: number;
258
+
259
+ /*
260
+ Base height resolution. Default Half HD (main monitor ratio)
261
+ */
262
+ baseHeight: number;
263
+
264
+ /**
265
+ * Video FPS.
266
+ *
267
+ * Default is 30.
268
+ */
269
+ fps?: number;
270
+
271
+ /**
272
+ * Output (scaled) resolution. Default is same as baseWidth
273
+ */
274
+ outputWidth?: number;
275
+
276
+ /**
277
+ * Output (scaled) resolution. Default is same as baseHeight
278
+ */
279
+ outputHeight?: number;
280
+
281
+ /** Default is 'NV12' */
282
+ colorFormat?: kVideoColorFormat;
283
+
284
+ /**
285
+ * Default is '709'
286
+ */
287
+ colorRange?: kVideoColorRange;
288
+
289
+ /**
290
+ * Default is Partial
291
+ */
292
+ colorSpec?: kVideoColorSpec;
293
+
294
+ /**
295
+ * Default is 300 nits
296
+ */
297
+ sdrWhite?: number;
298
+
299
+ /*
300
+ *Default is 1000 nits
301
+ */
302
+ hdrPeak?: number;
303
+ }
304
+
305
+ export interface AudioDeviceSettings {
306
+ /**
307
+ * 0.0 - 20.0, default is 1.0 (100%)
308
+ */
309
+ volume?: number;
310
+
311
+ /**
312
+ * Default is False
313
+ */
314
+ mono?: boolean;
315
+
316
+ /**
317
+ * 0.0. - 1.0. Default is 0.5
318
+ * */
319
+ balance?: number;
320
+
321
+ /**
322
+ * include Device tracks. default is include to all
323
+ */
324
+ tracks?: AudioTracks;
325
+
326
+ /**
327
+ *
328
+ */
329
+ use_device_timing?: boolean;
330
+ }
331
+
332
+ export interface AudioDeviceSettingsInfo extends AudioDeviceSettings {
333
+ readonly type: AudioDeviceType;
334
+
335
+ /**
336
+ * Device Id
337
+ */
338
+ readonly id: string;
339
+
340
+ /**
341
+ * Audio device unique name or Process name for application
342
+ */
343
+ readonly name: string;
344
+ }
345
+
346
+ export interface ApplicationAudioDeviceSettingsInfo extends AudioDeviceSettingsInfo {
347
+ readonly type: 'output';
348
+ }
349
+
350
+ export interface DefaultAudioDeviceParams {
351
+ /**
352
+ * Auto Separate audio tracks
353
+ * when using the default audio sources, the Input and the Output audio sources
354
+ * will use dedicate tracks (2, 3).
355
+ * and track number 1 include both
356
+ */
357
+ separateAudioTracks?: boolean;
358
+ }
359
+
360
+ export interface AudioDeviceParams extends DefaultAudioDeviceParams {
361
+ /**
362
+ * Device Id
363
+ */
364
+ id: string;
365
+
366
+ /**
367
+ * Audio device unique name
368
+ */
369
+ name: string;
370
+ }
371
+
372
+ export interface ApplicationAudioCaptureParams
373
+ extends DefaultAudioDeviceParams {
374
+ /**
375
+ * Process name to capture (i.e Discord.exe or minecraft.exe)
376
+ */
377
+ processName: string;
378
+ }
379
+
380
+ export interface AudioGeneralSettings {
381
+ /**
382
+ * Audio sample rate.
383
+ * Default is 48000
384
+ */
385
+ sampleRate?: kSampleRate48kHz | kSampleRate441kHz;
386
+
387
+ /**
388
+ * Speaker layout.
389
+ * Default is Stereo
390
+ */
391
+ speakerLayer?: kSpeakerLayout;
392
+
393
+ /**
394
+ * Win32 only. Default it True
395
+ */
396
+ disableAudioDucking?: boolean;
397
+
398
+ /**
399
+ *
400
+ */
401
+ lowLatencyAudioBuffering?: boolean;
402
+ }
403
+
404
+ export interface CaptureSourceSettings {
405
+ /**
406
+ * Source will be center and stretch (if needed) to video output size
407
+ * (Default is True)
408
+ */
409
+ stretchToOutputSize?: boolean;
410
+ }
411
+
412
+ export interface MonitorCaptureSourceSettings extends CaptureSourceSettings {
413
+ monitorId: string;
414
+
415
+ /**
416
+ * Default is Auto
417
+ */
418
+ type?: DisplayCaptureType;
419
+
420
+ /**
421
+ *Capture mouse cursor. Default is true.
422
+ */
423
+ captureCursor?: boolean;
424
+
425
+ /**
426
+ *
427
+ */
428
+ forceSDR?: boolean;
429
+ }
430
+
431
+ export interface GameCaptureSourceSettings extends CaptureSourceSettings {
432
+ /**
433
+ * Game Process to capture, may contain the process name or process Id.
434
+ */
435
+ gameProcess: string | number;
436
+
437
+ /**
438
+ * Slow capture. using shared memory
439
+ */
440
+ sliCompatibility?: boolean;
441
+
442
+ /**
443
+ *Capture mouse cursor. Default is true.
444
+ */
445
+ captureCursor?: boolean;
446
+
447
+ /**
448
+ *
449
+ */
450
+ allowTransparency?: boolean;
451
+
452
+ /**
453
+ *
454
+ */
455
+ premultipliedAlpha?: boolean;
456
+
457
+ /**
458
+ *Capture third-party overlays
459
+ */
460
+ captureOverlays?: boolean;
461
+
462
+ /**
463
+ * Limit capture framerate
464
+ */
465
+ limitFramerate?: boolean;
466
+
467
+ /**
468
+ *Use Rec.2100 (PQ) instead sRGB
469
+ */
470
+ rgb10a2Space?: boolean;
471
+ }
472
+
473
+ export interface CaptureSource {
474
+ readonly type: CaptureSourceType;
475
+ readonly properties: any;
476
+ }
477
+
478
+ export interface GameCaptureSource extends CaptureSource {
479
+ readonly type: 'Game';
480
+ readonly properties: GameCaptureSourceSettings;
481
+ }
482
+
483
+ export interface MonitorCaptureSource extends CaptureSource {
484
+ readonly type: 'Display';
485
+ readonly properties: MonitorCaptureSourceSettings;
486
+ }
487
+
488
+ export interface AudioSettings extends AudioGeneralSettings {
489
+ inputs: AudioDeviceSettingsInfo[];
490
+ outputs: AudioDeviceSettingsInfo[];
491
+ applications: ApplicationAudioDeviceSettingsInfo[];
492
+ }
493
+
494
+ export interface VideoEncoderSettingsBase {
495
+ type: kSupportedEncodersTypes;
496
+
497
+ /**
498
+ * Bitrate.
499
+ *
500
+ * Default is 8000
501
+ */
502
+ bitrate?: number;
503
+
504
+ /**
505
+ * Key frame in second.
506
+ *
507
+ * Default is 0 (i.e auto)
508
+ */
509
+ keyint_sec?: number;
510
+
511
+ /**
512
+ * Max bitrate
513
+ */
514
+ max_bitrate?: number;
515
+ }
516
+
517
+ /**
518
+ * NVENC encoder setting
519
+ */
520
+ export interface EncoderSettingsNVENC extends VideoEncoderSettingsBase {
521
+ /**
522
+ * Rate Control. Default is 'CBR'
523
+ */
524
+ rate_control?: kNVENCEncoderRateControl;
525
+
526
+ /**
527
+ * Default is p5.
528
+ *
529
+ * 'p1' - Fastest (Lowest Quality)
530
+ *
531
+ * 'p2' - Faster (Lower Quality)
532
+ *
533
+ * 'p3' - Fast (Low Quality)
534
+ *
535
+ * 'p4' - Medium (Medium Quality)
536
+ *
537
+ * 'p5' - Slow (Good Quality) - Default
538
+ *
539
+ * 'p6' - Slower (Better Quality)
540
+ *
541
+ * 'p7' - Slowest (Best Quality)
542
+ */
543
+ preset2?: 'p1' | 'p2' | 'p3' | 'p4' | 'p5' | 'p6' | 'p7';
544
+
545
+ /**
546
+ * 'qres' - Two Passes (Quarter Resolution) - Default
547
+ *
548
+ * 'disabled' - Single Pass
549
+ *
550
+ * 'fullres' - Two Passes (Full Resolution)
551
+ */
552
+ multipass?: kNVENCEncoderMultipass;
553
+
554
+ /**
555
+ * Default is 'hq'
556
+ */
557
+ tune?: kNVENCEncoderTuning;
558
+
559
+ /**
560
+ * Default is True
561
+ */
562
+ psycho_aq?: boolean;
563
+
564
+ /**
565
+ * B-Frame. Default is 2
566
+ */
567
+ bf?: number;
568
+
569
+ /**
570
+ * Enables dynamic B-frames.If disabled, the encoder will always use the number
571
+ * of B-frames specified in the 'Max B-frames' setting.\n\nIf enabled,
572
+ * it will increase visual quality by only using however many B-frames
573
+ * are necessary, up to the maximum,\nat the cost of increased GPU utilization.
574
+ * Default is False.
575
+ */
576
+ lookahead?: boolean;
577
+
578
+ /**
579
+ * Gpu index. Default is 0
580
+ */
581
+ gpu?: number;
582
+
583
+ /**
584
+ * Default is 'main'
585
+ */
586
+ profile?: kNVENCEncoderProfile | string;
587
+ }
588
+
589
+ export interface EncoderSettingsNVENC264 extends EncoderSettingsNVENC {
590
+ /**
591
+ * Profile (Default is 'high')
592
+ */
593
+ profile?: kNVENCEncoderProfile264;
594
+ }
595
+
596
+ export interface EncoderSettingsNVENCHEVC extends EncoderSettingsNVENC {
597
+ /**
598
+ * Profile (Default is 'main')
599
+ */
600
+ profile?: kNVENCEncoderProfileHEVC;
601
+ }
602
+
603
+ // AMD
604
+ export interface EncoderSettingsAMF extends VideoEncoderSettingsBase {
605
+ /**
606
+ * Rate Control. Default is 'CBR'
607
+ */
608
+ rate_control?: kAMDEncoderRateControl;
609
+
610
+ /**
611
+ * Use to specify custom AMF or FFmpeg options.
612
+ * For example, \"level=5.2 profile=main\". Check the AMF encoder docs for more details.
613
+ */
614
+ ffmpeg_opts?: string;
615
+
616
+ /**
617
+ * CPQ (Default is 20)
618
+ */
619
+ cpq?: number;
620
+
621
+ /**
622
+ * Max B-frames (Default is 3)
623
+ */
624
+ bf?: number;
625
+ }
626
+
627
+ export interface EncoderSettingsAMFAV1 extends EncoderSettingsAMF {
628
+ /**
629
+ * Preset (Default is main)
630
+ */
631
+ profile?: kAMDEncoderProfileAV1;
632
+
633
+ /**
634
+ * preset
635
+ */
636
+ preset?: kAMDEncoderPresetAV1;
637
+ }
638
+
639
+ export interface EncoderSettingsAMF264 extends EncoderSettingsAMF {
640
+ /**
641
+ * Preset (Default is high)
642
+ */
643
+ profile?: kAMDEncoderProfile264;
644
+
645
+ /*
646
+ * preset
647
+ */
648
+ preset?: kAMDEncoderPreset;
649
+ }
650
+
651
+ export interface EncoderSettingsAMFHVEC extends EncoderSettingsAMF {
652
+ /*
653
+ * preset
654
+ */
655
+ preset?: kAMDEncoderPreset;
656
+ }
657
+
658
+ export interface EncoderSettingsQuickSync extends VideoEncoderSettingsBase {
659
+ /**
660
+ * Rate Control (Default is 'CBR')
661
+ */
662
+ rate_control?: kQuickSyncEncoderRateControl;
663
+
664
+ /**
665
+ * Target Usage / Preset (Default is 'TU4' - Balanced (Medium Quality))
666
+ */
667
+ target_usage?: kQuickSyncTargetUsage;
668
+
669
+ /**
670
+ * bFrames (Default is 3)
671
+ */
672
+ bframes?: number;
673
+
674
+ /**
675
+ * Subjective Video Enhancements (Default is 'true')
676
+ */
677
+ enhancements?: boolean;
678
+ }
679
+
680
+ export interface EncoderSettingsQuickSync264 extends EncoderSettingsQuickSync {
681
+ /**
682
+ * Profile (Default 'high' for x264 and 'main' for 'HEVC' or 'AV1' )
683
+ */
684
+ profile?: kQuickSyncEncoderProfile264;
685
+ }
686
+
687
+ export interface EncoderSettingsQuickSyncHEVC extends EncoderSettingsQuickSync {
688
+ /**
689
+ * Profile (Default 'high' for x264 and 'main' for 'HEVC' or 'AV1' )
690
+ */
691
+ profile?: kQuickSyncEncoderProfileHEVC;
692
+ }
693
+
694
+ export interface EncoderSettingsX264 extends VideoEncoderSettingsBase {
695
+ /**
696
+ * Rate Control (Default is rate_control);
697
+ */
698
+ rate_control?: kX264EncoderRateControl;
699
+
700
+ /**
701
+ * Preset (Default is 'veryfast')
702
+ */
703
+ preset?: kX264EncoderPreset;
704
+
705
+ /**
706
+ * Profile (Default is None)
707
+ */
708
+ profile?: kX264EncoderProfile;
709
+
710
+ /**
711
+ * Tun (Default is None)
712
+ */
713
+ tune?: kX264EncoderTune;
714
+
715
+ /**
716
+ * x264 Options (separated by space)
717
+ */
718
+ x264opts?: string;
719
+
720
+ /**
721
+ * Use Custom buffer size
722
+ */
723
+ use_bufsize?: boolean;
724
+
725
+ /**
726
+ * Custom buffer size (Valid when 'use_bufsize' is true)
727
+ */
728
+ buffer_size?: number;
729
+ }
730
+
731
+ export interface EncoderSettingsQuickSyncH264 extends VideoEncoderSettingsBase {
732
+ profile?: kQuickSyncEncoderProfile264;
733
+ }
734
+
735
+ export interface CaptureSettings {
736
+ videoSettings: VideoSettings;
737
+
738
+ audioSettings: AudioSettings;
739
+
740
+ videoEncoderSettings: VideoEncoderSettingsBase;
741
+
742
+ audioEncoder: AudioEncoderInfo;
743
+
744
+ sources: CaptureSource[];
745
+ }
746
+
747
+ export interface CaptureSettingsBuilder extends CaptureSettings {
748
+ /**
749
+ * Add Screen video capture source
750
+ * @param settings
751
+ */
752
+ addScreenSource(
753
+ settings: MonitorCaptureSourceSettings
754
+ ): CaptureSettingsBuilder;
755
+
756
+ /**
757
+ * Add Game video capture source
758
+ * @param settings
759
+ */
760
+ addGameSource(settings: GameCaptureSourceSettings):
761
+ CaptureSettingsBuilder;
762
+
763
+ /**
764
+ * Add Audio device capture
765
+ */
766
+ addAudioCapture(
767
+ params: AudioDeviceParams,
768
+ settings?: AudioDeviceSettings
769
+ ): CaptureSettingsBuilder;
770
+
771
+ /**
772
+ * Add Default device (Input or Output) if not already added
773
+ * @param type
774
+ * @param params
775
+ * @param settings
776
+ */
777
+ addAudioDefaultCapture(
778
+ type: AudioDeviceType,
779
+ params?: DefaultAudioDeviceParams,
780
+ settings?: AudioDeviceSettings
781
+ ): CaptureSettingsBuilder;
782
+
783
+ /**
784
+ *
785
+ * @param param
786
+ * @param settings
787
+ */
788
+ addApplicationAudioCapture(
789
+ param: ApplicationAudioCaptureParams,
790
+ settings?: AudioDeviceSettings
791
+ ): CaptureSettingsBuilder;
792
+
793
+ /**
794
+ * Return CaptureSettings object
795
+ */
796
+ build(): CaptureSettings;
797
+ }
798
+
799
+ export interface CaptureSettingsOptions {
800
+ /**
801
+ * encoder type to create capture setting.
802
+ * Default is the best default encoder detected (GPU -> x264)
803
+ */
804
+ videoEncoder?: kSupportedEncodersTypes;
805
+
806
+ /**
807
+ * Default is 'ffmpeg_aac' (FFmpeg AAC).
808
+ * use queryInformation().encoders.audio gor supported encoders
809
+ */
810
+ audioEncoder?: kKnownAudioEncodersTypes;
811
+
812
+ /**
813
+ * Add Default Audio Devices (Default is True)
814
+ */
815
+ includeDefaultAudioSources?: boolean;
816
+
817
+ /**
818
+ * Auto Separate audio tracks
819
+ * when using the default audio sources, the Input and the Output audio sources
820
+ * will use dedicate tracks (2, 3).
821
+ * and track number 1 include both
822
+ */
823
+ separateAudioTracks?: boolean;
824
+ }
825
+
826
+ // Obs Query Information types
827
+ export interface GraphicsInformation {
828
+ adapters: AdapterInfo[];
829
+ monitors: MonitorInfo[];
830
+ }
831
+
832
+ export interface EncoderInformation {
833
+ video: VideoEncoderInfo[];
834
+ audio: AudioEncoderInfo[];
835
+ }
836
+
837
+ export interface RecordingAppOptions {
838
+ /**
839
+ * Show Recorder capture window
840
+ */
841
+ showDebugWindow?: boolean;
842
+
843
+ /**
844
+ * Enable recorder debug logs
845
+ */
846
+ enableDebugLogs?: boolean;
847
+
848
+ /**
849
+ * Custom command lines when launching recorder
850
+ */
851
+ customCommandLineArgs?: string[];
852
+
853
+ /**
854
+ * Override OBS binaries
855
+ */
856
+ overrideOBSFolder?: string;
857
+
858
+ /**
859
+ * Emit 'stats' event interval in milliseconds. Default is 2000 (2 second)
860
+ * note: set 0 to disable stats emit
861
+ */
862
+ statsInterval?: number;
863
+ }
864
+
865
+ export const enum ErrorCode {
866
+ /**
867
+ * Generic Unknown error
868
+ */
869
+ Unknown = -1001,
870
+
871
+ /**
872
+ * Obs process crashed
873
+ */
874
+ ProcessTerminated = -1000,
875
+
876
+ /**
877
+ * Missing binaries
878
+ */
879
+ MissingBinaries = -999,
880
+
881
+ /**
882
+ * Connection to obs process error
883
+ */
884
+ ConnectionOBSError = -998,
885
+
886
+ /**
887
+ * Can't preform request while recording
888
+ */
889
+ AlreadyRunning = -997,
890
+
891
+ /**
892
+ *
893
+ */
894
+ SplitRecordingDisabled = -12,
895
+
896
+ /**
897
+ *
898
+ */
899
+ MissingOrInvalidParameters = -11,
900
+
901
+ /**
902
+ *
903
+ */
904
+ NoActiveRecording = -10,
905
+
906
+ /**
907
+ * Encoder error
908
+ */
909
+ EncoderError = -8,
910
+
911
+ /**
912
+ * Recording error
913
+ */
914
+ NoDiskSpaceError = -7,
915
+
916
+ /**
917
+ * Video file processing error
918
+ */
919
+ ProcessOutputError = -4,
920
+
921
+ /**
922
+ * Video bad path
923
+ */
924
+ BadPathError = -1,
925
+
926
+ /**
927
+ * Success
928
+ */
929
+ Success = 0,
930
+
931
+ /**
932
+ * Stop due to low disk space (less then 50NB left at output folder)
933
+ */
934
+ SuccessLowDiskSpace = 1,
935
+
936
+ /**
937
+ * Replay stopped while creating replay (partial video)
938
+ */
939
+ SuccessWithError = 2,
940
+ }
941
+
942
+ export interface RecordingBaseOptions {
943
+ /**
944
+ * Video file format. Default is 'fragmented_mp4'
945
+ */
946
+ fileFormat?: kFileFormat;
947
+
948
+ /**
949
+ * Video Audio tracks, default is 'Track1' or 'Track1'| 'Track2' |'Track3'
950
+ * if |separateAudioTracks| is on.
951
+ */
952
+ audioTrack?: AudioTracks;
953
+
954
+ /**
955
+ * Auto shutdown recording when game exit
956
+ * Note: valid when recording with game capture source
957
+ */
958
+ autoShutdownOnGameExit?: boolean;
959
+ }
960
+
961
+ /**
962
+ *
963
+ */
964
+ export interface SplitOptions {
965
+ //splitType: VideoRecordingSplitType;
966
+
967
+ enableManual: boolean;
968
+
969
+ /**
970
+ * Split video by time (in seconds).
971
+ */
972
+ maxTimeSecond?: number;
973
+
974
+ /**
975
+ * Split video by size (MB).
976
+ */
977
+ maxBySizeMB?: number;
978
+
979
+ /**
980
+ * Full video will be recorded to disk
981
+ * parallel to splits videos (when 'splitType' is bySize or byTime)
982
+ */
983
+ //includeFullVideo?: boolean;
984
+ }
985
+
986
+ export interface RecordingOptions extends RecordingBaseOptions {
987
+ split?: SplitOptions;
988
+
989
+ /**
990
+ * Output file path (without file extension)
991
+ */
992
+ filePath: string;
993
+ }
994
+
995
+ export interface ReplayOptions extends RecordingBaseOptions {
996
+ /**
997
+ * Defines the length of the buffer to be recorded in seconds
998
+ */
999
+ bufferSecond: number;
1000
+
1001
+ /**
1002
+ * Set replay's root folder path
1003
+ */
1004
+ rootFolder: string;
1005
+ }
1006
+
1007
+ export declare type ReplayCallback = (replay: ReplayVideo) => void;
1008
+ export declare type StopCallback = (args: RecordStopEventArgs) => void;
1009
+ export declare type SplitCallback = (videoInfo: SplitRecordArgs) => void;
1010
+ export declare type StartCallback = (args: RecordEventArgs) => void;
1011
+ export declare type ReplayStopCallback = (args: RecordEventArgs) => void;
1012
+
1013
+ export interface CaptureReplayOptions {
1014
+ /**
1015
+ * Replay file name (without extension)
1016
+ */
1017
+ fileName: string;
1018
+
1019
+ /**
1020
+ * The video length, in milliseconds to include prior to the time of this call.
1021
+ */
1022
+ pastDuration: number;
1023
+
1024
+ /**
1025
+ * Auto stop (optional) in milliseconds.
1026
+ * When set to Zero, will create replay with pass duration only.
1027
+ * if not set, use |ActiveReplay| to stop the replay
1028
+ */
1029
+ timeout?: number;
1030
+ }
1031
+
1032
+ export interface RecordEventArgs {
1033
+ /**
1034
+ * Video file path
1035
+ */
1036
+ filePath?: string | undefined;
1037
+
1038
+ /**
1039
+ * Recording error message when recording fail to record successfully.
1040
+ */
1041
+ error?: string;
1042
+
1043
+ /**
1044
+ * Recording stop reason
1045
+ */
1046
+ reason?: ErrorCode | number;
1047
+
1048
+ /**
1049
+ * Recording Stats
1050
+ */
1051
+ stats?: RecorderStats;
1052
+ }
1053
+
1054
+ export interface RecordStopEventArgs extends RecordEventArgs {
1055
+ /**
1056
+ * Video duration in milliseconds when recording ended successfully
1057
+ */
1058
+ duration?: number;
1059
+
1060
+ /**
1061
+ *
1062
+ */
1063
+ hasError: boolean;
1064
+
1065
+ /**
1066
+ * number of splits (if had any)
1067
+ */
1068
+ splitCount?: number;
1069
+
1070
+ /**
1071
+ * Video start time (Epoch)
1072
+ */
1073
+ startTimeEpoch?: number;
1074
+ }
1075
+
1076
+ export interface SplitRecordArgs extends RecordEventArgs {
1077
+ /**
1078
+ * Video duration in milliseconds when recording ended successfully
1079
+ */
1080
+ duration: number;
1081
+
1082
+ /**
1083
+ * number of split
1084
+ */
1085
+ splitCount: number;
1086
+
1087
+ /** Next video file path */
1088
+ nextFilePath: string;
1089
+
1090
+ /**
1091
+ * Video start time (Epoch)
1092
+ */
1093
+ startTimeEpoch?: number;
1094
+ }
1095
+
1096
+ export interface ReplayVideo extends RecordEventArgs {
1097
+ /**
1098
+ * Replay video duration in millisecond
1099
+ */
1100
+ duration: number;
1101
+
1102
+ /**
1103
+ * Video start time (Epoch UTC) (first frame)
1104
+ */
1105
+ startTimeEpoch: number;
1106
+ }
1107
+
1108
+ /**
1109
+ * handling current ongoing active replay video.
1110
+ */
1111
+ export interface ActiveReplay {
1112
+ callback?: ReplayCallback;
1113
+
1114
+ /**
1115
+ * current replay timeout in milliseconds (since was set, if was set)
1116
+ */
1117
+ readonly timeout?: number;
1118
+
1119
+ /**
1120
+ * Stop replay now.
1121
+ * @param callback (optional) set or override exiting complete callback
1122
+ */
1123
+ stop(callback?: ReplayCallback);
1124
+
1125
+ /**
1126
+ * Stop after |timeout| in milliseconds
1127
+ * @param callback (optional) set or override exiting complete callback
1128
+ */
1129
+ stopAfter(timeout: number, callback?: ReplayCallback);
1130
+ }
1131
+
1132
+ export interface RecorderStats {
1133
+ /**
1134
+ * Current CPU usage in percent
1135
+ */
1136
+ cpuUsage: number;
1137
+ /**
1138
+ * Amount of memory in MB currently being used by Recorder
1139
+ */
1140
+ memoryUsage: number;
1141
+ /**
1142
+ * Available disk space on the device being used for recording storage
1143
+ */
1144
+ availableDiskSpace: number;
1145
+ /**
1146
+ * Current FPS being rendered
1147
+ */
1148
+ activeFps: number;
1149
+ /**
1150
+ * Average time in milliseconds that Recorder is taking to render a frame
1151
+ */
1152
+ averageFrameRenderTime: number;
1153
+ /**
1154
+ * Number of frames skipped by Recorder in the render thread
1155
+ */
1156
+ renderSkippedFrames: number;
1157
+ /**
1158
+ * Total number of frames outputted by the render thread
1159
+ */
1160
+ renderTotalFrames: number;
1161
+ /**
1162
+ * Number of frames skipped by Recorder in the output thread
1163
+ */
1164
+ outputSkippedFrames: number;
1165
+ /**
1166
+ * Total number of frames outputted by the output thread
1167
+ */
1168
+ outputTotalFrames: number;
1169
+ }
1170
+
1171
+ /**
1172
+ * Recorder Error object
1173
+ */
1174
+ export class RecorderError extends Error {
1175
+ code: ErrorCode;
1176
+ internalError?: Error;
1177
+ }